Class WatsonxGatewayChatModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxGatewayChatModel
- All Implemented Interfaces:
ChatModel
A
ChatModel implementation that integrates the IBM watsonx.ai Model Gateway with LangChain4j.
Example usage:
ChatModel chatModel = WatsonxGatewayChatModel.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 constructingWatsonxGatewayChatModelinstances with configurable parameters. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChatRequestParametersprotected final List<ChatModelListener> protected final com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatServiceprotected 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 newWatsonxGatewayChatModel.Builderinstance.protected com.ibm.watsonx.ai.chat.ChatProvider<com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatRequest, com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatResponse> doChat(ChatRequest chatRequest) protected final ChatResponseexecuteChat(ChatRequest chatRequest) protected final voidexecuteChatStreaming(ChatRequest chatRequest, StreamingChatResponseHandler handler) provider()
-
Field Details
-
modelGatewayChatService
protected final com.ibm.watsonx.ai.gateway.chat.ModelGatewayChatService modelGatewayChatService -
listeners
-
defaultRequestParameters
-
supportedCapabilities
-
strictJsonSchema
protected final boolean strictJsonSchema
-
-
Method Details
-
doChat
-
builder
Returns a newWatsonxGatewayChatModel.Builderinstance.Example usage:
ChatModel chatModel = WatsonxGatewayChatModel.builder() .baseUrl("https://...") // or use CloudRegion .apiKey("...") .modelName("gpt-4o") .maxOutputTokens(0) .temperature(0.7) .build();- Returns:
WatsonxGatewayChatModel.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)
-