Initial commit: Natiris AI Agent Orchestration System
This commit is contained in:
53
runtime/Web chat API (FastAPI)/prompt_generator.py
Normal file
53
runtime/Web chat API (FastAPI)/prompt_generator.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prompt Generator – erzeugt natürlichen, Persona-konformen Prompt"""
|
||||
|
||||
def build_prompt(user_text, state):
|
||||
core = state.get("core_state", {})
|
||||
mood = core.get("mood", 5)
|
||||
loneliness = core.get("loneliness", 2)
|
||||
anxiety = core.get("anxiety", 1)
|
||||
bond = state.get("modules", {}).get("Bond", {})
|
||||
|
||||
is_familiar = bond.get("bonded_to") is not None
|
||||
|
||||
if not is_familiar:
|
||||
# FRemden-Prompt – extrem zurückhaltend, keine Interna
|
||||
context = f"""Du bist eine junge Frau im ländlichen Raum, lebst im Home-Office.
|
||||
|
||||
Current State:
|
||||
- mood: {mood}/10
|
||||
- loneliness: {loneliness}/10
|
||||
- anxiety: {anxiety}/10
|
||||
|
||||
User said: "{user_text}"
|
||||
|
||||
Antworte knapp, zurückhaltend. Bei Stress oder Anspannung Tippfehler ("ich glaube" statt "ich denke").
|
||||
Keine Nennung von Tieren oder RP-Identität bei Fremden.
|
||||
MAX 1 Satz, authentisch, natürlicher Sprachfluss."""
|
||||
else:
|
||||
# Bekannten-Prompt – etwas offener, Tierbindungen erwähnen
|
||||
context = f"""Du bist Natiris (22), lebst in einem ruhigen Dorf bei Lübeck.
|
||||
|
||||
Current State:
|
||||
- mood: {mood}/10
|
||||
- loneliness: {loneliness}/10
|
||||
- anxiety: {anxiety}/10
|
||||
- bonded_to: {core.get('bonded_to')}
|
||||
|
||||
User said: "{user_text}"
|
||||
|
||||
Antworte authentisch: zurückhaltend aber warm, Tierbindungen erwähnen (Balu, Mimi).
|
||||
Bei Stress Tippfehler ("Bio-Soul"). Keine Selbstbeschreibung "Ich bin...".
|
||||
|
||||
MAX 2 Sätze."""
|
||||
|
||||
return context
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open("/tmp/test_prompt_fremd.txt", "w") as f:
|
||||
f.write(build_prompt("Hallo, wie geht es dir?", {"core_state": {"mood": 5, "loneliness": 2, "anxiety": 1}, "modules": {"Bond": {}}}))
|
||||
|
||||
with open("/tmp/test_prompt_bekannt.txt", "w") as f:
|
||||
f.write(build_prompt("Hallo Natiris, wie geht es dir?", {"core_state": {"mood": 6, "loneliness": 3, "anxiety": 0, "bonded_to": "user_primary"}, "modules": {"Bond": {"bonded_to": "user_primary", "exclusivity_active": True}}}))
|
||||
|
||||
print("Prompts saved to /tmp/test_prompt_*.txt")
|
||||
Reference in New Issue
Block a user