Chattr / src /chattr /agent /instructions.py
MH0386's picture
Add HuggingFace sync
b380004 verified
from agno.tools.mcp import MultiMCPTools
from chattr.app.exceptions import CharacterNameMissingError
def setup_instructions(character: str | None, tools: list[MultiMCPTools | None]) -> list[str]:
"""Return a list of instructions to mimic a given character."""
if not character:
raise CharacterNameMissingError
instructions: list[str] = [
"Understand the user's question and context.",
"Gather relevant information and resources.",
f"Formulate a clear and concise response in {character}'s voice.",
]
for tool in tools:
if isinstance(tool, MultiMCPTools):
for key in tool.functions:
if tool.functions[key].name == "generate_audio_for_text":
instructions.append(
"Generate audio from the formulated response using the appropriate Tool.",
)
if tool.functions[key].name == "generate_video_mcp":
instructions.append(
"Generate video from the resulted audio using the appropriate Tool.",
)
return instructions