Skip to content

Module redlite.model.anthropic_model

Classes

AnthropicModel

class AnthropicModel(
    model='claude-3-opus-20240229',
    max_tokens: int = 1024,
    thinking: dict | anthropic.NotGiven = NOT_GIVEN,
    streaming=False,
    api_key: str | None = None,
    **args
)

Model that calls Anthropic Completion API.

  • model (str): Name of the Anthropic model. Default is "claude-3-opus-20240229"
  • max_tokens (int): maximum number of tokens
  • thinking (dict): optional config for thinking, for example {'type': 'enabled', 'budget_tokens': 2048}. Not all Anthropic models support thinking.
  • streaming: (bool): whether to use streaming Anthropic API. Default is False. You may need to enable streaming if thinking is enabled and thinking budget is large. Non-streaming Anthropic API does not support long thinking times.
  • api_key (str | None): Anthropic API key
  • args: Keyword arguments to be passed as-is to the Anthropic client. See https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/_client.py#L68

Ancestors (in MRO)

  • redlite._core.NamedModel