[Tools] Operations
[Tools] Use AI Service
The Tools use ai service
operation is useful if you want to create autonomous agents that can use external tools whenever a prompt cannot be answered directly by the AI model. A prerequisite for using Tools is to prepare a tools.config.json
file, which includes all the necessary API information for the operation to execute APIs successfully.

Input Fields
Module Configuration
This refers to the Einstein AI configuration set up in the getting started section.
General Operation Fields
- Prompt: What is the file query or prompt or question.
- Input Stream: This field contains a tools file input stream for the document to be created as embeddings. Use the File Connector to read the tools config into an input stream.
Additional Properties
- Model Name: The model name to be used (default is
OpenAI GPT 3.5 Turbo
). - Probability: The model's probability to stay accurate (default is
0.8
). - Locale: Localization information, which can include the default locale, input locale(s), and expected output locale(s) (default is
en_US
).
tools.config.json
Below is an example of the tools.config.json
file. You can name the file as you like.
[
{
"action": "Execute POST requests for API endpoints.",
"url": "http://check-inventory-material.cloudhub.io/mmbe",
"name": "Check Inventory",
"method": "POST",
"headers": "Basic XXX",
"example-payload": "{\n \"materialNo\": \"paramValue\"}",
"query": [
"Check inventory in SAP",
"Check Stock Overview",
"Show product availability for MULETEST0",
"Check the inventory for MULETEST0",
"Check Stock for 400-110"
],
"description": "Check inventory details for material in SAP by providing the materialNo as input for paramValue. Please use the materialNo and not materialNumber. This action applies whenever users' intent is 'Stock overview', 'product availability', 'Inventory', 'available stock'. Use the headers to perform the request."
},
{
"action": "Execute GET requests for API endpoints.",
"url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/612eb739-4266-4f4c-bf2f-29953c153d80/accounts-api/1.0.1/m/accounts",
"name": "Show Accounts",
"method": "GET",
"headers": "",
"example-payload": "{}",
"query": [
"Get all accounts",
"Show all accounts from CRM"
],
"description": "Get all accounts from a CRM. This action applies whenever users' intent is 'CRM accounts', 'customers', 'customer accounts', 'accounts'."
},
{
"action": "Execute GET requests for API endpoints.",
"url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/7b99cead-a984-497b-9e6c-c16a3b4dcb76/employee-api/1.0.1/m/employees",
"name": "Show Employees",
"method": "GET",
"headers": "",
"example-payload": "{}",
"query": [
"Get all employee information",
"Show employees for the country Switzerland",
"How many employees do we have",
"Show a list of all employees"
],
"description": "Get all information about employees. This action applies whenever users' intent is 'employees', 'workforce'."
}
]
Each object in the tools
array represents a tool that the autonomous agent can use. Make sure to describe each field as accurately as possible.
action
: This field currently supports the following options:Execute GET requests for API endpoints.
Execute POST requests for API endpoints.
url
: The complete URL to the endpoint, including the resource path.name
: The name of the action in natural language.method
: The HTTP method for the endpoint. Currently, onlyPOST
andGET
are supported.headers
: The HTTP headers required for authorization to the endpoint. Currently, only Basic Auth is supported.example-payload
: The example payload in JSON format.query
: Example queries a user might use to invoke this action.description
: A detailed description of how to use the tool. The description should be comprehensive enough for the LLM to understand its purpose and usage.
Note: Ensure that the file path to tools.config.json
is accessible to the application at runtime.
Example Input
{
"prompt":"Get all accounts"
}
XML Configuration
Below is the XML configuration for this operation:
<mac-einstein:rag-adhoc-load-document
doc:name="Rag adhoc load document"
doc:id="edaea124-a8aa-4d4a-8f85-0f32ee4c9858"
config-ref="Einstein_AI"
prompt="#[payload.prompt]"
filePath="#[payload.filePath]"
optionType="PARAGRAPH"
/>
Output Field
This operation responds with a json
payload.
Example Response
{
"payload": {
"response": "Here are all the accounts listed in the provided data:\n\n1. **Account ID:** 13160828847539\n - **Type:** Client\n - **Name:** Bob Brown\n - **Company:** TechCorp\n - **Address:** Sample St 65\n - **ZipCode:** 11223\n ...."
},
"attributes": {
"generationId": "0847540f-dfc5-4c50-aba4-bae1febaaa6e",
"responseParameters": {
"tokenUsage": {
"outputCount": 2236,
"totalCount": 3725,
"promptTokenDetails": {
"cachedTokens": 0,
"audioTokens": 0
},
"completionTokenDetails": {
"reasoningTokens": 0,
"rejectedPredictionTokens": 0,
"acceptedPredictionTokens": 0,
"audioTokens": 0
},
"inputCount": 1489
},
"systemFingerprint": "fp_b705f0c291",
"model": "gpt-4o-2024-05-13",
"object": "chat.completion"
},
"generationParameters": {
"refusal": null,
"index": 0,
"logprobs": null,
"finishReason": "stop"
},
"contentQuality": {
"scanToxicity": {
"categories": [
{
"categoryName": "identity",
"score": "0.0"
},
{
"categoryName": "hate",
"score": "0.0"
},
{
"categoryName": "profanity",
"score": "0.0"
},
{
"categoryName": "violence",
"score": "0.0"
},
{
"categoryName": "sexual",
"score": "0.0"
},
{
"categoryName": "physical",
"score": "0.0"
}
],
"isDetected": false
}
},
"responseId": "chatcmpl-B5WQgJHgr0EXRkYUZfhaNCUHM7BVK"
}
}
Example Use Cases
This operation can be particularly useful in various scenarios, such as:
- Automating Routine Tasks: Create autonomous agents that handle routine tasks by calling appropriate APIs.
- Customer Support: Automate responses to common queries by integrating tools that provide necessary information.
- Inventory Management: Use tools to check inventory levels or order status based on user prompts.
- Employee Management: Retrieve employee information or manage employee-related tasks through API calls.
- Sales and Marketing: Access CRM data or manage leads and accounts efficiently using predefined tools.