SuperCatForm is an opinionated extension of the traditional CatForm that allows devs to create more powerful and engaging agents.
The plugin comes with a new decorator for conversational forms @super_cat_form.
Currently I've added just one superpower: the abality to execute tools during form execution: as you can see the Cat now is not only a simple data collector but a more human-like agent.
Here's an example:
from pydantic import BaseModel
from datetime import datetime
from cat.plugins.super_cat_form.super_cat_form import SuperCatForm, form_tool, super_cat_form
class PizzaOrder(BaseModel):
pizza_type: str
address: str
@super_cat_form
class PizzaForm(SuperCatForm):
description = "Pizza Order"
model_class = PizzaOrder
start_examples = [
"order a pizza!",
"I want pizza"
]
stop_examples = [
"stop pizza order",
"not hungry anymore",
]
ask_confirm = False
@form_tool(return_direct=True)
def get_menu(self):
"""Useful to get the menu. User may ask: what is the menu? Input is always None."""
return ["Margherita", "Pepperoni", "Hawaiian"]
@form_tool(return_direct=True)
def ask_for_daily_promotions(self):
"""Useful to get any daily promotions. User may ask: what are the daily promotions? Input is always None."""
if datetime.now().weekday() == 0:
return "Free delivery"
elif datetime.now().weekday() == 4:
return "Free Pepperoni"
def submit(self, form_data):
return {
"output": f"Form submitted: {form_data}"
}
Here are some screenshots of the enhanced PizzaForm in action.
The goal of this plugin is to push the conversational forms API even further - a feature with enormous potential. Next steps include support for JSON schema, nested fields, and more! Stay tuned!