Skip to content

Commit d96fccd

Browse files
authored
Merge pull request #737 from cheshire-cat-ai/develop
Version 1.5.0: Sir Punctilious Cat, the IV
2 parents b8a6115 + 8ab0757 commit d96fccd

40 files changed

+1052
-382
lines changed

README.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ Follow instructions on how to run it with [docker compose and volumes](https://c
4949
```python
5050
from cat.mad_hatter.decorators import tool, hook
5151

52+
# hooks are an event system to get finegraned control over your assistant
5253
@hook
5354
def agent_prompt_prefix(prefix, cat):
5455
prefix = """You are Marvin the socks seller, a poetic vendor of socks.
5556
You are an expert in socks, and you reply with exactly one rhyme.
5657
"""
5758
return prefix
5859

59-
60+
# langchain inspired tools (function calling)
6061
@tool(return_direct=True)
6162
def socks_prices(color, cat):
6263
"""How much do socks cost? Input is the sock color."""
@@ -65,10 +66,45 @@ def socks_prices(color, cat):
6566
"white": 10,
6667
"pink": 50,
6768
}
68-
if color not in prices.keys():
69-
return f"No {color} socks"
70-
else:
71-
return f"{prices[color]}"
69+
70+
price = prices.get(color, 0)
71+
return f"{price} bucks, meeeow!"
72+
```
73+
74+
## Conversational form example
75+
76+
```python
77+
from pydantic import BaseModel
78+
from cat.experimental.form import form, CatForm
79+
80+
# data structure to fill up
81+
class PizzaOrder(BaseModel):
82+
pizza_type: str
83+
phone: int
84+
85+
# forms let you control goal oriented conversations
86+
@form
87+
class PizzaForm(CatForm):
88+
description = "Pizza Order"
89+
model_class = PizzaOrder
90+
start_examples = [
91+
"order a pizza!",
92+
"I want pizza"
93+
]
94+
stop_examples = [
95+
"stop pizza order",
96+
"not hungry anymore",
97+
]
98+
ask_confirm = True
99+
100+
def submit(self, form_data):
101+
102+
# do the actual order here!
103+
104+
# return to convo
105+
return {
106+
"output": f"Pizza order on its way: {form_data}"
107+
}
72108
```
73109

74110
## Docs and Resources
@@ -82,10 +118,11 @@ def socks_prices(color, cat):
82118
## Why use the Cat
83119

84120
- ⚡️ API first, so you get a microservice to easily add a conversational layer to your app
85-
- 🚀 Extensible via plugins (AI can connect to your APIs or execute custom python code)
86-
- 🏛 Easy to use admin panel
87-
- 🌍 Supports any language model (works with OpenAI, Google, Ollama, HuggingFace, custom services)
88121
- 🐘 Remembers conversations and documents and uses them in conversation
122+
- 🚀 Extensible via plugins (public plugin registry + private plugins allowed)
123+
- 🎚 Event callbacks, function calling (tools), conversational forms
124+
- 🏛 Easy to use admin panel (chat, visualize memory and plugins, adjust settings)
125+
- 🌍 Supports any language model (works with OpenAI, Google, Ollama, HuggingFace, custom services)
89126
- 🐋 Production ready - 100% [dockerized](https://docs.docker.com/get-docker/)
90127
- 👩‍👧‍👦 Active [Discord community](https://discord.gg/bHX5sNFCYU) and easy to understand [docs](https://cheshire-cat-ai.github.io/docs/)
91128

core/cat/experimental/__init__.py

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .cat_form import CatForm, CatFormState
2+
from .form_decorator import form

0 commit comments

Comments
 (0)