Azure Cognitive Search
) is a Microsoft cloud search service that gives developers infrastructure, APIs, and tools for information retrieval of vector, keyword, and hybrid queries at scale.
AzureAISearchRetriever
is an integration module that returns documents from an unstructured query. It’s based on the BaseRetriever class and it targets the 2023-11-01 stable REST API version of Azure AI Search, which means it supports vector indexing and queries.
This guide will help you get started with the Azure AI Search retriever. For detailed documentation of all AzureAISearchRetriever
features and configurations head to the API reference.
AzureAISearchRetriever
replaces AzureCognitiveSearchRetriever
, which will soon be deprecated. We recommend switching to the newer version that’s based on the most recent stable version of the search APIs.
AzureAISearchRetriever
). The search index provides the searchable content.
With an API Key
langchain-community
package. We will need some additional dependencies as well:
AzureAISearchRetriever
, provide an index_name
, content_key
, and top_k
set to the number of number of results you’d like to retrieve. Setting top_k
to zero (the default) returns all results.
langchain-vector-demo
. This will create a new vector store associated with that index name.
state_of_the_union.txt
file. We’ll split the text in 400 token chunks with no overlap. Finally, the documents are added to our vector store as emeddings.
index_name
variable is langchain-vector-demo
from the last step. If you skipped vector store creation, provide your index name in the parameter. In this query, the top result is returned.
AzureAISearchRetriever
features and configurations head to the API reference.