langchain.js
    Preparing search index...

    Azure AI Search vector store. To use this, you should have:

    • the @azure/search-documents NPM package installed
    • an endpoint and key to the Azure AI Search instance

    If you directly provide a SearchClient instance, you need to ensure that an index has been created. When using and endpoint and key, the index will be created automatically if it does not exist.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    • get lc_secrets(): { [key: string]: string }

      Returns { [key: string]: string }

    Methods

    • Returns string

    • Adds documents to the AzureAISearchVectorStore.

      Parameters

      Returns Promise<string[]>

      A promise that resolves to the ids of the added documents.

    • Adds vectors to the AzureAISearchVectorStore.

      Parameters

      • vectors: number[][]

        Vectors to be added.

      • documents: Document[]

        Corresponding documents to be added.

      • Optionaloptions: AzureAISearchAddDocumentsOptions

        Options for adding documents.

      Returns Promise<string[]>

      A promise that resolves to the ids of the added documents.

    • Protected

      Prepares the search index definition for Azure AI Search.

      Parameters

      • indexName: string

        The name of the index.

      Returns Promise<SearchIndex>

      The SearchIndex object.

    • Removes specified documents from the AzureAISearchVectorStore using IDs or a filter.

      Parameters

      • params: { filter?: AzureAISearchFilterType; ids?: string | string[] }

        Object that includes either an array of IDs or a filter for the data to be deleted.

      Returns Promise<void>

      A promise that resolves when the documents have been removed.

    • Protected

      Ensures that an index exists on the AzureAISearchVectorStore.

      Parameters

      • indexClient: SearchIndexClient

        The Azure AI Search index client.

      Returns Promise<void>

      A promise that resolves when the AzureAISearchVectorStore index has been initialized.

    • Performs a hybrid search using query text.

      Parameters

      • query: string

        Query text for the similarity search.

      • OptionalqueryVector: number[]

        Query vector for the similarity search. If not provided, the query text will be embedded.

      • k: number = 4
      • filter: undefined | AzureAISearchFilterType = undefined

        Optional filter options for the documents.

      Returns Promise<[Document, number][]>

      Promise that resolves to a list of documents and their corresponding similarity scores.

    • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

      Parameters

      • query: string

        Text to look up documents similar to.

      • options: MaxMarginalRelevanceSearchOptions<this["FilterType"]>
        • k

          Number of documents to return.

        • fetchK=20

          Number of documents to fetch before passing to the MMR algorithm.

        • lambda=0.5

          Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity.

      Returns Promise<Document[]>

      List of documents selected by maximal marginal relevance.

    • Performs a hybrid search with semantic reranker using query text.

      Parameters

      • query: string

        Query text for the similarity search.

      • OptionalqueryVector: number[]

        Query vector for the similarity search. If not provided, the query text will be embedded.

      • k: number = 4
      • filter: undefined | AzureAISearchFilterType = undefined

        Optional filter options for the documents.

      Returns Promise<[Document, number][]>

      Promise that resolves to a list of documents and their corresponding similarity scores.

    • Performs a similarity search using query type specified in configuration. If the query type is not specified, it defaults to similarity search.

      Parameters

      • query: string

        Query text for the similarity search.

      • k: number = 4
      • filter: undefined | AzureAISearchFilterType = undefined

        Optional filter options for the documents.

      Returns Promise<Document[]>

      Promise that resolves to a list of documents.

    • Performs a similarity search on the vectors stored in the collection.

      Parameters

      Returns Promise<[Document, number][]>

      Promise that resolves to a list of documents and their corresponding similarity scores.

    • Performs a similarity search using query type specified in configuration. If the query type is not specified, it defaults to similarity hybrid search.

      Parameters

      • query: string

        Query text for the similarity search.

      • k: number = 4
      • filter: undefined | AzureAISearchFilterType = undefined

        Optional filter options for the documents.

      Returns Promise<[Document, number][]>

      Promise that resolves to a list of documents and their corresponding similarity scores.

    • Static method to create an instance of AzureAISearchVectorStore from a list of documents. It first converts the documents to vectors and then adds them to the database.

      Parameters

      Returns Promise<AzureAISearchVectorStore>

      Promise that resolves to a new instance of AzureAISearchVectorStore.

    • Static method to create an instance of AzureAISearchVectorStore from a list of texts. It first converts the texts to vectors and then adds them to the collection.

      Parameters

      • texts: string[]

        List of texts to be converted to vectors.

      • metadatas: object | object[]

        Metadata for the texts.

      • embeddings: EmbeddingsInterface

        Embeddings to be used for conversion.

      • config: AzureAISearchConfig

        Database configuration for Azure AI Search.

      Returns Promise<AzureAISearchVectorStore>

      Promise that resolves to a new instance of AzureAISearchVectorStore.