langchain.js
    Preparing search index...

    Class for interacting with the Couchbase database using Query service for vector search. It extends the VectorStore class and provides methods for adding vectors and documents, and searching for similar vectors using SQL++ queries. Initiate the class using initialize() method.

    Hierarchy (View Summary)

    Index

    Properties

    FilterType: CouchbaseQueryVectorStoreFilter

    Methods

    • Returns string

    • Method to add documents to the vector store. It first converts the documents to vectors using the embeddings and then adds them to the vector store.

      Parameters

      • documents: Document[]

        Documents to be added to the vector store.

      • Optionaloptions: AddVectorOptions

        Optional parameters for adding documents.

      Returns Promise<string[]>

      • Promise that resolves to an array of document IDs.
    • Method to add vectors and documents to the vector store.

      Parameters

      • vectors: number[][]

        Vectors to be added to the vector store.

      • documents: Document[]

        Documents to be added to the vector store.

      • Optionaloptions: AddVectorOptions

        Optional parameters for adding vectors.

      Returns Promise<string[]>

      • Promise that resolves to an array of document IDs.
    • Create a new vector index for the Query vector store.

      Parameters

      • options: CreateIndexOptions

        Configuration options for creating the index

        Interface for create_index method parameters

        • OptionaldistanceMetric?: DistanceStrategy
        • Optionalfields?: string[]
        • indexDescription: string
        • OptionalindexName?: string
        • OptionalindexScanNprobes?: number
        • OptionalindexTrainlist?: number
        • indexType: IndexType
        • OptionalvectorDimension?: number
        • OptionalvectorField?: string
        • OptionalwhereClause?: string

      Returns Promise<void>

      If index creation fails or invalid parameters are provided

    • Method to delete documents from the vector store.

      Parameters

      • options: { ids: string[] }

      Returns Promise<void>

      • Promise that resolves when the deletion is complete.
    • Return documents that are most similar to the query.

      Parameters

      • query: string

        Query to look up for similar documents

      • k: number = 4

        The number of similar documents to return. Defaults to 4.

      • filter: CouchbaseQueryVectorStoreFilter = {}

        Optional search filter that are passed to Couchbase query. Defaults to empty object.

        • where: Optional WHERE clause conditions for the SQL++ query
        • fields: Optional list of fields to include in the results

      Returns Promise<Document[]>

      • Promise of list of documents that are most similar to the query.
    • Return documents that are most similar to the vector embedding.

      Parameters

      • queryEmbeddings: number[]

        Embedding to look up documents similar to.

      • k: number = 4

        The number of similar documents to return. Defaults to 4.

      • filter: CouchbaseQueryVectorStoreFilter = {}

        Optional search filter that are passed to Couchbase query. Defaults to empty object.

        • where: Optional WHERE clause conditions for the SQL++ query
        • fields: Optional list of fields to include in the results

      Returns Promise<Document[]>

      • A promise that resolves to an array of documents that match the similarity search.
    • Return documents that are most similar to the vector embedding using SQL++ query.

      Parameters

      • queryEmbeddings: number[]

        Embedding vector to look up documents similar to.

      • k: number = 4

        Number of documents to return. Defaults to 4.

      • filter: CouchbaseQueryVectorStoreFilter = {}

        Optional search filter that are passed to Couchbase query. Defaults to empty object.

        • where: Optional WHERE clause conditions for the SQL++ query
        • fields: Optional list of fields to include in the results

      Returns Promise<[Document, number][]>

      • Promise of list of [document, score] that are the most similar to the query vector.

      If the search operation fails.

    • Return documents that are most similar to the query with their scores.

      Parameters

      • query: string

        Query to look up for similar documents

      • k: number = 4

        The number of similar documents to return. Defaults to 4.

      • filter: CouchbaseQueryVectorStoreFilter = {}

        Optional search filter that are passed to Couchbase query. Defaults to empty object.

        • where: Optional WHERE clause conditions for the SQL++ query
        • fields: Optional list of fields to include in the results

      Returns Promise<[Document, number][]>

      • Promise of list of documents that are most similar to the query.
    • Static method to create a new CouchbaseQueryVectorStore from an array of documents. It first converts the documents to vectors using the embeddings and then creates a new vector store.

      Parameters

      • docs: Document[]

        Array of documents to be converted to vectors.

      • embeddings: EmbeddingsInterface

        Embeddings to be used for converting documents to vectors.

      • config: CouchbaseQueryVectorStoreArgs

        Configuration for the vector store.

      Returns Promise<CouchbaseQueryVectorStore>

      • Promise that resolves to a new CouchbaseQueryVectorStore instance.
    • Static method to create a new CouchbaseQueryVectorStore from an array of texts. It first converts the texts to vectors using the embeddings and then creates a new vector store.

      Parameters

      • texts: string[]

        Array of texts to be converted to vectors.

      • metadatas: object | object[]

        Array of metadata objects corresponding to the texts.

      • embeddings: EmbeddingsInterface

        Embeddings to be used for converting texts to vectors.

      • config: CouchbaseQueryVectorStoreArgs

        Configuration for the vector store.

      Returns Promise<CouchbaseQueryVectorStore>

      • Promise that resolves to a new CouchbaseQueryVectorStore instance.
    • initialize class for interacting with the Couchbase database using Query service. It extends the VectorStore class and provides methods for adding vectors and documents, and searching for similar vectors. This also verifies the params

      Parameters

      • embeddings: EmbeddingsInterface

        object to generate embedding

      • config: CouchbaseQueryVectorStoreArgs

        the fields required to initialize a vector store

      Returns Promise<CouchbaseQueryVectorStore>