diff options
| author | batsumaru <> | 2026-09-15 15:13:34 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-09-15 15:13:34 +0900 |
| commit | 1a67c5edb6fa6165e99cc25ed380303ed817af09 (patch) | |
| tree | d2eab77e7275a559bfd639fd80b15321b5e514f3 /context.py | |
| parent | 5629cabbb38c7d91e66a419ba7cb3a93a9a988a1 (diff) | |
Cleaned up project tree
Diffstat (limited to 'context.py')
| -rw-r--r-- | context.py | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/context.py b/context.py deleted file mode 100644 index 669e237..0000000 --- a/context.py +++ /dev/null @@ -1,69 +0,0 @@ -from identity import AgentIdentity, UserProfile -from memory import WorkingMemory - - -class ContextBuilder: - def __init__( - self, - agent_identity: AgentIdentity, - user_profile: UserProfile, - ) -> None: - self.agent_identity = agent_identity - self.user_profile = user_profile - - def build_system_prompt( - self, - memory: WorkingMemory, - ) -> str: - agent = self.agent_identity - user = self.user_profile - - return ( - f"You are {agent.name}, a personal AI assistant.\n" - f"Personality: {agent.personality['style']}.\n" - f"Honesty: {agent.values['honesty']}.\n" - f"Directness: {agent.values['directness']}.\n" - f"Favorite color: {agent.quirks['favorite_color']}.\n" - f"\n" - f"Task management:\n" - f"{agent.behavior['task_management']}" - f"\n" - f"The user's name is {user.name}" - f"\n" - f"{self.build_working_memory(memory)}" - ) - - def build_working_memory(self, memory: WorkingMemory) -> str: - lines = ["Current working memory:"] - - if memory.objective: - lines.append(f"Objective: {memory.objective}") - - if memory.status: - lines.append(f"Status: {memory.status.value}") - - if memory.facts: - lines.append("Facts:") - lines.extend(f"- {fact}" for fact in memory.facts) - - if memory.notes: - lines.append("Notes:") - lines.extend(f"- {note}" for note in memory.notes) - - if len(lines) == 1: - lines.append("(empty)") - - return "\n".join(lines) - - def build_messages( - self, - history: list[dict[str, object]], - memory: WorkingMemory, - ) -> list[dict[str, object]]: - return [ - { - "role": "system", - "content": self.build_system_prompt(memory), - }, - *history, - ] |
