Tools
A tool is a powerful feature in the Lamatic for modern AI systems that enables seamless interaction with external functions and APIs in a structured manner. It acts as a bridge between natural language processing and programmatic actions, allowing AI models to interpret user requests and execute specific functions accordingly. This capability enhances automation, improves efficiency, and extends the AI’s ability to perform complex tasks beyond simple text-based interactions.
Tools can be added in Text-Gen Node and Multimodel Node
Tools are a mechanism that enables AI models to:
-
Comprehend natural language input
-
Determine when a specific function should be invoked
-
Extract relevant parameters from user requests
-
Execute the appropriate function with the correct parameters
-
Present the results in a clear and meaningful manner
What you can build
- AI-Powered Systems – Enable seamless interaction with external functions and APIs in a structured manner.
- Natural Language Processing (NLP) Integration – Bridge the gap between NLP and programmatic actions.
- Automated Task Execution – Allow AI models to interpret user requests and execute specific functions.
- Enhanced Workflow Automation – Improve efficiency by automating repetitive processes.
- Dynamic API Interaction – Enable AI to call APIs, extract data, and return meaningful results.
How to Create Tools
- Go to Lamatic Studio
- Navtigate to Models > Tools Sections
- Click on + Add Tool Button
- Config Tool by adding Name, Description, Parameters and Code
Tool Config
Name
The name of the tool and the name of the function associated with it. This will be used to identify the tool in the flow. The naming constraints are the same as for function names in JavaScript.
Example: convertINRtoUSD
Description
A short description of the tool
Example: Convert amount from Indian Rupees (INR) to US Dollars (USD)
Parameters
This is a JSON Schema object that describes the parameters that the tool accepts and are the ones that will be passed to the model.
Example:
{
"amount": {
"type": "number",
"required": true,
"description": "Amount in INR to convert"
}
}
Code
This is the code that will be executed when the tool is called.
Important Notes
- Reserved Variables:
input
andoutput
are reserved variables. Avoid overwriting them.
- Using Schema Variables:
- To access variables defined in the schema, use
input.variableName
. - Example: If the schema includes
query
, reference it asinput.query
in the function.
- To access variables defined in the schema, use
- Returning Output:
- Assign the return value to
output
to pass data from the function.
- Assign the return value to
Example
const response = await fetch('https://api.exchangerate-api.com/v4/latest/INR');
const data = await response.json();
const usdRate = data.rates.USD;
const result = input.amount * usdRate;
output = result
How to use Tools in the Flows
Tools can be added in Text-Gen Node and Multimodel Node
To integrate tools into your flow, follow these steps:
- Select the Flow where you want to use the tool.
- Choose either Text-Gen Node or Multimodel Node, then navigate to Additional Properties.
- Select the desired tools. You can add multiple tools as needed.
Troubleshooting
Common Issues
Problem | Solution |
---|---|
Parameter | Ensure the parameter is defined correctly. |
Code | Ensure the parameter is accessed correctly in the code. |
Debugging
- Check the Lamatic Flow logs for error details.
- Verify the input parameters to ensure proper configuration.