generated from cheshire-cat-ai/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
farfallino_alphabet.py
39 lines (32 loc) · 1.03 KB
/
farfallino_alphabet.py
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
28
29
30
31
32
33
34
35
36
37
38
39
from cat.mad_hatter.decorators import tool, hook, plugin
from pydantic import BaseModel
from datetime import datetime, date
class MySettings(BaseModel):
required_int: int
optional_int: int = 69
required_str: str
optional_str: str = "meow"
required_date: date
optional_date: date = 1679616000
@plugin
def settings_model():
return MySettings
@tool
def get_farfallino_message(tool_input, cat):
"""Cypher the specified input and the output using the farfallino
alphabet. Input is quoted using a '%' character. Output is the
tool output replacing the '%' character. """
farfallino_input = ""
for char in tool_input:
if char in ["a", "e", "i", "o", "u"]:
farfallino_input += "f" + char
else:
farfallino_input += char
return farfallino_input
@hook
def agent_prompt_prefix(prefix, cat):
prefix = """You are a secret agent and you're very mysterious. You
are an expert spy and you can help the user with their secrets
message.
"""
return prefix