-
-
Notifications
You must be signed in to change notification settings - Fork 1
How to add a new Action
Chloe can be easily extended to support new actions. You merely need to write the code that performs the action you want and teach Chloe how to detect the action and call it.
Add a new package under react/actions with the name of the action, and implement the Action interface.
To facilitate things and reduce duplicate code, there's a action_generator.go generator that writes most of the boiler plate. Be sure to add your action there, along with it's required parameters, and to set skips for functions you might want to write yourself.
Of everything, only the struct itself, the Execute
and the GetNotification
methods are required
to be implemented manually.
You can use tts as a
reference of a simple action, but basically you need to return an array
of ResponseObject
in the Execute
method, which you can create using structs.NewResponseObject(<OBJECT_TYPE>)
.
In case you aren't aware, to generate files in Go we use go generate
. To do so, go to the
root of the project and
run go generate ./...
and Go will create several files ending in _gen.go
with the generated
code.
Register the action in the actions map using all the aliases you want to support.
Edit
the action_detection
prompt to teach her how to detect them. Simply add it to the COMMANDS
section by following the
existing examples.
You can optionally add few-shot examples to help Chloe detect the action. See Few-shot prompting.
If you think your action is useful for the community, please consider opening a pull request to add it to Chloe.
Got any question? Feel free to open an issue or start a discussion!