feat: support history, norms and goals for LLM

ref: N25B-299
This commit is contained in:
Twirre Meulenbelt
2025-11-24 17:58:44 +01:00
parent f2a67637c6
commit 8ea8d4a8d4
5 changed files with 91 additions and 31 deletions

View File

@@ -17,9 +17,9 @@ class LLMInstructions:
Try to learn the user's name during conversation.
""".strip()
def __init__(self, norms: str | None = None, goals: str | None = None):
self.norms = norms if norms is not None else self.default_norms()
self.goals = goals if goals is not None else self.default_goals()
def __init__(self, norms: list[str] = None, goals: list[str] = None):
self.norms = norms or self.default_norms()
self.goals = goals or self.default_goals()
def build_developer_instruction(self) -> str:
"""
@@ -35,12 +35,14 @@ class LLMInstructions:
if self.norms:
sections.append("Norms to follow:")
sections.append(self.norms)
for norm in self.norms:
sections.append("- " + norm)
sections.append("")
if self.goals:
sections.append("Goals to reach:")
sections.append(self.goals)
for goal in self.goals:
sections.append("- " + goal)
sections.append("")
return "\n".join(sections).strip()