update max tokens for Claude Sonnet 3.5 to newly supported limit (8192)

This commit is contained in:
Abi Raja 2024-07-15 18:51:22 -04:00
parent a2d6fda7fd
commit 9f732c4f5d
2 changed files with 4 additions and 3 deletions

View File

@ -88,7 +88,7 @@ async def stream_claude_response(
client = AsyncAnthropic(api_key=api_key) client = AsyncAnthropic(api_key=api_key)
# Base parameters # Base parameters
max_tokens = 4096 max_tokens = 8192
temperature = 0.0 temperature = 0.0
# Translate OpenAI messages to Claude messages # Translate OpenAI messages to Claude messages
@ -126,6 +126,7 @@ async def stream_claude_response(
temperature=temperature, temperature=temperature,
system=system_prompt, system=system_prompt,
messages=claude_messages, # type: ignore messages=claude_messages, # type: ignore
extra_headers={"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"},
) as stream: ) as stream:
async for text in stream.text_stream: async for text in stream.text_stream:
await callback(text) await callback(text)

View File

@ -13,8 +13,8 @@ from evals.config import EVALS_DIR
from evals.core import generate_code_core from evals.core import generate_code_core
from evals.utils import image_to_data_url from evals.utils import image_to_data_url
STACK = "ionic_tailwind" STACK = "html_tailwind"
MODEL = Llm.GPT_4O_2024_05_13 MODEL = Llm.CLAUDE_3_5_SONNET_2024_06_20
N = 1 # Number of outputs to generate N = 1 # Number of outputs to generate