| 70 | |
| 71 | |
| 72 | class AnthropicModelConfig(BaseModel): |
| 73 | model_name: str |
| 74 | """Anthropic model name, e.g. `claude-sonnet-4-5-20250929`. Overridden by `model_name_env` |
| 75 | if that names a set environment variable (so endpoint-specific model ids stay out of configs).""" |
| 76 | model_name_env: str | None = None |
| 77 | """Optional env var to read the model name from, overriding `model_name` when set.""" |
| 78 | model_kwargs: dict[str, Any] = {} |
| 79 | """Additional arguments passed to the API.""" |
| 80 | drop_none_model_kwargs: bool = True |
| 81 | """Drop all model_kwargs that are None. |
| 82 | This is so we can easily recursively merge this config with other configs targeting litellm. |
| 83 | """ |
| 84 | max_tokens: int = 16384 |
| 85 | """Maximum number of output tokens.""" |
| 86 | base_url: str | None = None |
| 87 | """Custom base URL for the Anthropic API (e.g. for proxies). Overridden by `base_url_env`.""" |
| 88 | base_url_env: str | None = None |
| 89 | """Optional env var to read the base URL from, overriding `base_url` when set (so endpoint |
| 90 | URLs stay out of configs).""" |
| 91 | api_key_env: str = "ANTHROPIC_API_KEY" |
| 92 | """Environment variable name for the API key.""" |
| 93 | cost: CostPerToken = CostPerToken() |
| 94 | """Per-token costs in USD for computing request cost from usage.""" |
| 95 | format_error_template: str = "{{ error }}" |
| 96 | """Template used when the LM's output is not in the expected format.""" |
| 97 | observation_template: str = ( |
| 98 | "{% if output.exception_info %}<exception>{{output.exception_info}}</exception>\n{% endif %}" |
| 99 | "<returncode>{{output.returncode}}</returncode>\n<output>\n{{output.output}}</output>" |
| 100 | ) |
| 101 | """Template used to render the observation after executing an action.""" |
| 102 | |
| 103 | |
| 104 | class AnthropicModel: |
nothing calls this directly
no test coverage detected