qdrant / qdrant-dotnet

Qdrant .Net SDK
Apache License 2.0
92 stars 12 forks source link

Is it possible to set Port=None as Python? #74

Open fatihyildizhan opened 1 week ago

fatihyildizhan commented 1 week ago

Hello,

I didn't set a port. Is it possible to set Port=None as Python?

Python example: https://github.com/qdrant/qdrant-client/issues/394#issuecomment-2008190756

QdrantClient client = new(new Uri("https://url.com"), apiKey: "");

Thank you.

/// <summary>Instantiates a new Qdrant client.</summary>
/// <param name="host">The host to connect to.</param>
/// <param name="port">The port to connect to. Defaults to 6334.</param>
/// <param name="https">Whether to encrypt the connection using HTTPS. Defaults to <c>false</c>.</param>
/// <param name="apiKey">The API key to use.</param>
/// <param name="grpcTimeout">The timeout for gRPC calls to Qdrant; sets the gRPC deadline for all calls.</param>
/// <param name="loggerFactory">A logger factory through which to log messages.</param>
/// <remarks>
/// This type provides higher-level wrappers over the low-level Qdrant gRPC API. If these wrappers aren't
/// sufficient, <see cref="QdrantGrpcClient" /> can be used instead for low-level API access.
/// </remarks>
public QdrantClient(
    string host,
    int port = 6334,
    bool https = false,
    string? apiKey = null,
    TimeSpan grpcTimeout = default,
    ILoggerFactory? loggerFactory = null)
    : this(new UriBuilder(https ? "https" : "http", host, port).Uri, apiKey, grpcTimeout, loggerFactory)
{
}
russcam commented 1 week ago

Hi @fatihyildizhan

Yep, you can use the constructor that takes a Uri. The example is the same as you've specified in the question 🙂

QdrantClient client = new(new Uri("https://url.com"), apiKey: "");