Class WatsonxStreamingChatModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxStreamingChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.StreamingChatModel
public class WatsonxStreamingChatModel
extends Object
implements dev.langchain4j.model.chat.StreamingChatModel
A
StreamingChatModel implementation that integrates IBM watsonx.ai with LangChain4j.
Example usage:
StreamingChatModel chatModel = WatsonxStreamingChatModel.builder()
.url("https://...") // or use CloudRegion
.apiKey("...")
.projectId("...")
.modelName("ibm/granite-3-8b-instruct")
.maxOutputTokens(0)
.temperature(0.7)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingWatsonxStreamingChatModelinstances with configurable parameters. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.ibm.watsonx.ai.chat.ChatServiceprotected final dev.langchain4j.model.chat.request.ChatRequestParametersprotected final List<dev.langchain4j.model.chat.listener.ChatModelListener> protected final Set<dev.langchain4j.model.chat.Capability> protected final com.ibm.watsonx.ai.chat.model.ExtractionTagsprotected static final com.ibm.watsonx.ai.chat.model.ControlMessage -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns a newWatsonxStreamingChatModel.Builderinstance.dev.langchain4j.model.chat.request.ChatRequestParametersvoiddoChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest, dev.langchain4j.model.chat.response.StreamingChatResponseHandler handler) List<dev.langchain4j.model.chat.listener.ChatModelListener> dev.langchain4j.model.ModelProviderprovider()Set<dev.langchain4j.model.chat.Capability> Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.StreamingChatModel
chat, chat, chat
-
Field Details
-
THINKING
protected static final com.ibm.watsonx.ai.chat.model.ControlMessage THINKING -
chatService
protected final com.ibm.watsonx.ai.chat.ChatService chatService -
listeners
-
defaultRequestParameters
protected final dev.langchain4j.model.chat.request.ChatRequestParameters defaultRequestParameters -
supportedCapabilities
-
tags
protected final com.ibm.watsonx.ai.chat.model.ExtractionTags tags
-
-
Method Details
-
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.StreamingChatModel
-
listeners
- Specified by:
listenersin interfacedev.langchain4j.model.chat.StreamingChatModel
-
defaultRequestParameters
public dev.langchain4j.model.chat.request.ChatRequestParameters defaultRequestParameters()- Specified by:
defaultRequestParametersin interfacedev.langchain4j.model.chat.StreamingChatModel
-
supportedCapabilities
- Specified by:
supportedCapabilitiesin interfacedev.langchain4j.model.chat.StreamingChatModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
providerin interfacedev.langchain4j.model.chat.StreamingChatModel
-
builder
Returns a newWatsonxStreamingChatModel.Builderinstance.Example usage:
StreamingChatModel chatModel = WatsonxStreamingChatModel.builder() .url("https://...") // or use CloudRegion .apiKey("...") .projectId("...") .modelName("ibm/granite-3-8b-instruct") .maxOutputTokens(0) .temperature(0.7) .build();- Returns:
WatsonxStreamingChatModel.Builderinstance.
-