File size: 1,143 Bytes
b380004
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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