mgbam commited on
Commit
0a290c7
·
verified ·
1 Parent(s): ddaad63

Update core_creator/app_blueprint.py

Browse files
Files changed (1) hide show
  1. core_creator/app_blueprint.py +45 -0
core_creator/app_blueprint.py CHANGED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.
8
+ Given the user's idea and intent category, output a JSON blueprint with:
9
+
10
+ - "title": Name of the app
11
+ - "description": Summary of what the robot does
12
+ - "inputs": Required sensors or input sources
13
+ - "outputs": Actions, movements, speech, UI elements
14
+ - "voice_commands": Expected voice inputs from the user
15
+ - "monetization": Suggested monetization strategies (e.g., subscription, ads, hardware upsells)
16
+
17
+ Be concise but complete. Return only a JSON object.
18
+
19
+ Example idea: {idea}
20
+ Intent category: {intent}
21
+
22
+ Blueprint:
23
+ """
24
+
25
+ response = OpenAI().chat.completions.create(
26
+ model="gpt-4o",
27
+ messages=[
28
+ {"role": "system", "content": "You are a robotics UX planner."},
29
+ {"role": "user", "content": system_prompt},
30
+ ],
31
+ temperature=0.7
32
+ )
33
+
34
+ import json
35
+ try:
36
+ blueprint = json.loads(response.choices[0].message.content.strip())
37
+ return blueprint
38
+ except Exception as e:
39
+ return {"error": str(e), "raw_response": response.choices[0].message.content.strip()}
40
+
41
+ # Example
42
+ if __name__ == "__main__":
43
+ idea = "Make a robot that waves and greets customers at a store entrance."
44
+ intent = "retail"
45
+ print(generate_app_blueprint(idea, intent))