Create Custom Tool
Creating a Custom Tool in Klu
Creating a custom tool in Klu allows you to tailor the functionality to meet your specific needs. Here’s a step-by-step guide on how to create your own custom tool:
1. Access the Custom Tool Creation Interface
- Navigate to Settings:
- Log in to Klu and click on the settings icon (usually represented by a gear icon) in the chat interface.
- Select "Custom Tools":
- In the settings menu, find and select the "Custom Tools" option. This will take you to the tool creation interface.
2. Choose a Base Tool
- Select a Pre-Built Tool:
- Klu offers several pre-built tools that you can use as a foundation for your custom tool. For example, you might choose the Fetch API Tool if you want to retrieve data from an external service.
- Example: If you want to create a tool that fetches data from a weather API, start with the Fetch API Tool as your base.
3. Configure Your Tool
- Name Your Tool:
- Give your custom tool a descriptive name that reflects its purpose, such as “Weather Data Fetcher” or “Posthog Analytics Fetcher.”
- Set Up API Details:
- Enter the necessary API endpoint, authentication method, and any required parameters. This is where you specify how Klu will connect to the external service.
- Example: For a weather API, you might enter the endpoint as
https://api.weather.com/v3/weather/conditions
and specify any required query parameters, such as the location. - Example for Posthog: If you want to create a tool to fetch analytics data from Posthog, you would set the API endpoint to
https://app.posthog.com/api/event/
and include your API key for authentication.
4. Add Custom Prompts
- Define Instructions:
- You can add custom prompts that instruct Klu on how to handle requests made to your tool. This helps Klu understand what data to fetch and how to format the response.
- Example: For the Posthog tool, you might add a prompt like, “Fetch the number of active users for the last week and return the count.”
5. Test Your Tool
- Run a Test Query:
- After configuring your tool, use the test feature to ensure it works correctly. Enter a sample query to see if Klu retrieves the expected data.
- Example: Type “Get the weather for New York” for the Weather Data Fetcher or “Show me active users from Posthog” for the Posthog tool, and check if Klu returns the correct information.
6. Save and Deploy Your Tool
- Save Your Custom Tool:
- Once you’re satisfied with the configuration and testing, click the “Save” button to store your custom tool.
- Deploy for Use:
- Your custom tool is now ready to use! You can access it directly from the chat interface.
7. Using Your Custom Tool
- Invoke the Tool in Chat:
- To use your custom tool, simply type a command in the chat. For example, you can say, “Use Weather Data Fetcher to get the weather for [location]” or “Fetch analytics from Posthog.”
- Example: If you created a tool called “Weather Data Fetcher,” you might type, “Weather Data Fetcher for Los Angeles,” and Klu will fetch the weather data for that location. For the Posthog tool, you could type, “Show me the active users for last week.”
8. Refining and Updating Your Tool
- Make Adjustments as Needed:
- If you find that your tool needs changes or improvements, you can return to the custom tool settings to edit the configuration, prompts, or API details.
- Example: If the API endpoint for Stripe changes or you want to add new features to your Stripe integration, simply update the tool settings and save the changes.
Conclusion
Creating a custom tool in Klu is a straightforward process that allows you to tailor the functionality to your specific needs. By following these steps and using examples like weather APIs, Posthog, or Stripe, you can enhance your workflow and make Klu work even better for you. Dive in and start building your custom tools today!