Create a prompt tool
Create and integrate custom prompt tools for specific tasks.
Create a function via code in the editor
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.
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
-
We convert this into JSON schema and while making requests to the model, we send the payload as
Create a Schema-based Prompt tool
The Schema prompt tool type provides a structured way to define tools for accurate and schema-compliant outputs. This type is especially useful for ensuring tool call accuracy.
Steps to create a Schema-based Prompt Tool
Go to the Prompt Tools section and create a new tool.
Select Schema as the tool type.
Define the schema for your prompt tool. For example, a schema for fetching stock price:
Save your schema-based prompt tool using the Save button in the editor.
Add your tool to a prompt configuration to test whether the model accurately selects and uses it.