AnthropicChat class
Anthropic Chat capability implementation
This module handles all chat-related functionality for Anthropic providers, including streaming, tool calling, and reasoning model support.
API Documentation:
- Messages API: https://docs.anthropic.com/en/api/messages
- Streaming: https://docs.anthropic.com/en/api/messages-streaming
- Tool Use: https://docs.anthropic.com/en/docs/tool-use
- Extended Thinking: https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
- Token Counting: https://docs.anthropic.com/en/api/messages-count-tokens
- Implemented types
Constructors
- AnthropicChat.new(AnthropicClient client, AnthropicConfig config)
Properties
- chatEndpoint → String
-
no setter
- client → AnthropicClient
-
final
- config → AnthropicConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
chat(
List< ChatMessage> messages) → Future<ChatResponse> -
Sends a chat request to the provider with a sequence of messages.
override
-
chatStream(
List< ChatMessage> messages, {List<Tool> ? tools}) → Stream<ChatStreamEvent> -
Stream chat responses with real-time events
override
-
chatWithTools(
List< ChatMessage> messages, List<Tool> ? tools) → Future<ChatResponse> -
Send a chat request with optional tool support
override
-
countTokens(
List< ChatMessage> messages, {List<Tool> ? tools}) → Future<int> - Count tokens in messages using Anthropic's token counting API
-
memoryContents(
) → Future< List< ChatMessage> ?> -
Get current memory contents if provider supports memory
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
summarizeHistory(
List< ChatMessage> messages) → Future<String> -
Summarizes a conversation history into a concise 2-3 sentence summary
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited