Qdrant
The Qdrant component lets you store documents in a Qdrant vector database, find similar documents, or create a retriever that can be used by other parts of your workflow. It works with embeddings that turn text into vectors, so the component can compare documents based on their meaning.
How it Works
When you use the Qdrant component, it talks to a Qdrant server that you specify with a URL (and optionally a port, prefix, or timeout).
- Add – The component takes the documents you feed into it, turns them into vectors with the chosen embedding, and writes them to the specified collection in Qdrant.
- Search – The component sends a text query to Qdrant, asks for the most similar vectors, and returns the matching documents.
- Retriever – The component builds a retriever object that can be passed to other components (for example, an LLM) so that the LLM can ask Qdrant for relevant documents on the fly.
All communication with Qdrant is done over HTTPS if the URL starts with https://
. The component also lets you choose how similar documents are measured (Cosine, Euclidean, or Dot Product).
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Add: Store new documents in the Qdrant collection.
- Search: Find documents that are most similar to a search query.
- Retriever: Create a retriever object that can be used by other components to fetch relevant documents.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Credential: Choose the Qdrant API credential you have set up in Nappai’s credentials section.
The Qdrant API credential must contain a Qdrant API Key.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Embedding: The embedding model that turns text into vectors.
- Visible in: Add, Search, Retriever
-
Ingest Data: The documents you want to add to the collection.
- Visible in: Add
-
Operation: Select which operation (Add, Search, or Retriever) the component should perform.
- Visible in: Add, Search, Retriever
-
Collection Name: The name of the Qdrant collection where documents will be stored or searched.
- Visible in: Add, Search, Retriever
-
Content Payload Key: The key in the Qdrant payload that holds the document text. Default is
page_content
.- Visible in: Add, Search, Retriever
-
Distance Function: How similarity is measured. Options are Cosine, Euclidean, or Dot Product. Default is Cosine.
- Visible in: Add, Search, Retriever
-
Metadata Payload Key: The key in the Qdrant payload that holds document metadata. Default is
metadata
.- Visible in: Add, Search, Retriever
-
Number of Results: How many documents to return when searching. Default is 4.
- Visible in: Add, Search, Retriever
-
Port: The port number of the Qdrant server. Default is 6333.
- Visible in: Add, Search, Retriever
-
Prefix: A string that is added before the collection name. Useful for multi‑tenant setups.
- Visible in: Add, Search, Retriever
-
Search Query: The text you want to search for. Leave empty to retrieve all documents.
- Visible in: Search
-
Timeout: Maximum time (in seconds) to wait for a response from Qdrant.
- Visible in: Add, Search, Retriever
-
URL: The full URL of the Qdrant server (e.g.,
https://my-qdrant-instance.com
).- Visible in: Add, Search, Retriever
Outputs
- Retriever: A retriever object that can be passed to other components (e.g., an LLM) to fetch relevant documents.
- Results: A list of documents returned by a search operation.
- Vector Store: The underlying Qdrant vector store object, useful if you need to perform advanced operations later.
Usage Example
Adding Documents
- Operation: Add
- Embedding: Select an embedding model (e.g., OpenAI embeddings).
- Ingest Data: Drag in a “Read File” component that outputs text documents.
- Collection Name:
my_collection
- URL:
https://my-qdrant-instance.com
- Credential: Choose the Qdrant API credential you created.
- Click Run. The component will store the documents in Qdrant.
Searching for Similar Documents
- Operation: Search
- Embedding: Same embedding model used for adding.
- Search Query:
Explain how to set up a CI/CD pipeline.
- Number of Results: 5
- Collection Name:
my_collection
- URL:
https://my-qdrant-instance.com
- Credential: Same Qdrant API credential.
- Click Run. The component returns the top 5 most similar documents.
Building a Retriever for an LLM
- Operation: Retriever
- Embedding: Same embedding model.
- Collection Name:
my_collection
- URL:
https://my-qdrant-instance.com
- Credential: Same Qdrant API credential.
- Connect the Retriever output to an LLM component’s “Retriever” input.
- The LLM can now ask Qdrant for relevant documents during generation.
Related Components
- Embedding – Generates the vectors that the Qdrant component uses.
- Read File – Reads documents that can be ingested into Qdrant.
- LLM – Uses the retriever output to provide context for language model responses.
Tips and Best Practices
- Use the same embedding model for adding and searching to ensure consistent vector space.
- Keep the collection name short and consistent across operations.
- Set a reasonable timeout if your Qdrant instance is in a slow network environment.
- Use the “Prefix” field if you need to isolate data for different users or projects.
- Monitor Qdrant logs for any indexing or query errors that might affect search quality.
Security Considerations
- Store the Qdrant API Key in Nappai’s credential store; never hard‑code it in the workflow.
- Ensure the Qdrant URL uses HTTPS to protect data in transit.
- If you expose the Qdrant endpoint publicly, consider adding authentication or IP whitelisting to prevent unauthorized access.