Type declaration for filter type
Name of the database to use
Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
Whether the metadata is contained in a single column or multiple columns
Name of the main table to store vectors and documents
Adds vectors to the vector store.
The vectors to add.
The documents associated with the vectors.
A promise that resolves with the IDs of the added vectors when the vectors have been added.
Creates a VectorStoreRetriever
instance with flexible configuration options.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<AzionVectorStore>>If a number is provided, it sets the k
parameter (number of items to retrieve).
Optional
filter: AzionFilter[]Optional filter criteria to limit the items retrieved based on the specified filter type.
Optional
callbacks: CallbacksOptional callbacks that may be triggered at specific stages of the retrieval process.
Optional
tags: string[]Tags to categorize or label the VectorStoreRetriever
. Defaults to an empty array if not provided.
Optional
metadata: Record<string, unknown>Additional metadata as key-value pairs to add contextual information for the retrieval process.
Optional
verbose: booleanIf true
, enables detailed logging for the retrieval process. Defaults to false
.
VectorStoreRetriever
instance based on the provided parameters.Performs a full-text search on the vector store and returns the top 'k' similar documents.
The query string to search for
The options for the full-text search, including: - kfts: The number of full-text search results to return - filter: Optional filters to apply to narrow down the search results - metadataItems: Optional metadata fields to include in the results
A promise that resolves with the full-text search results when the search is complete.
Performs a hybrid search on the vector store and returns the top 'k' similar documents.
The query string to search for
A promise that resolves with the hybrid search results when the search is complete.
Performs a similarity search on the vector store and returns the top 'k' similar documents.
The query string.
The options for the similarity search, including: - kvector: The number of vector search results to return - filter: Optional filters to apply to the search - metadataItems: Optional metadata fields to include in results
A promise that resolves with the similarity search results when the search is complete.
Protected
convert2FTSQueryOptional
maxReturn documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.
Text to look up documents similar to.
Sets up the database and tables.
The setup options:
A promise that resolves when the database and tables have been set up.
Searches for documents similar to a text query by embedding the query and performing a similarity search on the resulting vector.
Text query for finding similar documents.
Optional
k: numberNumber of similar results to return. Defaults to 4.
Optional
filter: AzionFilter[]Optional filter based on FilterType
.
Optional
_callbacks: CallbacksOptional callbacks for monitoring search progress
A promise resolving to an array of DocumentInterface
instances representing similar documents.
Performs a similarity search on the vector store and returns the top 'similarityK' similar documents.
The vector to search for.
The number of documents to return.
Optional
filter: AzionFilter[]Optional filters to apply to the search.
Optional
metadataItems: string[]Optional metadata items to include in the search.
A promise that resolves with the similarity search results when the search is complete.
Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.
Text query for finding similar documents.
Optional
k: numberNumber of similar results to return. Defaults to 4.
Optional
filter: AzionFilter[]Optional filter based on FilterType
.
Optional
_callbacks: CallbacksOptional callbacks for monitoring search progress
A promise resolving to an array of tuples, each containing a document and its similarity score.
Static
fromCreates a VectorStore
instance from an array of documents, using the specified
embeddings and database configuration.
Subclasses must implement this method to define how documents are embedded and stored. Throws an error if not overridden.
Array of DocumentInterface
instances representing the documents to be stored.
Instance of EmbeddingsInterface
to embed the documents.
Database configuration settings.
A promise that resolves to a new VectorStore
instance.
Static
fromCreates a VectorStore
instance from an array of text strings and optional
metadata, using the specified embeddings and database configuration.
Subclasses must implement this method to define how text and metadata are embedded and stored in the vector store. Throws an error if not overridden.
Array of strings representing the text documents to be stored.
Metadata for the texts, either as an array (one for each text) or a single object (applied to all texts).
Instance of EmbeddingsInterface
to embed the texts.
Database configuration settings.
A promise that resolves to a new VectorStore
instance.
Static
initializeCreates a new vector store instance and sets up the database.
The embeddings interface to use for vectorizing documents
Configuration options:
Database setup options:
A promise that resolves with the configured vector store instance
Example usage: