ClaudeProvider class final

Adaptateur pour l'API Messages d'Anthropic (Claude).

De la traduction pure entre nos types et le dialecte d'Anthropic, dans les deux sens. Particularités gérées ici :

  • system est un champ top-level séparé (pas un message) ;
  • pas de rôle tool : les résultats d'outils voyagent dans un message user via des blocs tool_result ;
  • vocabulaire propre : input_schema, bloc tool_use avec input ;
  • max_tokens est obligatoire.
Implemented types

Constructors

ClaudeProvider({required String apiKey, String model = 'claude-opus-4-8', int maxTokens = 1024, Client? httpClient})

Properties

apiKey String
final
hashCode int
The hash code for this object.
no setterinherited
maxTokens int
final
model String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
Libère le client HTTP interne. À appeler quand le provider n'est plus utilisé.
generate(List<Message> messages, {List<Tool> tools = const [], String? forceTool}) Future<LlmResponse>
Un aller-retour simple (chemin Future).
override
generateStream(List<Message> messages, {List<Tool> tools = const []}) Stream<LlmStreamEvent>
La version streamée : émet des LlmStreamEvent au fil de la réponse, et termine par un StreamDone portant la réponse assemblée.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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