Class AzureOpenAiChatModel
java.lang.Object
io.quarkiverse.langchain4j.azure.openai.AzureOpenAiChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.ChatLanguageModel,dev.langchain4j.model.chat.TokenCountEstimator
public class AzureOpenAiChatModel
extends Object
implements dev.langchain4j.model.chat.ChatLanguageModel, dev.langchain4j.model.chat.TokenCountEstimator
Represents an OpenAI language model, hosted on Azure, that has a chat completion interface, such as gpt-3.5-turbo.
Mandatory parameters for initialization are: apiVersion, apiKey, and either endpoint OR
resourceName and deploymentName.
There are two primary authentication methods to access Azure OpenAI:
1. API Key Authentication: For this type of authentication, HTTP requests must include the API Key in the "api-key" HTTP header.
2. Azure Active Directory Authentication: For this type of authentication, HTTP requests must include the authentication/access token in the "Authorization" HTTP header.
Please note, that currently, only API Key authentication is supported by this class, second authentication option will be supported later.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAzureOpenAiChatModel(String endpoint, String apiVersion, String apiKey, dev.langchain4j.model.Tokenizer tokenizer, Double temperature, Double topP, Integer maxTokens, Double presencePenalty, Double frequencyPenalty, Duration timeout, Integer maxRetries, Proxy proxy, Boolean logRequests, Boolean logResponses) -
Method Summary
Modifier and TypeMethodDescriptionstatic AzureOpenAiChatModel.Builderbuilder()intestimateTokenCount(List<dev.langchain4j.data.message.ChatMessage> messages) dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage>dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage>generate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.agent.tool.ToolSpecification toolSpecification) dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage>generate(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.ChatLanguageModel
generate, generateMethods inherited from interface dev.langchain4j.model.chat.TokenCountEstimator
estimateTokenCount, estimateTokenCount, estimateTokenCount, estimateTokenCount
-
Constructor Details
-
AzureOpenAiChatModel
public AzureOpenAiChatModel(String endpoint, String apiVersion, String apiKey, dev.langchain4j.model.Tokenizer tokenizer, Double temperature, Double topP, Integer maxTokens, Double presencePenalty, Double frequencyPenalty, Duration timeout, Integer maxRetries, Proxy proxy, Boolean logRequests, Boolean logResponses)
-
-
Method Details
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> generate(List<dev.langchain4j.data.message.ChatMessage> messages) - Specified by:
generatein interfacedev.langchain4j.model.chat.ChatLanguageModel
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> generate(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications) - Specified by:
generatein interfacedev.langchain4j.model.chat.ChatLanguageModel
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> generate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.agent.tool.ToolSpecification toolSpecification) - Specified by:
generatein interfacedev.langchain4j.model.chat.ChatLanguageModel
-
estimateTokenCount
- Specified by:
estimateTokenCountin interfacedev.langchain4j.model.chat.TokenCountEstimator
-
builder
-