[Request] Support for 8192 Output Tokens for Anthropic API
🥰 Feature Description
Hello,
I noticed that the current implementation of the Anthropic API client doesn’t support the 8192 output tokens feature. According to the Anthropic documentation, this feature is in beta and requires the header anthropic-beta: max-tokens-3-5-sonnet-2024-07-15. If this header isn’t specified, the limit defaults to 4096 tokens.
🧐 Proposed Solution
To address this, I’ve made a local change that allows the use of 8192 tokens. The update involves modifying the Anthropic client initialization to include the required header.
Changes Made:
In the file src/libs/agent-runtime/anthropic/index.ts, I modified the client initialization as follows:
this.client = new Anthropic({
apiKey,
baseURL,
defaultHeaders: { "anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15" },
});
This change sets the defaultHeaders property to include the necessary beta header, which enables the extended output token limit.
📝 Additional Information
To ensure that users are aware of the beta status of the extended output token limit, it would be helpful to include a disclaimer such as:
Claude 3.5 Sonnet supports max tokens up to 8192 with a beta header. More Info
👀 @pixelbreeze38
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
Maybe you should just submit a PR :)
@pixelbreeze38 PR welcome~
✅ @pixelbreeze38
This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。
:tada: This issue has been resolved in version 1.15.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.