Class AnthropicChatModel
java.lang.Object
dev.langchain4j.model.anthropic.AnthropicChatModel
- All Implemented Interfaces:
ChatModel
Represents an Anthropic language model with a Messages (chat) API.
More details are available here.
It supports tools. See more information here.
It supports
The content of
Supports caching
More details are available here.
It supports tools. See more information here.
It supports
Images as inputs. UserMessages can contain one or multiple ImageContents.
Images must not be represented as URLs; they should be Base64-encoded strings and include a mimeType.
The content of
SystemMessages is sent using the "system" parameter.
Supports caching
SystemMessages and ToolSpecifications.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()doChat(ChatRequest chatRequest) doChatAsync(ChatRequest chatRequest) SPI hook for a genuinely non-blocking chat implementation, invoked byChatModel.chatAsync(ChatRequest).provider()
-
Field Details
-
ANTHROPIC_VERSION
- See Also:
-
-
Constructor Details
-
AnthropicChatModel
-
-
Method Details
-
builder
-
doChat
-
doChatAsync
Description copied from interface:ChatModelSPI hook for a genuinely non-blocking chat implementation, invoked byChatModel.chatAsync(ChatRequest).The default returns a failed future carrying
AsyncNotSupportedExceptionto signal that this model has no native asynchronous implementation. Callers on the asynchronous and reactive path (for example the non-blocking RAG stages) detect this and either offload the blockingChatModel.doChat(ChatRequest)or fail loudly with an actionable message. A model backed by remote HTTP I/O overrides this with a genuinely asynchronous call (no thread parked).- Specified by:
doChatAsyncin interfaceChatModel- Parameters:
chatRequest- aChatRequest, containing all the inputs to the LLM- Returns:
- a
CompletableFutureof theChatResponse
-
listeners
-
provider
-
defaultRequestParameters
- Specified by:
defaultRequestParametersin interfaceChatModel
-
supportedCapabilities
- Specified by:
supportedCapabilitiesin interfaceChatModel
-