File size: 1,617 Bytes
0a290c7
 
d01c45b
 
0a290c7
 
d01c45b
 
 
0a290c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d01c45b
0a290c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# app_blueprint.py - Translates a robotics idea and intent into an app design blueprint

import os
import json
from openai import OpenAI

# Initialize OpenAI client using environment variable
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

def generate_app_blueprint(idea: str, intent: str) -> dict:
    system_prompt = f"""
    You are a robotics app designer.
    Given the user's idea and intent category, output a JSON blueprint with:

    - "title": Name of the app
    - "description": Summary of what the robot does
    - "inputs": Required sensors or input sources
    - "outputs": Actions, movements, speech, UI elements
    - "voice_commands": Expected voice inputs from the user
    - "monetization": Suggested monetization strategies (e.g., subscription, ads, hardware upsells)

    Be concise but complete. Return only a JSON object.

    Example idea: {idea}
    Intent category: {intent}

    Blueprint:
    """

    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are a robotics UX planner."},
            {"role": "user", "content": system_prompt},
        ],
        temperature=0.7
    )

    try:
        blueprint = json.loads(response.choices[0].message.content.strip())
        return blueprint
    except Exception as e:
        return {"error": str(e), "raw_response": response.choices[0].message.content.strip()}

# Example
if __name__ == "__main__":
    idea = "Make a robot that waves and greets customers at a store entrance."
    intent = "retail"
    print(generate_app_blueprint(idea, intent))