> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/services/iembeddingstorageservice/wisej.ai.services.qdrantembeddingstorageservice.md).

# QdrantEmbeddingStorageService

Namespace: **Wisej.AI.Services**

Assembly: **Wisej.AI** (3.5.0.0)

Represents a service for storing and retrieving embeddings using Qdrant.

{% tabs %}
{% tab title="C#" %}

```csharp
public class QdrantEmbeddingStorageService : IEmbeddingStorageService
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class QdrantEmbeddingStorageService
    Inherits IEmbeddingStorageService
```

{% endtab %}
{% endtabs %}

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

### ![](/files/ptrKjmmRoQB76pvrIqh0) QdrantEmbeddingStorageService(url)

Initializes a new instance of the [QdrantEmbeddingStorageService](/ai/components/api/services/iembeddingstorageservice/wisej.ai.services.qdrantembeddingstorageservice.md) class.

| Name    | Type                                                          | Description                                       |
| ------- | ------------------------------------------------------------- | ------------------------------------------------- |
| **url** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The URL of the Qdrant service. Default is `null`. |

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) ApiKey

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the API key for the Qdrant service. (Default: `null`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Authentication

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the Authentication method for the Qdrant service. (Default: `null`)

### ![](/files/KL0Ik37djZRr8a07Wopd) MaxBatchSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum batch size used to store document vectors into the database. (Default: `100`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) URL

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the URL of the Qdrant service. (Default: `null`)

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) ExistsAsync(collectionName, documentName)

Checks if a document exists in the specified collection.

| Parameter          | Type                                                          | Description                 |
| ------------------ | ------------------------------------------------------------- | --------------------------- |
| **collectionName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the collection. |
| **documentName**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the document.   |

**Returns:** [Task\<Boolean>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains a boolean indicating whether the document exists.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetApiKey()

Retrieves the API key for the Qdrant service.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The API key for the Qdrant service.

### ![](/files/ptrKjmmRoQB76pvrIqh0) QueryAsync(collectionName, query, topN, minSimilarity, filter)

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

| Parameter                                   | Type                                                                                     | Description                                                          |
| ------------------------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| **collectionName**                          | [String](https://docs.microsoft.com/dotnet/api/system.string)                            | The name of the collection.                                          |
| **query**                                   | [Single\[\]](https://docs.microsoft.com/dotnet/api/system.single)                        | The query vector to compare against.                                 |
| **topN**                                    | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                              | The number of top similar documents to return.                       |
| **minSimilarity**                           | [Single](https://docs.microsoft.com/dotnet/api/system.single)                            | The minimum similarity threshold for documents to be considered.     |
| **filter** ![](/files/52BqKf9SltWQ97FbQSBF) | [Predicate\<EmbeddedDocument>](https://docs.microsoft.com/dotnet/api/system.predicate-1) | An optional filter predicate to apply to documents. Default is null. |

**Returns:** [Task\<EmbeddedDocument\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [EmbeddedDocument](/ai/components/api/embeddings/wisej.ai.embeddings.embeddeddocument.md) objects.

### ![](/files/ptrKjmmRoQB76pvrIqh0) QueryAsync(collectionName, documentName, query, topN, minSimilarity)

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

| Parameter          | Type                                                              | Description                                      |
| ------------------ | ----------------------------------------------------------------- | ------------------------------------------------ |
| **collectionName** | [String](https://docs.microsoft.com/dotnet/api/system.string)     | The name of the collection.                      |
| **documentName**   | [String](https://docs.microsoft.com/dotnet/api/system.string)     | The name of the document.                        |
| **query**          | [Single\[\]](https://docs.microsoft.com/dotnet/api/system.single) | The query vector.                                |
| **topN**           | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)       | The number of top similar documents to retrieve. |
| **minSimilarity**  | [Single](https://docs.microsoft.com/dotnet/api/system.single)     | The minimum similarity threshold.                |

**Returns:** [Task\<EmbeddedDocument>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an [EmbeddedDocument](/ai/components/api/embeddings/wisej.ai.embeddings.embeddeddocument.md) object.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the document is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) RemoveAsync(collectionName, filter)

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

| Parameter                                   | Type                                                                                     | Description                                                          |
| ------------------------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| **collectionName**                          | [String](https://docs.microsoft.com/dotnet/api/system.string)                            | The name of the collection.                                          |
| **filter** ![](/files/52BqKf9SltWQ97FbQSBF) | [Predicate\<EmbeddedDocument>](https://docs.microsoft.com/dotnet/api/system.predicate-1) | An optional filter predicate to apply to documents. Default is null. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task). A task that represents the asynchronous operation.

### ![](/files/ptrKjmmRoQB76pvrIqh0) RemoveAsync(collectionName, documentName)

Removes a specific document from the collection.

| Parameter          | Type                                                          | Description                 |
| ------------------ | ------------------------------------------------------------- | --------------------------- |
| **collectionName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the collection. |
| **documentName**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the document.   |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task). A task that represents the asynchronous operation.

### ![](/files/ptrKjmmRoQB76pvrIqh0) RetrieveAsync(collectionName, documentName, includeEmbedding)

Retrieves a specific document from the collection.

| Parameter            | Type                                                            | Description                                                           |
| -------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------- |
| **collectionName**   | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The name of the collection.                                           |
| **documentName**     | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The name of the document.                                             |
| **includeEmbedding** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether to include the embedding in the retrieved document. |

**Returns:** [Task\<EmbeddedDocument>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the [EmbeddedDocument](/ai/components/api/embeddings/wisej.ai.embeddings.embeddeddocument.md).

### ![](/files/ptrKjmmRoQB76pvrIqh0) RetrieveAsync(collectionName, includeEmbedding, filter)

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

| Parameter                                   | Type                                                                                     | Description                                                            |
| ------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| **collectionName**                          | [String](https://docs.microsoft.com/dotnet/api/system.string)                            | The name of the collection.                                            |
| **includeEmbedding**                        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                          | Indicates whether to include the embedding in the retrieved documents. |
| **filter** ![](/files/52BqKf9SltWQ97FbQSBF) | [Predicate\<EmbeddedDocument>](https://docs.microsoft.com/dotnet/api/system.predicate-1) | An optional filter predicate to apply to documents. Default is null.   |

**Returns:** [Task\<EmbeddedDocument\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [EmbeddedDocument](/ai/components/api/embeddings/wisej.ai.embeddings.embeddeddocument.md) objects.

### ![](/files/ptrKjmmRoQB76pvrIqh0) StoreAsync(collectionName, document)

Stores a document in the specified collection.

| Parameter          | Type                                                                                      | Description                 |
| ------------------ | ----------------------------------------------------------------------------------------- | --------------------------- |
| **collectionName** | [String](https://docs.microsoft.com/dotnet/api/system.string)                             | The name of the collection. |
| **document**       | [EmbeddedDocument](/ai/components/api/embeddings/wisej.ai.embeddings.embeddeddocument.md) | The document to store.      |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task). A task that represents the asynchronous operation.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the document is null.

## Implements

| Name                                                                                | Description                                                                                    |
| ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [IEmbeddingStorageService](/ai/components/api/services/iembeddingstorageservice.md) | Represents a service for storing and querying embedded documents within specified collections. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/services/iembeddingstorageservice/wisej.ai.services.qdrantembeddingstorageservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
