Class AzureAiSearchContentRetriever.Builder

java.lang.Object
dev.langchain4j.rag.content.retriever.azure.search.AzureAiSearchContentRetriever.Builder
Enclosing class:
AzureAiSearchContentRetriever

public static class AzureAiSearchContentRetriever.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • endpoint

      public AzureAiSearchContentRetriever.Builder endpoint(String endpoint)
      Sets the Azure AI Search endpoint. This is a mandatory parameter.
      Parameters:
      endpoint - The Azure AI Search endpoint in the format: https://{resource}.search.windows.net
      Returns:
      builder
    • apiKey

      Sets the Azure AI Search API key.
      Parameters:
      apiKey - The Azure AI Search API key.
      Returns:
      builder
    • tokenCredential

      public AzureAiSearchContentRetriever.Builder tokenCredential(com.azure.core.credential.TokenCredential tokenCredential)
      Used to authenticate to Azure OpenAI with Azure Active Directory credentials.
      Parameters:
      tokenCredential - the credentials to authenticate with Azure Active Directory
      Returns:
      builder
    • createOrUpdateIndex

      public AzureAiSearchContentRetriever.Builder createOrUpdateIndex(boolean createOrUpdateIndex)
      Whether to create or update the search index.
      Parameters:
      createOrUpdateIndex - Whether to create or update the index.
      Returns:
      builder
    • dimensions

      public AzureAiSearchContentRetriever.Builder dimensions(int dimensions)
      If using the ready-made index, sets the number of dimensions of the embeddings. This parameter is exclusive of the index parameter.
      Parameters:
      dimensions - The number of dimensions of the embeddings.
      Returns:
      builder
    • index

      public AzureAiSearchContentRetriever.Builder index(com.azure.search.documents.indexes.models.SearchIndex index)
      If using a custom index, sets the index to be used. This parameter is exclusive of the dimensions parameter.
      Parameters:
      index - The index to be used.
      Returns:
      builder
    • indexName

      public AzureAiSearchContentRetriever.Builder indexName(String indexName)
      If no index is provided, set the name of the default index to be used.
      Parameters:
      indexName - The index name to be used.
      Returns:
      builder
    • embeddingModel

      public AzureAiSearchContentRetriever.Builder embeddingModel(EmbeddingModel embeddingModel)
      Sets the Embedding Model.
      Parameters:
      embeddingModel - The Embedding Model.
      Returns:
      builder
    • maxResults

      public AzureAiSearchContentRetriever.Builder maxResults(int maxResults)
      Sets the maximum number of Contents to retrieve.
      Parameters:
      maxResults - The maximum number of Contents to retrieve.
      Returns:
      builder
    • minScore

      public AzureAiSearchContentRetriever.Builder minScore(double minScore)
      Sets the minimum relevance score for the returned Contents. Contents scoring below #minScore are excluded from the results.
      Parameters:
      minScore - The minimum relevance score for the returned Contents.
      Returns:
      builder
    • queryType

      public AzureAiSearchContentRetriever.Builder queryType(AzureAiSearchQueryType azureAiSearchQueryType)
      Sets the Azure AI Search Query Type.
      Parameters:
      azureAiSearchQueryType - The Azure AI Search Query Type.
      Returns:
      builder
    • filter

      Sets the filter to be applied to the search query.
      Parameters:
      filter - The filter to be applied to the search query.
      Returns:
      builder
    • filterMapper

      Sets the filter mapper to be used to map Filter objects to Azure AI Search filter strings.
      Parameters:
      filterMapper - The filter mapper to be used to map Filter objects to Azure AI Search filter strings.
      Returns:
      builder
    • metadataFieldNames

      public AzureAiSearchContentRetriever.Builder metadataFieldNames(Collection<String> metadataFieldNames)
      Sets the names of top-level index fields to copy into the Metadata of each retrieved segment. Use this with a pre-existing (bring-your-own) index whose fields are stored at the document root rather than in the nested metadata field this store writes. A field is copied only if its value is a type Metadata supports (String, Integer, Long, Float, Double, or UUID); fields that are absent, null or of another type are skipped. Each field must be retrievable in the Azure index for its value to be returned. When a name matches a key already present in the nested metadata field, the top-level value takes precedence.
      Parameters:
      metadataFieldNames - The names of the index fields to expose as metadata; null is treated as no configured fields.
      Returns:
      builder
    • build