summaryrefslogtreecommitdiff
path: root/identity.py
blob: 9b4faa003d733f0ad5a58b17f42305dd5b18bea7 (plain)
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
from dataclasses import dataclass
import tomllib

@dataclass
class AgentIdentity:
    name: str
    personality: dict[str, str]
    values: dict[str, bool]
    quirks: dict[str, str]

@dataclass
class UserProfile:
    name: str
    preferences: dict[str, str]

def load_agent_identity(path: str) -> AgentIdentity:
    with open(path, "rb") as file:
        data = tomllib.load(file)

    return AgentIdentity(
        name=data["name"],
        personality=data["personality"],
        values=data["values"],
        quirks=data["quirks"],
    )

def load_user_profile(path: str) -> UserProfile:
    with open(path, "rb") as file:
        data = tomllib.load(file)

    return UserProfile(
        name=data["name"],
        preferences=data["preferences"],
    )