Use function calling¶
Give your chatbot a new ability by registering a function.
Easiest: Code Core¶
OG AI Code Core lets you write a PHP function in the admin and expose it as a tool, with a description and parameters. No plugin file needed.
In your own plugin¶
Add your function through the ogaie_functions_list filter. The filter passes a list of function objects (each has a type and an id; look at how Code Core builds them). A function needs:
- a name,
- a clear description (the model reads it to decide when to call it),
- typed parameters,
- a callback returning a string or array.
Then tick it under the chatbot's Functions.
Rules of thumb¶
- Describe when to use it and when not to.
- Validate every parameter. The model can send odd values.
- Check permissions inside the callback.
- Return short, factual results.
- Never return secrets.
- The number of chained rounds is capped (
ogaie_function_call_max_depth).