Skip to content

Commit

Permalink
set claude default max_tokens to 4096
Browse files Browse the repository at this point in the history
  • Loading branch information
aisi-inspect committed Aug 6, 2024
1 parent 9dd71a2 commit e154912
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Log viewer: Ctrl/Cmd+F to find text when running in VS Code.
- Set Claude default `max_tokens` to 4096

## v0.3.20 (03 August 2024)

Expand Down
5 changes: 3 additions & 2 deletions src/inspect_ai/model/_providers/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)
from typing_extensions import override

from inspect_ai._util.constants import DEFAULT_MAX_RETRIES, DEFAULT_MAX_TOKENS
from inspect_ai._util.constants import DEFAULT_MAX_RETRIES
from inspect_ai._util.content import Content, ContentText
from inspect_ai._util.error import exception_message
from inspect_ai._util.images import image_as_data_uri
Expand Down Expand Up @@ -153,7 +153,8 @@ def completion_params(self, config: GenerateConfig) -> dict[str, Any]:
def max_tokens(self) -> int | None:
# anthropic requires you to explicitly specify max_tokens (most others
# set it to the maximum allowable output tokens for the model).
return DEFAULT_MAX_TOKENS
# set to 4096 which is the lowest documented max_tokens for claude models
return 4096

@override
def connection_key(self) -> str:
Expand Down

0 comments on commit e154912

Please sign in to comment.