Class WatsonxGatewayStreamingChatModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxGatewayStreamingChatModel
- All Implemented Interfaces:
StreamingChatModel
A
StreamingChatModel implementation that integrates the IBM watsonx.ai Model Gateway with LangChain4j.
Example usage:
StreamingChatModel chatModel = WatsonxGatewayStreamingChatModel.builder()
.baseUrl("https://...") // or use CloudRegion
.apiKey("...")
.modelName("gpt-4o")
.maxOutputTokens(0)
.temperature(0.7)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingWatsonxGatewayStreamingChatModelinstances with configurable parameters. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChatRequestParametersprotected final List<ChatModelListener> protected final com.ibm.watsonx.ai.gateway.chat.ModelGatewayServiceprotected final booleanprotected final Set<Capability> -
Method Summary
Modifier and TypeMethodDescriptionprotected static final voidapplyCommonParameters(DefaultChatRequestParameters.Builder<?> target, dev.langchain4j.model.watsonx.WatsonxChatBase.Builder<?> builder) protected com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatRequestbuildChatRequest(List<com.ibm.watsonx.ai.chat.model.ChatMessage> messages, List<com.ibm.watsonx.ai.chat.model.Tool> tools, ChatRequestParameters parameters) builder()Returns a newWatsonxGatewayStreamingChatModel.Builderinstance.protected com.ibm.watsonx.ai.chat.ChatProvider<com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatRequest, com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatResponse> voiddoChat(ChatRequest chatRequest, StreamingChatResponseHandler handler) protected final ChatResponseexecuteChat(ChatRequest chatRequest) protected final voidexecuteChatStreaming(ChatRequest chatRequest, StreamingChatResponseHandler handler) provider()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StreamingChatModel
chat, chat, chat, chat, defaultRequestParameters, listeners, provider, supportedCapabilities
-
Field Details
-
modelGatewayService
protected final com.ibm.watsonx.ai.gateway.chat.ModelGatewayService modelGatewayService -
listeners
-
defaultRequestParameters
-
supportedCapabilities
-
strictJsonSchema
protected final boolean strictJsonSchema
-
-
Method Details
-
doChat
- Specified by:
doChatin interfaceStreamingChatModel
-
builder
Returns a newWatsonxGatewayStreamingChatModel.Builderinstance.Example usage:
StreamingChatModel chatModel = WatsonxGatewayStreamingChatModel.builder() .baseUrl("https://...") // or use CloudRegion .apiKey("...") .modelName("gpt-4o") .maxOutputTokens(0) .temperature(0.7) .build();- Returns:
WatsonxGatewayStreamingChatModel.Builderinstance.
-
chatProvider
protected com.ibm.watsonx.ai.chat.ChatProvider<com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatRequest, com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatResponse> chatProvider() -
buildChatRequest
protected com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatRequest buildChatRequest(List<com.ibm.watsonx.ai.chat.model.ChatMessage> messages, List<com.ibm.watsonx.ai.chat.model.Tool> tools, ChatRequestParameters parameters) -
listeners
-
defaultRequestParameters
-
supportedCapabilities
-
provider
-
executeChat
-
executeChatStreaming
protected final void executeChatStreaming(ChatRequest chatRequest, StreamingChatResponseHandler handler) -
applyCommonParameters
protected static final void applyCommonParameters(DefaultChatRequestParameters.Builder<?> target, dev.langchain4j.model.watsonx.WatsonxChatBase.Builder<?> builder)
-