Package dev.langchain4j.model.openai
Class OpenAiChatModel
java.lang.Object
dev.langchain4j.model.openai.OpenAiChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.ChatLanguageModel
,dev.langchain4j.model.chat.TokenCountEstimator
public class OpenAiChatModel
extends Object
implements dev.langchain4j.model.chat.ChatLanguageModel, dev.langchain4j.model.chat.TokenCountEstimator
Represents an OpenAI language model with a chat completion interface, such as gpt-3.5-turbo and gpt-4.
You can find description of parameters here.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
dev.langchain4j.model.chat.response.ChatResponse
doChat
(dev.langchain4j.model.chat.request.ChatRequest chatRequest) int
estimateTokenCount
(List<dev.langchain4j.data.message.ChatMessage> messages) List
<dev.langchain4j.model.chat.listener.ChatModelListener> Deprecated, for removal: This API element is subject to removal in a future version.dev.langchain4j.model.ModelProvider
provider()
Set
<dev.langchain4j.model.chat.Capability> static OpenAiChatModel
withApiKey
(String apiKey) Deprecated, for removal: This API element is subject to removal in a future version.Please usebuilder()
instead, and explicitly set the model name and, if necessary, other parameters.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.chat.ChatLanguageModel
chat, chat, chat, chat
Methods inherited from interface dev.langchain4j.model.chat.TokenCountEstimator
estimateTokenCount, estimateTokenCount, estimateTokenCount, estimateTokenCount
-
Constructor Details
-
OpenAiChatModel
-
-
Method Details
-
modelName
Deprecated, for removal: This API element is subject to removal in a future version.please usedefaultRequestParameters()
and thenChatRequestParameters.modelName()
instead -
defaultRequestParameters
- Specified by:
defaultRequestParameters
in interfacedev.langchain4j.model.chat.ChatLanguageModel
-
supportedCapabilities
- Specified by:
supportedCapabilities
in interfacedev.langchain4j.model.chat.ChatLanguageModel
-
doChat
public dev.langchain4j.model.chat.response.ChatResponse doChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) - Specified by:
doChat
in interfacedev.langchain4j.model.chat.ChatLanguageModel
-
listeners
- Specified by:
listeners
in interfacedev.langchain4j.model.chat.ChatLanguageModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
provider
in interfacedev.langchain4j.model.chat.ChatLanguageModel
-
estimateTokenCount
- Specified by:
estimateTokenCount
in interfacedev.langchain4j.model.chat.TokenCountEstimator
-
withApiKey
Deprecated, for removal: This API element is subject to removal in a future version.Please usebuilder()
instead, and explicitly set the model name and, if necessary, other parameters. The default values for the model name and temperature will be removed in future releases! -
builder
-
defaultRequestParameters()
and thenChatRequestParameters.modelName()
instead