Class AzureAiSearchContentRetriever

java.lang.Object
dev.langchain4j.store.embedding.azure.search.AbstractAzureAiSearchEmbeddingStore
dev.langchain4j.rag.content.retriever.azure.search.AzureAiSearchContentRetriever
All Implemented Interfaces:
ContentRetriever, EmbeddingStore<TextSegment>

public class AzureAiSearchContentRetriever extends AbstractAzureAiSearchEmbeddingStore implements ContentRetriever
Represents Azure AI Search Service as a ContentRetriever.
This class supports 4 AzureAiSearchQueryTypes:
- VECTOR: Uses the vector search algorithm to find the most similar TextSegments. More details can be found here.
- FULL_TEXT: Uses the full text search to find the most similar TextSegments. More details can be found here.
- HYBRID: Uses the hybrid search (vector + full text) to find the most similar TextSegments. More details can be found here.
- HYBRID_WITH_RERANKING: Uses the hybrid search (vector + full text) to find the most similar TextSegments, and uses the semantic re-ranker algorithm to rank the results. More details can be found here.
  • Constructor Details

    • AzureAiSearchContentRetriever

      public AzureAiSearchContentRetriever(String endpoint, com.azure.core.credential.AzureKeyCredential keyCredential, com.azure.core.credential.TokenCredential tokenCredential, boolean createOrUpdateIndex, int dimensions, com.azure.search.documents.indexes.models.SearchIndex index, String indexName, EmbeddingModel embeddingModel, int maxResults, double minScore, AzureAiSearchQueryType azureAiSearchQueryType, AzureAiSearchFilterMapper filterMapper, Filter filter)
  • Method Details

    • add

      public void add(String content)
      Add content to the full text search engine.
    • add

      public void add(Document document)
      Add Document to the full text search engine.
    • add

      public void add(TextSegment segment)
      Add TextSegment to the full text search engine.
    • add

      public void add(List<TextSegment> segments)
      Add a list of TextSegments to the full text search engine.
    • retrieve

      public List<Content> retrieve(Query query)
      Description copied from interface: ContentRetriever
      Retrieves relevant Contents using a given Query. The Contents are sorted by relevance, with the most relevant Contents appearing at the beginning of the returned List<Content>.
      Specified by:
      retrieve in interface ContentRetriever
      Parameters:
      query - The Query to use for retrieval.
      Returns:
      A list of retrieved Contents.
    • builder

      public static AzureAiSearchContentRetriever.Builder builder()