Class WatsonxChatModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.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-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 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 TypeMethodDescriptionstatic WatsonxChatModel.Builderbuilder()Returns a newWatsonxChatModel.Builderinstance.dev.langchain4j.model.chat.request.ChatRequestParametersdev.langchain4j.model.chat.response.ChatResponsedoChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) 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.ChatModel
chat, 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 dev.langchain4j.model.chat.response.ChatResponse doChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) - Specified by:
doChatin interfacedev.langchain4j.model.chat.ChatModel
-
listeners
- Specified by:
listenersin interfacedev.langchain4j.model.chat.ChatModel
-
defaultRequestParameters
public dev.langchain4j.model.chat.request.ChatRequestParameters defaultRequestParameters()- Specified by:
defaultRequestParametersin interfacedev.langchain4j.model.chat.ChatModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
providerin interfacedev.langchain4j.model.chat.ChatModel
-
supportedCapabilities
- Specified by:
supportedCapabilitiesin interfacedev.langchain4j.model.chat.ChatModel
-
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.
-