Class: VectorStore
helpers/services/vector-store.VectorStore
Table of contents
Accessors
Methods
Accessors
getInstance
• get
getInstance(): VectorStore
Returns the current instance of the VectorStore class.
Returns
The current VectorStore instance.
Throws
If the instance has not been initialized yet.
Defined in
src/electron/helpers/services/vector-store.ts:156 (opens in a new tab)
Methods
delete
▸ delete(collectionName
, id
): Promise
<{}>
Deletes all points related to a given entry id in the specified collection.
Parameters
Name | Type | Description |
---|---|---|
collectionName | string | The name of the collection to search in. |
id | string | The id in the payload. |
Returns
Promise
<{}>
A promise that resolves with the delete results.
Defined in
src/electron/helpers/services/vector-store.ts:290 (opens in a new tab)
deleteCollection
▸ deleteCollection(collectionName
): Promise
<undefined
| boolean
>
Deletes the specified collection from the Qdrant database.
Parameters
Name | Type | Description |
---|---|---|
collectionName | string | The name of the collection to be deleted. |
Returns
Promise
<undefined
| boolean
>
A promise that resolves when the collection has been deleted.
Defined in
src/electron/helpers/services/vector-store.ts:355 (opens in a new tab)
scroll
▸ scroll(collectionName
, options?
): Promise
<{}>
Scrolls for documents in the specified collection based on the given query.
Parameters
Name | Type | Description |
---|---|---|
collectionName | string | The name of the collection to search in. |
options? | Partial <{}> | Optional scroll parameters. |
Returns
Promise
<{}>
A promise that resolves with the search results.
Defined in
src/electron/helpers/services/vector-store.ts:274 (opens in a new tab)
search
▸ search(collectionName
, query
, options?
): Promise
<{}[]>
Searches for documents in the specified collection based on the given query. This method automatically ensures that the collection exists before performing the search.
Parameters
Name | Type | Description |
---|---|---|
collectionName | string | The name of the collection to search in. |
query | string | The text query to search for similar documents. |
options? | Partial <{}> | Optional search parameters. |
Returns
Promise
<{}[]>
A promise that resolves with the search results.
Defined in
src/electron/helpers/services/vector-store.ts:253 (opens in a new tab)
stop
▸ stop(): Promise
<void
>
Stops the Qdrant service if it is running.
Returns
Promise
<void
>
Defined in
src/electron/helpers/services/vector-store.ts:106 (opens in a new tab)
upsert
▸ upsert(collectionName
, documents
): Promise
<{}[]>
Inserts or updates documents in the specified collection. If a document ID is not provided, the method will attempt to find an existing document based on the payload 'id' and 'language'. If an existing document is not found, a new UUID will be generated.
Parameters
Name | Type | Description |
---|---|---|
collectionName | string | The name of the collection where documents will be upserted. |
documents | VectorStoreDocument [] | An array of documents to be upserted. |
Returns
Promise
<{}[]>
A promise that resolves when all upsert operations are completed.
Example
const document = {
content: "Live Painting is very nice",
payload: {
id: "live-painting:schema",
language: "en",
},
};
Example
const document = {
id: v4(),
content: "Live Painting is very nice",
payload: {
id: "live-painting:schema",
language: "en",
},
};
Defined in
src/electron/helpers/services/vector-store.ts:198 (opens in a new tab)
init
▸ init(options
): Promise
<VectorStore
>
Initializes the VectorStore service as a singleton instance. This method starts the service and initializes the client if not already initialized.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
options | Object | undefined | Configuration options for initializing VectorStore. |
options.embeddings | EmbeddingsInterface | undefined | The embeddings interface used by the VectorStore service. |
options.host? | string | "127.0.0.1" | The host address of the VectorStore server. |
options.port | number | 6333 | The port of the VectorStore server. |
Returns
Promise
<VectorStore
>
The singleton instance of the VectorStore class.
Throws
Throws an error if the service fails to start or the client cannot be initialized.
Defined in
src/electron/helpers/services/vector-store.ts:51 (opens in a new tab)