Class WatsonxChatModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxChatModel
- All Implemented Interfaces:
ChatModel
A
ChatModel implementation that integrates IBM watsonx.ai with LangChain4j.
Example usage:
ChatModel chatModel = WatsonxChatModel.builder()
.url("https://...") // or use CloudRegion
.apiKey("...")
.projectId("...")
.modelName("ibm/granite-3-3-8b-instruct")
.maxOutputTokens(0)
.temperature(0.7)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingWatsonxChatModelinstances with configurable parameters. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.ibm.watsonx.ai.chat.ChatServiceprotected final ChatRequestParametersprotected final List<ChatModelListener> protected final Set<Capability> -
Method Summary
Modifier and TypeMethodDescriptionstatic WatsonxChatModel.Builderbuilder()Returns a newWatsonxChatModel.Builderinstance.doChat(ChatRequest chatRequest) provider()
-
Field Details
-
chatService
protected final com.ibm.watsonx.ai.chat.ChatService chatService -
listeners
-
defaultRequestParameters
-
supportedCapabilities
-
-
Method Details
-
doChat
-
listeners
-
defaultRequestParameters
- Specified by:
defaultRequestParametersin interfaceChatModel
-
provider
-
supportedCapabilities
- Specified by:
supportedCapabilitiesin interfaceChatModel
-
builder
Returns a newWatsonxChatModel.Builderinstance.Example usage:
ChatModel chatModel = WatsonxChatModel.builder() .url("https://...") // or use CloudRegion .apiKey("...") .projectId("...") .modelName("ibm/granite-3-8b-instruct") .maxOutputTokens(0) .temperature(0.7) .build();- Returns:
WatsonxChatModel.Builderinstance.
-