mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-10 13:37:55 -05:00
Expand the output context size when we use Sonnet
This commit is contained in:
@@ -15,6 +15,7 @@ log = get_logger(__name__)
|
||||
|
||||
# Maximum number of tokens supported by Anthropic Claude 3
|
||||
MAX_TOKENS = 4096
|
||||
MAX_TOKENS_SONNET = 8192
|
||||
|
||||
|
||||
class AnthropicClient(BaseLLMClient):
|
||||
@@ -72,6 +73,11 @@ class AnthropicClient(BaseLLMClient):
|
||||
"messages": messages,
|
||||
"temperature": self.config.temperature if temperature is None else temperature,
|
||||
}
|
||||
|
||||
if "sonnet" in self.config.model:
|
||||
completion_kwargs["extra_headers"] = {"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"}
|
||||
completion_kwargs["max_tokens"] = MAX_TOKENS_SONNET
|
||||
|
||||
if json_mode:
|
||||
completion_kwargs["response_format"] = {"type": "json_object"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user