Class SearchKnowledgeAgentClientBuilder
- All Implemented Interfaces:
com.azure.core.client.traits.AzureKeyCredentialTrait<SearchKnowledgeAgentClientBuilder>,com.azure.core.client.traits.ConfigurationTrait<SearchKnowledgeAgentClientBuilder>,com.azure.core.client.traits.EndpointTrait<SearchKnowledgeAgentClientBuilder>,com.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>,com.azure.core.client.traits.TokenCredentialTrait<SearchKnowledgeAgentClientBuilder>
SearchKnowledgeAgentClient
and SearchKnowledgeAgentAsyncClient for interacting with Azure AI Search Knowledge Agents.
Overview
This builder enables the creation of both synchronous and asynchronous clients for Azure AI Search Knowledge Agents, allowing you to interact with knowledge retrieval and agent-based search capabilities. The builder supports configuration of authentication, endpoint, agent name, API version, and HTTP pipeline options, following Azure SDK for Java standards.
Getting Started
To create a client, configure the required properties such as the service endpoint, agent name, API version, and authentication credentials. The builder supports both API key and Microsoft Entra ID (role-based) authentication. Additional options such as custom HTTP pipeline policies, retry options, logging, and serialization can also be configured.
Authentication
Azure AI Search Knowledge Agents support authentication using either an AzureKeyCredential (API key) or a
TokenCredential (Microsoft Entra ID). When using Microsoft Entra ID, you may also specify a SearchAudience
to target a specific Azure cloud environment.
Client Instantiation
Use buildClient() to create a synchronous SearchKnowledgeAgentClient, or buildAsyncClient() to create
an asynchronous SearchKnowledgeAgentAsyncClient. Each call to these methods returns a new client instance with the
configured options.
Thread Safety
Client instances created by this builder are thread-safe and intended to be shared and reused across threads. The builder itself is not thread-safe and should not be used concurrently from multiple threads.
Additional Information
- For more information about Azure AI Search Knowledge Agents, see the Azure documentation.
- For authentication details, see the Azure AI Search security documentation.
- For Azure SDK for Java guidelines, see the Azure SDK for Java Introduction.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy) Sets the agent name for the Azure AI Search agent.audience(SearchAudience audience) Sets the audience for the Azure AI Search instance.Builds an asynchronousSearchKnowledgeAgentAsyncClient.Builds a synchronousSearchKnowledgeAgentClient.clientOptions(com.azure.core.util.ClientOptions clientOptions) configuration(com.azure.core.util.Configuration configuration) credential(com.azure.core.credential.AzureKeyCredential credential) credential(com.azure.core.credential.TokenCredential credential) Sets the service endpoint for the Azure AI Search instance.httpClient(com.azure.core.http.HttpClient client) httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions) pipeline(com.azure.core.http.HttpPipeline httpPipeline) retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) serviceVersion(SearchServiceVersion apiVersion) Sets the API version to use for requests.
-
Constructor Details
-
SearchKnowledgeAgentClientBuilder
public SearchKnowledgeAgentClientBuilder()Creates a new builder instance.
-
-
Method Details
-
endpoint
Sets the service endpoint for the Azure AI Search instance.- Specified by:
endpointin interfacecom.azure.core.client.traits.EndpointTrait<SearchKnowledgeAgentClientBuilder>- Parameters:
endpoint- The URL of the Azure AI Search instance.- Returns:
- The updated builder object.
-
agentName
Sets the agent name for the Azure AI Search agent.- Parameters:
agentName- The name of the agent.- Returns:
- The updated builder object.
-
serviceVersion
Sets the API version to use for requests.- Parameters:
apiVersion- The API version.- Returns:
- The updated builder object.
-
credential
public SearchKnowledgeAgentClientBuilder credential(com.azure.core.credential.AzureKeyCredential credential) - Specified by:
credentialin interfacecom.azure.core.client.traits.AzureKeyCredentialTrait<SearchKnowledgeAgentClientBuilder>
-
credential
public SearchKnowledgeAgentClientBuilder credential(com.azure.core.credential.TokenCredential credential) - Specified by:
credentialin interfacecom.azure.core.client.traits.TokenCredentialTrait<SearchKnowledgeAgentClientBuilder>
-
audience
Sets the audience for the Azure AI Search instance.- Parameters:
audience- The audience to use.- Returns:
- The updated builder object.
-
httpLogOptions
public SearchKnowledgeAgentClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions) - Specified by:
httpLogOptionsin interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
clientOptions
public SearchKnowledgeAgentClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions) - Specified by:
clientOptionsin interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
addPolicy
public SearchKnowledgeAgentClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy) - Specified by:
addPolicyin interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
httpClient
- Specified by:
httpClientin interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
pipeline
- Specified by:
pipelinein interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
configuration
public SearchKnowledgeAgentClientBuilder configuration(com.azure.core.util.Configuration configuration) - Specified by:
configurationin interfacecom.azure.core.client.traits.ConfigurationTrait<SearchKnowledgeAgentClientBuilder>
-
retryOptions
public SearchKnowledgeAgentClientBuilder retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) - Specified by:
retryOptionsin interfacecom.azure.core.client.traits.HttpTrait<SearchKnowledgeAgentClientBuilder>
-
buildClient
Builds a synchronousSearchKnowledgeAgentClient.- Returns:
- a new
SearchKnowledgeAgentClientinstance.
-
buildAsyncClient
Builds an asynchronousSearchKnowledgeAgentAsyncClient.- Returns:
- a new
SearchKnowledgeAgentAsyncClientinstance.
-