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

  • VectorStore
    • AzureAISearchVectorStore

Constructors

Properties

Methods

  • Adds vectors to the AzureAISearchVectorStore.

    Parameters

    • vectors: number[][]

      Vectors to be added.

    • documents: Document<Record<string, any>>[]

      Corresponding documents to be added.

    • Optional options: AzureAISearchAddDocumentsOptions

      Options for adding documents.

    Returns Promise<string[]>

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

  • 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.

  • Performs a hybrid search using query text.

    Parameters

    • query: string

      Query text for the similarity search.

    • Optional queryVector: 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<Record<string, any>>, 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<AzureAISearchFilterType>

    Returns Promise<Document<Record<string, any>>[]>

    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.

    • Optional queryVector: 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<Record<string, any>>, 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<Record<string, any>>[]>

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

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

    Parameters

    Returns Promise<[Document<Record<string, any>>, 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<Record<string, any>>, 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 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.

  • 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.

Generated using TypeDoc