Package dev.langchain4j.model.openai
Class OpenAiStreamingChatModel
java.lang.Object
dev.langchain4j.model.openai.OpenAiStreamingChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.StreamingChatLanguageModel,dev.langchain4j.model.chat.TokenCountEstimator
public class OpenAiStreamingChatModel
extends Object
implements dev.langchain4j.model.chat.StreamingChatLanguageModel, dev.langchain4j.model.chat.TokenCountEstimator
Represents an OpenAI language model with a chat completion interface, such as gpt-3.5-turbo and gpt-4.
The model's response is streamed token by token and should be handled with
StreamingResponseHandler.
You can find description of parameters here.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voiddoChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest, dev.langchain4j.model.chat.response.StreamingChatResponseHandler handler) intestimateTokenCount(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.ModelProviderprovider()static OpenAiStreamingChatModelwithApiKey(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, waitMethods inherited from interface dev.langchain4j.model.chat.StreamingChatLanguageModel
chat, chat, chat, supportedCapabilitiesMethods inherited from interface dev.langchain4j.model.chat.TokenCountEstimator
estimateTokenCount, estimateTokenCount, estimateTokenCount, estimateTokenCount
-
Constructor Details
-
OpenAiStreamingChatModel
-
-
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:
defaultRequestParametersin interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
doChat
public void doChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest, dev.langchain4j.model.chat.response.StreamingChatResponseHandler handler) - Specified by:
doChatin interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
listeners
- Specified by:
listenersin interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
providerin interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
estimateTokenCount
- Specified by:
estimateTokenCountin 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