Qdrant - Installation
Ragfish provides Qdrant integration through the @ragfish/qdrant package.
Qdrant acts as the vector store for storing and searching the embeddings generated from your knowledge. Ragfish also provides QdrantRetriever to connect Qdrant with the retrieval layer. The current Ragfish architecture uses both QdrantVectorStore and QdrantRetriever.
Prerequisites
Before using Qdrant with Ragfish, you need:
Node.js
A Ragfish project
A running Qdrant instance
The required Qdrant connection details
Qdrant can be deployed according to your application's infrastructure requirements.
Install the Ragfish Qdrant Package
Install the Qdrant integration:
npm install @ragfish/qdrant
Your application should also have the Ragfish Core package installed:
npm install @ragfish/core
If you are using OpenAI for embeddings and response generation:
npm install @ragfish/openai
A typical project therefore uses:
@ragfish/core @ragfish/openai @ragfish/qdrant
Qdrant Architecture
The Qdrant integration provides two important components:
@ragfish/qdrant │ ├── QdrantVectorStore └── QdrantRetriever
Basic Setup
Import the Qdrant components:
import {
QdrantVectorStore,
QdrantRetriever
} from "@ragfish/qdrant";
Create a vector store:
const store = new QdrantVectorStore({
// Qdrant configuration
});
Then create a retriever:
const retriever = new QdrantRetriever({
vectorStore: store,
collectionName: "knowledge"
});
The Ragfish master example follows this same pattern, creating a QdrantVectorStore and passing it to QdrantRetriever with a collection name.
Environment Variables
For production applications, keep Qdrant connection information outside your source code.
For example:
QDRANT_URL=your-qdrant-url QDRANT_API_KEY=your-qdrant-api-key
The exact configuration properties supported by QdrantVectorStore should be taken from the version of @ragfish/qdrant installed in your project.
Qdrant with OpenAI
A typical Ragfish RAG application can combine Qdrant with OpenAI:
OpenAIEmbedding
│
▼
QdrantVectorStore
│
▼
QdrantRetriever
│
▼
Chat
│
▼
OpenAILLM
The embedding model generates vectors, Qdrant stores and searches those vectors, the retriever returns relevant content, and the LLM generates the final response.
Complete Setup
A basic application structure looks like:
import { Settings, Chat } from "@ragfish/core";
import {
OpenAILLM,
OpenAIEmbedding
} from "@ragfish/openai";
import {
QdrantVectorStore,
QdrantRetriever
} from "@ragfish/qdrant";
Settings.llm = new OpenAILLM({
apiKey: process.env.OPENAI_API_KEY
});
Settings.embedModel = new OpenAIEmbedding({
apiKey: process.env.OPENAI_API_KEY
});
const store = new QdrantVectorStore({
// Qdrant configuration
});
const retriever = new QdrantRetriever({
vectorStore: store,
collectionName: "knowledge"
});
const chat = new Chat({
retriever
});
Verify the Installation
After installation, verify that the packages can be imported successfully:
import { Chat } from "@ragfish/core";
import {
OpenAILLM,
OpenAIEmbedding
} from "@ragfish/openai";
import {
QdrantVectorStore,
QdrantRetriever
} from "@ragfish/qdrant";
If these imports resolve successfully, the required Ragfish packages are available to your project.
Troubleshooting
Package Not Found
If the package cannot be resolved, verify that it is installed:
npm install @ragfish/qdrant
Qdrant Connection Failure
Check:
Qdrant URL
Authentication credentials
Network connectivity
Qdrant service availability
Collection Not Found
Make sure the collection configured in QdrantRetriever exists and contains the expected indexed knowledge.
For Example:
const retriever = new QdrantRetriever({
vectorStore: store,
collectionName: "knowledge"
});
The collection name must correspond to the knowledge collection you intend to search.