File size: 1,216 Bytes
f793029
43b2c38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ui/intake/examples.py
from __future__ import annotations

from typing import Any, TypedDict

from ui.intake.loader import load_demo_personas
from ui.intake.prompts import build_profile_prompt


class PersonaProfile(TypedDict):
    citizenship: list[str] | str
    current_country: str
    residence_status: str
    education: str
    occupation: str
    experience: str
    languages: list[str] | str
    budget: str
    family: str
    timeline: str
    goals: str


class DemoPersona(TypedDict):
    id: str
    label: str
    profile: PersonaProfile


def demo_personas() -> list[DemoPersona]:
    return load_demo_personas()  # type: ignore[return-value]


def persona_prompt(profile: PersonaProfile | dict[str, Any]) -> dict[str, object]:
    return build_profile_prompt(
        profile.get("citizenship"),
        profile.get("current_country"),
        profile.get("residence_status"),
        profile.get("education"),
        profile.get("occupation"),
        profile.get("experience"),
        profile.get("languages"),
        profile.get("budget"),
        profile.get("family"),
        profile.get("timeline"),
        profile.get("goals", ""),
    )