Skip to content

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

Python

support more models

Abi Rajafcd853e58012
diff --git a/backend/evals/core.py b/backend/evals/core.py
index cd5a288a..a9dbe748 100644
--- a/backend/evals/core.py
+++ b/backend/evals/core.py
@@ -41,6 +41,8 @@ async def generate_code_core(
model == Llm.GEMINI_2_0_FLASH_EXP
or model == Llm.GEMINI_2_0_PRO_EXP
or model == Llm.GEMINI_2_0_FLASH
+ or model == Llm.GEMINI_2_5_FLASH_PREVIEW_04_17
+ or model == Llm.GEMINI_2_5_PRO_PREVIEW_05_06
):
if not GEMINI_API_KEY:
raise Exception("Gemini API key not found")
diff --git a/backend/llm.py b/backend/llm.py
index e98fab47..37ab40f7 100644
--- a/backend/llm.py
+++ b/backend/llm.py
@@ -31,7 +31,11 @@ class Llm(Enum):
GEMINI_2_0_FLASH_EXP = "gemini-2.0-flash-exp"
GEMINI_2_0_FLASH = "gemini-2.0-flash"
GEMINI_2_0_PRO_EXP = "gemini-2.0-pro-exp-02-05"
+ GEMINI_2_5_FLASH_PREVIEW_04_17 = "gemini-2.5-flash-preview-04-17"
+ GEMINI_2_5_PRO_PREVIEW_05_06 = "gemini-2.5-pro-preview-05-06"
O1_2024_12_17 = "o1-2024-12-17"
+ O4_MINI_2025_04_16 = "o4-mini-2025-04-16"
+ O3_2025_04_16 = "o3-2025-04-16"
class Completion(TypedDict):
@@ -57,7 +61,11 @@ async def stream_openai_response(
}
# O1 doesn't support streaming or temperature
- if model != Llm.O1_2024_12_17:
+ if (
+ model != Llm.O1_2024_12_17
+ and model != Llm.O4_MINI_2025_04_16
+ and model != Llm.O3_2025_04_16
+ ):
params["temperature"] = 0
params["stream"] = True
@@ -71,6 +79,11 @@ async def stream_openai_response(
if model == Llm.O1_2024_12_17:
params["max_completion_tokens"] = 20000
+ if model == Llm.O4_MINI_2025_04_16 or model == Llm.O3_2025_04_16:
+ params["max_completion_tokens"] = 20000
+ params["stream"] = True
+ params["reasoning_effort"] = "high"
+
# O1 doesn't support streaming
if model == Llm.O1_2024_12_17:
response = await client.chat.completions.create(**params) # type: ignore
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index fff4d329..717accbf 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -283,9 +283,19 @@ async def stream_code(websocket: WebSocket):
)
raise Exception("No OpenAI or Anthropic key")
+ # Print the variant models (one per line)
+ print("Variant models:")
+ for index, model in enumerate(variant_models):
+ print(f"Variant {index}: {model.value}")
+
tasks: List[Coroutine[Any, Any, Completion]] = []
for index, model in enumerate(variant_models):
- if model == Llm.GPT_4O_2024_11_20 or model == Llm.O1_2024_12_17:
+ if (
+ model == Llm.GPT_4O_2024_11_20
+ or model == Llm.O1_2024_12_17
+ or model == Llm.O4_MINI_2025_04_16
+ or model == Llm.O3_2025_04_16
+ ):
if openai_api_key is None:
await throw_error("OpenAI API key is missing.")
raise Exception("OpenAI API key is missing.")
@@ -303,6 +313,8 @@ async def stream_code(websocket: WebSocket):
model == Llm.GEMINI_2_0_PRO_EXP
or model == Llm.GEMINI_2_0_FLASH_EXP
or model == Llm.GEMINI_2_0_FLASH
+ or model == Llm.GEMINI_2_5_FLASH_PREVIEW_04_17
+ or model == Llm.GEMINI_2_5_PRO_PREVIEW_05_06
):
tasks.append(
stream_gemini_response(