Qdrant
Qdrant is 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:
string
REST URL of the Qdrant instance. Eg. https://xyz-example.eu-central.aws.cloud.qdrant.io:6333
apiKey:
string
Optional Qdrant API key
https:
boolean
Whether to use TLS when setting up the connection. Recommended.
Methods
createIndex()
indexName:
string
Name of the index to create
dimension:
number
Vector dimension size
metric?:
'cosine' | 'euclidean' | 'dotproduct'
Distance metric for similarity search
upsert()
vectors:
number[][]
Array of embedding vectors
metadata?:
Record<string, any>[]
Metadata for each vector
namespace?:
string
Optional namespace for organization
query()
vector:
number[]
Query vector to find similar vectors
topK?:
number
Number of results to return
filter?:
Record<string, any>
Metadata filters for the query
listIndexes()
Returns an array of index names as strings.
describeIndex()
indexName:
string
Name of the index to describe
Returns:
interface IndexStats {
dimension: number;
count: number;
metric: "cosine" | "euclidean" | "dotproduct";
}
deleteIndex()
indexName:
string
Name of the index to delete
Response Types
Query results are returned in this format:
interface QueryResult {
id: string;
score: number;
metadata: Record<string, any>;
}
Error Handling
The store throws typed errors that can be caught:
try {
await store.query(queryVector);
} catch (error) {
if (error instanceof VectorStoreError) {
console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
console.log(error.details); // Additional error context
}
}