API and Plug-in Store (Developers)
Users can enrich their agent’s knowledge base by integrating data from external APIs. This process involves two main steps: pushing data into the knowledge base and formatting the information in the agent’s prompt to guide its responses. The information fetched from the API has no character limits. Attention: it will override the Knowledge Base text field in the web portal.
1. Pushing Data from an External API into the Knowledge Base
First, fetch data from an external API that dev has access to. This can be any service dev is working with, such as weather data, financial information, or other resources. The data can be retrieved using HTTP requests (e.g.,
GET
orPOST
).Once the data is fetched, dev can send it directly to the knowledge base. At this point, the data does not need to be perfectly formatted. The goal is to push the raw data into the knowledge base for future use.
Dev can use the API key of the agent to update and manage the knowledge base. Dev will need to ensure that they have the appropriate access credentials for the external API from which data is being fetched.
Get Knowledge: Get the latest knowledge base of the agent
Update Knowledge: Update the knowledge base.
2. Formatting and Processing Information in the Agent's Prompt
After the data is pushed into the knowledge base, it can then define how the agent should process and use the data through the agent’s prompt or knowledge base management settings.
In this step, dev will need to configure the agent's instructions to interpret and present the data in a meaningful way. This can include:
Filtering or reformatting the data based on certain conditions.
Defining how the agent responds when certain queries relate to the newly added data.
Creating rules or logic in the agent's prompt that guide the agent’s interaction with the data (for example, extracting relevant information or responding with the latest API data).
Essentially, this step allows the agent to process and present the data dynamically based on user queries, creating a more interactive experience.
Important Notes:
API Key: While an API key is needed to update the knowledge base, ensure that dev has the necessary access credentials for the external API from which dev is fetching the data.
Data Formatting: When sending the data to the knowledge base, it may require formatting before it is added to ensure compatibility with the knowledge base structure. For complex data, consider cleaning or structuring the data before pushing it into the knowledge base.
Dynamic Updates: Once the data is in the knowledge base, it is recommended to periodically update it to keep the information current. This can be automated using tools like cron jobs to fetch and push the latest data at regular intervals (e.g., daily). The updates won’t be handled automatically, so dev needs to set up and manage the process on their own.
Example Workflow:
Fetch Data: Use an external API to pull real-time information.
Push Data: Send the fetched data to the knowledge base using its API, either in raw or pre-processed format.
Format Data: Configure the agent’s prompt to define how the data should be processed, interpreted, and presented in responses.
🛍️ API Plug-in Stores
The API Plug-in Store is a new feature that will allow developers to create, upload, and share their custom APIs with the broader community on the Top Hat platform. Once APIs are uploaded, they can be accessed and used by other users, providing a wide variety of functionality and integration options to the HAT ecosystem.
In return for providing these APIs, developers will be compensated in $HAT tokens by users who integrate their APIs. A portion of the revenue generated from API usage will also be redistributed to $HAT holders, rewarding the community for their participation in the ecosystem.
Last updated