Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

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

Abi Raja9f732c4f5d57
diff --git a/backend/llm.py b/backend/llm.py
index 06374165..2b711024 100644
--- a/backend/llm.py
+++ b/backend/llm.py
@@ -88,7 +88,7 @@ async def stream_claude_response(
client = AsyncAnthropic(api_key=api_key)
# Base parameters
- max_tokens = 4096
+ max_tokens = 8192
temperature = 0.0
# Translate OpenAI messages to Claude messages
@@ -126,6 +126,7 @@ async def stream_claude_response(
temperature=temperature,
system=system_prompt,
messages=claude_messages, # type: ignore
+ extra_headers={"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"},
) as stream:
async for text in stream.text_stream:
await callback(text)
diff --git a/backend/run_evals.py b/backend/run_evals.py
index bbf355a5..ff5dc9fb 100644
--- a/backend/run_evals.py
+++ b/backend/run_evals.py
@@ -13,8 +13,8 @@ from evals.config import EVALS_DIR
from evals.core import generate_code_core
from evals.utils import image_to_data_url
-STACK = "ionic_tailwind"
-MODEL = Llm.GPT_4O_2024_05_13
+STACK = "html_tailwind"
+MODEL = Llm.CLAUDE_3_5_SONNET_2024_06_20
N = 1 # Number of outputs to generate