Package dev.langchain4j.model.azure
Class AzureOpenAiChatModel.Builder
java.lang.Object
dev.langchain4j.model.azure.AzureOpenAiChatModel.Builder
- Enclosing class:
AzureOpenAiChatModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the Azure OpenAI API key.build()customHeaders(Map<String, String> customHeaders) dataSources(List<com.azure.ai.openai.models.AzureChatExtensionConfiguration> dataSources) deploymentName(String deploymentName) Sets the deployment name in Azure OpenAI.Sets the Azure OpenAI endpoint.enhancements(com.azure.ai.openai.models.AzureChatEnhancementConfiguration enhancements) frequencyPenalty(Double frequencyPenalty) logRequestsAndResponses(Boolean logRequestsAndResponses) maxRetries(Integer maxRetries) nonAzureApiKey(String nonAzureApiKey) Used to authenticate with the OpenAI service, instead of Azure OpenAI.openAIClient(com.azure.ai.openai.OpenAIClient openAIClient) Sets the Azure OpenAI client.presencePenalty(Double presencePenalty) proxyOptions(com.azure.core.http.ProxyOptions proxyOptions) responseFormat(com.azure.ai.openai.models.ChatCompletionsResponseFormat chatCompletionsResponseFormat) Deprecated, for removal: This API element is subject to removal in a future version.For JSON output, you can replace `.responseFormat(new ChatCompletionsJsonResponseFormat())` with a `JsonSchema` in the `ResponseFormat`.responseFormat(dev.langchain4j.model.chat.request.ResponseFormat responseFormat) serviceVersion(String serviceVersion) Sets the Azure OpenAI API service version.strictJsonSchema(Boolean strictJsonSchema) supportedCapabilities(Set<dev.langchain4j.model.chat.Capability> capabilities) temperature(Double temperature) tokenCredential(com.azure.core.credential.TokenCredential tokenCredential) Used to authenticate to Azure OpenAI with Azure Active Directory credentials.tokenizer(dev.langchain4j.model.Tokenizer tokenizer) userAgentSuffix(String userAgentSuffix)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
endpoint
Sets the Azure OpenAI endpoint. This is a mandatory parameter.- Parameters:
endpoint- The Azure OpenAI endpoint in the format: https://{resource}.openai.azure.com/- Returns:
- builder
-
serviceVersion
Sets the Azure OpenAI API service version. This is a mandatory parameter.- Parameters:
serviceVersion- The Azure OpenAI API service version in the format: 2023-05-15- Returns:
- builder
-
apiKey
Sets the Azure OpenAI API key.- Parameters:
apiKey- The Azure OpenAI API key.- Returns:
- builder
-
nonAzureApiKey
Used to authenticate with the OpenAI service, instead of Azure OpenAI. This automatically sets the endpoint to https://api.openai.com/v1.- Parameters:
nonAzureApiKey- The non-Azure OpenAI API key- Returns:
- builder
-
tokenCredential
public AzureOpenAiChatModel.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
-
deploymentName
Sets the deployment name in Azure OpenAI. This is a mandatory parameter.- Parameters:
deploymentName- The Deployment name.- Returns:
- builder
-
tokenizer
-
maxTokens
-
temperature
-
topP
-
logitBias
-
user
-
stop
-
presencePenalty
-
frequencyPenalty
-
dataSources
public AzureOpenAiChatModel.Builder dataSources(List<com.azure.ai.openai.models.AzureChatExtensionConfiguration> dataSources) -
enhancements
public AzureOpenAiChatModel.Builder enhancements(com.azure.ai.openai.models.AzureChatEnhancementConfiguration enhancements) -
seed
-
responseFormat
@Deprecated(forRemoval=true) public AzureOpenAiChatModel.Builder responseFormat(com.azure.ai.openai.models.ChatCompletionsResponseFormat chatCompletionsResponseFormat) Deprecated, for removal: This API element is subject to removal in a future version.For JSON output, you can replace `.responseFormat(new ChatCompletionsJsonResponseFormat())` with a `JsonSchema` in the `ResponseFormat`. You can then use `.strictJsonSchema(true)`to force JSON schema adherence. -
responseFormat
public AzureOpenAiChatModel.Builder responseFormat(dev.langchain4j.model.chat.request.ResponseFormat responseFormat) -
strictJsonSchema
-
timeout
-
maxRetries
-
proxyOptions
-
logRequestsAndResponses
-
userAgentSuffix
-
openAIClient
Sets the Azure OpenAI client. This is an optional parameter, if you need more flexibility than using the endpoint, serviceVersion, apiKey, deploymentName parameters.- Parameters:
openAIClient- The Azure OpenAI client.- Returns:
- builder
-
listeners
public AzureOpenAiChatModel.Builder listeners(List<dev.langchain4j.model.chat.listener.ChatModelListener> listeners) -
customHeaders
-
supportedCapabilities
public AzureOpenAiChatModel.Builder supportedCapabilities(Set<dev.langchain4j.model.chat.Capability> capabilities) -
build
-