Feature Request: Make Anthropic max_tokens configurable
Feature Request: Make Anthropic max_tokens configurable
Summary
Currently, the default max_tokens value for Anthropic in Goose is hardcoded to 8192.
However, Anthropic models now support up to 64k tokens, and there is no environment variable or configuration option to adjust this limit.
Request
Please add support for configuring the max_tokens value via an environment variable or configuration file, so users can take full advantage of the higher token limits supported by the Anthropic API.
Proposed Solution
- Introduce an environment variable (e.g.,
ANTHROPIC_MAX_TOKENS) or configuration setting to override the default.
Rationale
- Enables users to leverage larger contexts for complex workloads.
- Improves compatibility with the full capabilities of Anthropic’s API.
- Increases flexibility without breaking existing functionality.
Environment
- Goose version: 1.12
- API: Anthropic
- Current behavior:
max_tokensfixed at 8192 - Expected behavior: Configurable up to 64k
Additional Context
Anthropic documentation reference: https://docs.claude.com/en/docs/about-claude/models/overview
You can use a custom provider for this; just base it on the anthropic engine and you should be good to go
You can use a custom provider for this; just base it on the anthropic engine and you should be good to go
Thanks for the suggestion! I tried implementing it using a custom provider based on the Anthropic engine, but it looks like the default max_tokens value (8192) is still being applied. I also looked into the code even when using a custom provider for the Anthropic engine, an instance of AnthropicProvider is still being created internally, where the default value is set to 8192