Skip to main content

Class: QdrantVectorStore

Qdrant vector store.

Implements

Constructors

constructor

new QdrantVectorStore(«destructured»): QdrantVectorStore

Creates a new QdrantVectorStore.

Parameters

NameType
«destructured»QdrantParams

Returns

QdrantVectorStore

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:53

Properties

batchSize

batchSize: number

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:39


collectionInitialized

Private collectionInitialized: boolean = false

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:43


collectionName

collectionName: string

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:40


db

Private db: QdrantClient

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:42


storesText

storesText: boolean = true

Implementation of

VectorStore.storesText

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:37

Methods

add

add(embeddingResults): Promise<string[]>

Adds the given nodes to the vector store.

Parameters

NameTypeDescription
embeddingResultsBaseNode<Metadata>[]List of nodes

Returns

Promise<string[]>

List of node IDs

Implementation of

VectorStore.add

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:180


buildPoints

buildPoints(nodes): Promise<{ ids: string[] ; points: PointStruct[] }>

Builds a list of points from the given nodes.

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

Promise<{ ids: string[] ; points: PointStruct[] }>

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:132


buildQueryFilter

buildQueryFilter(query): Promise<null | { must: ({ key: string = "doc_id"; match: { any: string[] = query.docIds; gt?: undefined = filter.value; lt?: undefined = filter.value; value?: undefined = filter.value } } | { key: never = filter.key; match: { any?: undefined = query.docIds; gt: string | number = filter.value; lt: string | number = filter.value; value?: undefined = filter.value } } | { key: string = filter.key; match: { any?: undefined = query.docIds; gt?: undefined = filter.value; lt?: undefined = filter.value; value: string | number = filter.value } })[] = mustConditions }>

Qdrant filter builder

Parameters

NameTypeDescription
queryVectorStoreQueryThe VectorStoreQuery to be used

Returns

Promise<null | { must: ({ key: string = "doc_id"; match: { any: string[] = query.docIds; gt?: undefined = filter.value; lt?: undefined = filter.value; value?: undefined = filter.value } } | { key: never = filter.key; match: { any?: undefined = query.docIds; gt: string | number = filter.value; lt: string | number = filter.value; value?: undefined = filter.value } } | { key: string = filter.key; match: { any?: undefined = query.docIds; gt?: undefined = filter.value; lt?: undefined = filter.value; value: string | number = filter.value } })[] = mustConditions }>

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:291


client

client(): QdrantClient

Returns the Qdrant client.

Returns

QdrantClient

Qdrant client

Implementation of

VectorStore.client

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:83


collectionExists

collectionExists(collectionName): Promise<boolean>

Checks if the collection exists in Qdrant and creates it if not.

Parameters

NameTypeDescription
collectionNamestringQdrant collection name

Returns

Promise<boolean>

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:106


createCollection

createCollection(collectionName, vectorSize): Promise<void>

Creates a collection in Qdrant.

Parameters

NameTypeDescription
collectionNamestringQdrant collection name
vectorSizenumberDimensionality of the vectors

Returns

Promise<void>

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:92


delete

delete(refDocId): Promise<void>

Deletes the given nodes from the vector store.

Parameters

NameTypeDescription
refDocIdstringNode ID

Returns

Promise<void>

Implementation of

VectorStore.delete

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:207


initializeCollection

initializeCollection(vectorSize): Promise<void>

Initializes the collection in Qdrant.

Parameters

NameTypeDescription
vectorSizenumberDimensionality of the vectors

Returns

Promise<void>

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:119


parseToQueryResult

parseToQueryResult(response): VectorStoreQueryResult

Converts the result of a query to a VectorStoreQueryResult.

Parameters

NameTypeDescription
responseQuerySearchResult[]Query response

Returns

VectorStoreQueryResult

VectorStoreQueryResult

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:229


query

query(query, options?): Promise<VectorStoreQueryResult>

Queries the vector store for the closest matching data to the query embeddings.

Parameters

NameTypeDescription
queryVectorStoreQueryThe VectorStoreQuery to be used
options?anyRequired by VectorStore interface. Currently ignored.

Returns

Promise<VectorStoreQueryResult>

Zero or more Document instances with data from the vector store.

Implementation of

VectorStore.query

Defined in

packages/core/src/storage/vectorStore/QdrantVectorStore.ts:260