ClaudeProvider class

Implementation of LLM interface for Claude API

Implemented types
  • LlmInterface

Constructors

ClaudeProvider({required String apiKey, required String model, String? baseUrl, required LlmConfiguration config})

Properties

apiKey String
final
baseUrl String?
final
config LlmConfiguration
LLM configuration with retry settings
final
hashCode int
The hash code for this object.
no setterinherited
logger Logger
Logger for recording retry attempts
final
model String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportsPromptCaching bool
Whether this provider applies the CacheHints on a request. Providers that do not implement prompt caching return false and silently ignore hints. See mcp_llm package docs for the per- provider default policy when LlmRequest.cacheHints is null.
no setteroverride

Methods

close() Future<void>
Close and cleanup resources.
override
complete(LlmRequest request) Future<LlmResponse>
Complete a request using mcp_llm's internal types.
override
executeWithRetry<T>(Future<T> operation()) Future<T>
Concrete implementation of the executeWithRetry method from RetryableLlmProvider
extractToolCallFromMetadata(Map<String, dynamic> metadata) LlmToolCall?
Extracts a tool call from metadata if present.
override
getEmbeddings(String text) Future<List<double>>
Get embeddings for text.
override
hasToolCallMetadata(Map<String, dynamic> metadata) bool
Checks if a metadata map contains tool call information.
override
initialize(LlmConfiguration config) Future<void>
Initialize the LLM with configuration.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
standardizeMetadata(Map<String, dynamic> metadata) Map<String, dynamic>
Standardizes the provider-specific metadata to a common format. This can be used to ensure consistent metadata across different providers.
override
streamComplete(LlmRequest request) Stream<LlmResponseChunk>
In claude_provider.dart - improve tool handling in streaming response
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited