anthropic_client#
Anthropic ModelClient integration.
Functions
|
When we only need the content of the first message. |
Classes
|
A component wrapper for the Anthropic API client. |
- class AnthropicAPIClient(api_key: str | None = None, chat_completion_parser: Callable[[Message], Any] = None)[source]#
Bases:
ModelClient
A component wrapper for the Anthropic API client.
Visit https://docs.anthropic.com/en/docs/intro-to-claude for more api details.
Ensure “max_tokens” are set.
Reference: 8/1/2024 - https://docs.anthropic.com/en/docs/about-claude/models
- parse_chat_completion(completion: Message) GeneratorOutput [source]#
Parse the chat completion to str.
- convert_inputs_to_api_kwargs(input: Any | None = None, model_kwargs: Dict = {}, model_type: ModelType = ModelType.UNDEFINED) dict [source]#
Anthropic API messages separates the system and the user messages.
As we focus on one prompt, we have to use the user message as the input.