Skip to content

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

Python

support GPT4.1

Abi Raja446a5851f24a
diff --git a/backend/llm.py b/backend/llm.py
index 37ab40f7..b1976a68 100644
--- a/backend/llm.py
+++ b/backend/llm.py
@@ -22,6 +22,7 @@ class Llm(Enum):
GPT_4O_2024_05_13 = "gpt-4o-2024-05-13"
GPT_4O_2024_08_06 = "gpt-4o-2024-08-06"
GPT_4O_2024_11_20 = "gpt-4o-2024-11-20"
+ GPT_4_1_2025_04_14 = "gpt-4.1-2025-04-14"
CLAUDE_3_SONNET = "claude-3-sonnet-20240229"
CLAUDE_3_OPUS = "claude-3-opus-20240229"
CLAUDE_3_HAIKU = "claude-3-haiku-20240307"
@@ -70,6 +71,11 @@ async def stream_openai_response(
params["stream"] = True
# Add 'max_tokens' corresponding to the model
+ if model == Llm.GPT_4_1_2025_04_14:
+ params["temperature"] = 0
+ params["stream"] = True
+ params["max_tokens"] = 10000
+
if model == Llm.GPT_4O_2024_05_13:
params["max_tokens"] = 4096
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index 717accbf..35d548a4 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -295,6 +295,7 @@ async def stream_code(websocket: WebSocket):
or model == Llm.O1_2024_12_17
or model == Llm.O4_MINI_2025_04_16
or model == Llm.O3_2025_04_16
+ or model == Llm.GPT_4_1_2025_04_14
):
if openai_api_key is None:
await throw_error("OpenAI API key is missing.")