Tool API
The Tool API allows you to call customized tools from your own applications. It provides a set of APIs to interact with the tool, such as sending messages, uploading files, and creating threads.
Overview
A typical integration of the Tool API has the following flow:
Create a Tool on rebyte tool editor by defining its custom actions, such as
Model
,Data
,Utilities
,Control Flow
, etc. Pick the model and parameters that you want to use.Create a Thread when a user starts a conversation.
Add Messages to the Thread as the user asks questions.
Run the Tool on the Thread to generate a response.
Step by step
Create a Tool.
Here, we'll just use this "Chat with GPT3.5 tool" as an example. Remember to test your tool first and make sure it works as expected. Also, click "Deploy" to make it available for the API.
Create a thread
Before using the API, get your API key from the API console on the sidebar. You should use this key to authenticate your requests.
When creating a thread, you can append the messages to the thread when creating it. You can also attach metadata to the thread. This can be useful for storing additional information about the object in a structured format.
In the response, you will find the thread id. You can use this thread id to add messages to the thread and run the tool on the thread.
Example Response
Add messages to the thread
In the response, you can see the message information.
Example Response
Run the tool on the thread
In order to run the tool on the thread, you should get the url from deploying your tool and make a request to this url.
When calling the tool, you should specify the thread id, and you will be able to get all the messages and metadata from the thread.
You can also use "contentOnly:true" to get only the content of the messages.
Get the messages from the thread
In the response, you will get the list of all messages on the thread.
Example Response
Blocking and Non-blocking calls
Add 'blocking' parameter to the request body to specify whether the call should be blocking or non-blocking. If 'blocking' is set to true, the call will wait for the response from the tool. If 'blocking' is set to false, the call will return immediately with a run_id, which can be used to check the status of the call later.
Streaming
Add 'stream' parameter to the request body to specify whether the call should be streaming or not. If 'stream' is set to true, the call will return a stream of messages from the tool as they are generated. If 'stream' is set to false, the call will return the final response from the tool.
Last updated