Update core_creator/app_blueprint.py
Browse files
core_creator/app_blueprint.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
# app_blueprint.py - Translates a robotics idea and intent into an app design blueprint
|
2 |
|
|
|
|
|
3 |
from openai import OpenAI
|
4 |
|
|
|
|
|
|
|
5 |
def generate_app_blueprint(idea: str, intent: str) -> dict:
|
6 |
system_prompt = f"""
|
7 |
You are a robotics app designer.
|
@@ -22,7 +27,7 @@ def generate_app_blueprint(idea: str, intent: str) -> dict:
|
|
22 |
Blueprint:
|
23 |
"""
|
24 |
|
25 |
-
response =
|
26 |
model="gpt-4o",
|
27 |
messages=[
|
28 |
{"role": "system", "content": "You are a robotics UX planner."},
|
@@ -31,7 +36,6 @@ def generate_app_blueprint(idea: str, intent: str) -> dict:
|
|
31 |
temperature=0.7
|
32 |
)
|
33 |
|
34 |
-
import json
|
35 |
try:
|
36 |
blueprint = json.loads(response.choices[0].message.content.strip())
|
37 |
return blueprint
|
|
|
1 |
# app_blueprint.py - Translates a robotics idea and intent into an app design blueprint
|
2 |
|
3 |
+
import os
|
4 |
+
import json
|
5 |
from openai import OpenAI
|
6 |
|
7 |
+
# Initialize OpenAI client using environment variable
|
8 |
+
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
9 |
+
|
10 |
def generate_app_blueprint(idea: str, intent: str) -> dict:
|
11 |
system_prompt = f"""
|
12 |
You are a robotics app designer.
|
|
|
27 |
Blueprint:
|
28 |
"""
|
29 |
|
30 |
+
response = client.chat.completions.create(
|
31 |
model="gpt-4o",
|
32 |
messages=[
|
33 |
{"role": "system", "content": "You are a robotics UX planner."},
|
|
|
36 |
temperature=0.7
|
37 |
)
|
38 |
|
|
|
39 |
try:
|
40 |
blueprint = json.loads(response.choices[0].message.content.strip())
|
41 |
return blueprint
|