Prompt Tools
Comprehensive documentation for creating and using different types of prompt tools in Maxim
Creating a prompt tool involves developing a function tailored to a specific task, then making it accessible to LLM models by exposing it as a prompt tool. This allows you to mimic and test an agentic flow.
Create a Prompt Tool
For creating a prompt tool:
Go to the left navigation bar.
Click on the “Prompts Tools” tab.
This will direct you to the Prompt Tools page.
Click on the + button.
You have the option to select “Code” as the tool type.
Click the “Create” button.
Proceed to write your own custom function in javascript.
Within the interface there is a designated area to input code. Adjacent to this, on the right-hand side, you can provide relevant inputs tailored to the function’s requirements. Upon execution, the output is displayed in the console located at the bottom of the screen.
In this example, we are creating a Prompt tool to calculate the total fare for traveling through a list of cities using a predefined fare map. This prompt tool can then be attached to single prompts.
Here is the code snippet for the prompt tool:
Bring your custom functions via APIs
In Maxim you can expose function call via APIs. We generate function schema based on the Query Parameters and Payload. We collect variables from both of these and add them to function call / tools call object while sending it to the model.
For example
-
If your payload looks like
Zipcode API payload -
We convert this into JSON schema and while making requests to the model, we send the payload as
Payload sent to the model while making requests
Create a Code-Based Tool
Creating a code-based tool
Navigate to Prompt Tools
Go to the left navigation bar and click on the “Prompts Tools” tab.
Create new tool
On the Prompt Tools page, click the + button.
Select tool type
Select “Code” as the tool type and click “Create”.
Write your function
Write your custom function in JavaScript in the code editor.
Code editor interface
The interface provides:
- A code editor for writing your function
- An input panel on the right for testing
- A console at the bottom to view outputs
Example: Travel price calculator
Here’s an example of a prompt tool that calculates travel fares between cities:
Create a Schema-Based Tool
Overview
Schema-based prompt tools provide a structured way to define tools that ensure accurate and schema-compliant outputs. This approach is particularly useful when you need to guarantee that the LLM’s responses follow a specific format.
Creating a Schema Tool
Navigate to Prompt Tools
Navigate to the Prompt Tools section and click the + button.
Select tool type
Select Schema as the tool type.
Define your schema
Define your schema in the editor. Here’s an example schema for a stock price tool:
Click the Save button to create your schema-based tool.
Testing Your Schema Tool
After creating your schema-based tool:
- Add it to a prompt configuration
- Test if the model correctly identifies when to use it
- Verify that the outputs match your schema’s structure
Create an API-Based Tool
Overview
Maxim allows you to expose external API endpoints as prompt tools. The platform automatically generates function schemas based on the API’s query parameters and payload structure.
Example
Here’s how an API payload gets converted into a function schema:
- Original API Payload:
- Generated Schema for LLM:
Evaluate Tool Call Accuracy
You can learn more about evaluating the accuracy of tool calls here.