Skip to main content

QdrantEmbeddingStorageService

Namespace: Wisej.AI.Services

Assembly: Wisej.AI

Represents a service for storing and retrieving embeddings using Qdrant.

public class QdrantEmbeddingStorageService : IEmbeddingStorageService

This class provides methods to store, retrieve, query, and remove embedded documents in a Qdrant vector database. It uses an HTTP client service to communicate with the Qdrant API.

Constructors​

QdrantEmbeddingStorageService(url)​

Initializes a new instance of the QdrantEmbeddingStorageService class.

NameTypeDescription
urlStringThe URL of the Qdrant service. Default is null.

Properties​

ApiKey​

String: Gets or sets the API key for the Qdrant service. (Default: null)

Authentication​

String: Gets or sets the Authentication method for the Qdrant service. (Default: null)

MaxBatchSize​

Int32: Gets or sets the maximum batch size used to store document vectors into the database. (Default: 100)

URL​

String: Gets or sets the URL of the Qdrant service. (Default: null)

Methods​

ExistsAsync(collectionName, documentName)​

Checks if a document exists in the specified collection.

ParameterTypeDescription
collectionNameStringThe name of the collection.
documentNameStringThe name of the document.

Returns: Task<Boolean>. A task that represents the asynchronous operation. The task result contains a boolean indicating whether the document exists.

GetApiKey()​

Retrieves the API key for the Qdrant service.

Returns: String. The API key for the Qdrant service.

QueryAsync(collectionName, query, topN, minSimilarity, filter)​

Queries the specified collection for documents similar to the provided query vector.

ParameterTypeDescription
collectionNameStringThe name of the collection.
querySingle[]The query vector to compare against.
topNInt32The number of top similar documents to return.
minSimilaritySingleThe minimum similarity threshold for documents to be considered.
filter Predicate<EmbeddedDocument>An optional filter predicate to apply to documents. Default is null.

Returns: Task<EmbeddedDocument[]>. A task that represents the asynchronous operation. The task result contains an array of EmbeddedDocument objects.

QueryAsync(collectionName, documentName, query, topN, minSimilarity)​

Queries the specified collection for a document similar to the given query vector.

ParameterTypeDescription
collectionNameStringThe name of the collection.
documentNameStringThe name of the document.
querySingle[]The query vector.
topNInt32The number of top similar documents to retrieve.
minSimilaritySingleThe minimum similarity threshold.

Returns: Task<EmbeddedDocument>. A task that represents the asynchronous operation. The task result contains an EmbeddedDocument object.

Throws:

RemoveAsync(collectionName, filter)​

Removes documents from the specified collection that match the given filter.

ParameterTypeDescription
collectionNameStringThe name of the collection.
filter Predicate<EmbeddedDocument>An optional filter predicate to apply to documents. Default is null.

Returns: Task. A task that represents the asynchronous operation.

RemoveAsync(collectionName, documentName)​

Removes a specific document from the collection.

ParameterTypeDescription
collectionNameStringThe name of the collection.
documentNameStringThe name of the document.

Returns: Task. A task that represents the asynchronous operation.

RetrieveAsync(collectionName, documentName, includeEmbedding)​

Retrieves a specific document from the collection.

ParameterTypeDescription
collectionNameStringThe name of the collection.
documentNameStringThe name of the document.
includeEmbeddingBooleanIndicates whether to include the embedding in the retrieved document.

Returns: Task<EmbeddedDocument>. A task that represents the asynchronous operation. The task result contains the EmbeddedDocument.

RetrieveAsync(collectionName, includeEmbedding, filter)​

Retrieves all documents from the specified collection that match the given filter.

ParameterTypeDescription
collectionNameStringThe name of the collection.
includeEmbeddingBooleanIndicates whether to include the embedding in the retrieved documents.
filter Predicate<EmbeddedDocument>An optional filter predicate to apply to documents. Default is null.

Returns: Task<EmbeddedDocument[]>. A task that represents the asynchronous operation. The task result contains an array of EmbeddedDocument objects.

StoreAsync(collectionName, document)​

Stores a document in the specified collection.

ParameterTypeDescription
collectionNameStringThe name of the collection.
documentEmbeddedDocumentThe document to store.

Returns: Task. A task that represents the asynchronous operation.

Throws:

Implements​

NameDescription
IEmbeddingStorageServiceRepresents a service for storing and querying embedded documents within specified collections.