Qdrant Vector Store
The QdrantVector class provides vector search using Qdrant, a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage vectors with additional payload and extended filtering support.
Constructor Options
url:
apiKey:
https:
Methods
createIndex()
indexName:
dimension:
metric?:
upsert()
vectors:
metadata?:
ids?:
query()
indexName:
queryVector:
topK?:
filter?:
includeVector?:
listIndexes()
Returns an array of index names as strings.
describeIndex()
indexName:
Returns:
interface IndexStats {
dimension: number;
count: number;
metric: "cosine" | "euclidean" | "dotproduct";
}
deleteIndex()
indexName:
updateVector()
Update a single vector by ID or by metadata filter. Either id or filter must be provided, but not both.
indexName:
id?:
filter?:
update:
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated. If only one is provided, only that will be updated.
deleteVector()
indexName:
id:
Deletes a vector from the specified index by its ID.
deleteVectors()
Delete multiple vectors by IDs or by metadata filter. Either ids or filter must be provided, but not both.
indexName:
ids?:
filter?:
Response Types
Query results are returned in this format:
interface QueryResult {
id: string;
score: number;
metadata: Record<string, any>;
vector?: number[]; // Only included if includeVector is true
}
Error Handling
The store throws typed errors that can be caught:
try {
await store.query({
indexName: "index_name",
queryVector: queryVector,
});
} catch (error) {
if (error instanceof VectorStoreError) {
console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
console.log(error.details); // Additional error context
}
}