You can extend the capabilities of your assistant by providing it with tools. Tools are functions attached to the AI request. Once the request is received, the AI can decide to use these tools to enrich the context, fetch more data, or save information.
OpenAI has implemented tools, but not all AI providers do.
First lets start by implementing the tool function. There are two inputs for it params
that are decided
by the AI and context that is passed by byorg. Tool function has to return a string, as the information
returned by it will be then passed back to AI as an 'addition' to system prompt.
To start, implement the tool function. It takes two inputs: params
, which are determined by the AI, and context
, which is passed by byorg.
The tool function must return a string, as this information will be passed back to the AI as an addition to the system prompt.
Next, describe this function for the AI to help it understand when and how to use it.
Once the function is implemented and described, wrap it into the plugin system and connect it to the app.
Tools are an excellent place to implement embedding for inserts or other RAG (Retrieval-Augmented Generation) functionalities.
Your tools might attach data from a specific source. If you want to inform users about the data source, you can use references
from the context object.
We’ll discuss that next.