-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for long output on claude-3.5-sonnet
#11
Comments
OK, I've implemented it and it seems to work... but I haven't managed to test it properly with a prompt that gets it to output more than 4096 tokens (I'm not even sure how best to count those). You can test it right now by running: llm install https://github.com/simonw/llm-claude-3/archive/15f31a0717fba67b9bfdfbe8d1854e41d59cbd0f.zip Then prompting like this: llm -m claude-3.5-sonnet-long 'prompt goes here' |
I asked Alex for tips on testing it: https://twitter.com/simonw/status/1829605077205852657 |
Doesn't seem to work - I tried this: curl 'https://gist.githubusercontent.com/simonw/f9775727dcde2edc0f9f15bbda0b4d42/raw/8e34e1f3b86434565bba828464953c657ea6d92d/paste.txt' | \
llm -m claude-3.5-sonnet-long \
--system 'translate this document into french, then translate the french version into spanish, then translate the spanish version back to english' It stopped while it was still spitting out French. In the logged JSON in SQLite I found:
|
Oh here's why: max_tokens: Optional[int] = Field(
description="The maximum number of tokens to generate before stopping",
default=4_096,
) @field_validator("max_tokens")
@classmethod
def validate_max_tokens(cls, max_tokens):
if not (0 < max_tokens <= 4_096):
raise ValueError("max_tokens must be in range 1-4,096")
return max_tokens
|
Hah, I tried that again and this time it pretended it had done the translations...
|
This prompt is getting very silly:
|
OK, that fix did it! {"input_tokens": 4599, "output_tokens": 6162} |
Turns out you don’t need the header any more, Claude 3.5 Sonnet just has that new extended limit: https://twitter.com/alexalbert__/status/1825920737326281184
|
claude-3.5-sonnet-long
claude-3.5-sonnet
Pass
extra_headers=
for this.https://simonwillison.net/2024/Jul/15/alex-albert/
The text was updated successfully, but these errors were encountered: