Link a JSON Schema Tool
Managing and versioning a Tool seperately from your Prompts
It’s possible to re-use tool definitions them across multiple Prompts. You achieve this by having a Prompt file which defines a JSON schema, and linking them to your Prompt.
You can achieve this by first defining an instance of a JSON Schema
tool in your global Tools tab. Here you can define a tool once, such as get_current_weather(location: string, unit: 'celsius' | 'fahrenheit')
, and then link that to as many model configs as you need within the Editor as shown below.
Importantly, updates to the get_current_weather
JSON Schema
tool defined here will then propagate automatically to all the model configs you’ve linked it to, without having to publish new versions of the prompt.
Prerequisites
- A Humanloop account - you can create one by going to our sign up page.
- Be on a paid plan - your organization has been upgraded from the Free tier.
- You already have a Prompt — if not, please follow our Prompt creation guide first.
To create a JSON Schema tool that can be reusable across your organization, follow the following steps:
Creating and linking a JSON Schema Tool
Paid Feature
This feature is not available for the Free tier. Please contact us if you wish to learn more about our Enterprise plan
Define your tool
Set the name
, description
, and parameters
values. Our guide for using Tool Calling in the Prompt Editor can be a useful reference in this case. We can use the get_current_weather
schema in this case. Paste the following into the dialog:
Select ‘Link existing Tool’
In the dropdown, go to the Link existing tool option. You should see your get_current_weather
tool, click on it to link it to your editor.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-09-06T09:30:14.003Z/assets/images/b70a144-image.png)
Test that the Prompt is working with the tool
Now that your tool is linked you can start using it as you would normally use an inline tool. In the Chat section, in the User input, enter “What is the weather in london?”
Press the Run button.
You should see the Assistant respond with the tool response and a new Tool field inserted to allow you to insert an answer. In this case, put in 22
into the tool response and press Run.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-09-06T09:30:14.003Z/assets/images/ebc5f1e-image.png)
The model will respond with The current weather in London is 22 degrees
.
Save the Prompt
You’ve linked a tool to your model config, now let’s save it. Press the Save button and name your model config weather-model-config
.
(Optional) Update the Tool
Now that’s we’ve linked your get_current_weather
tool to your model config, let’s try updating the base tool and see how it propagates the changes down into your saved weather-model-config
config. Navigate back to the Tools in the sidebar and go to the Editor.
Change the tool.
Let’s update both the name, as well as the required fields. For the name, update it to get_current_weather_updated
and for the required fields, add unit
as a required field. The should look like this now:
Save the Tool
Press the Save button, then the following Continue button to confirm.
Your tool is now updated.
Try the Prompt again
Navigate back to your previous project, and open the editor. You should see the weather-model-config
loaded as the active config. You should also be able to see the name of your previously linked tool in the Tools section now says get_current_weather_updated
.
In the Chat section enter in again, What is the weather in london?
, and press Run again.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-09-06T09:30:14.003Z/assets/images/4c395b6-image.png)
Linked JSON Schema tool changes propagate to saved model configs
When updating your organization-level JSON Schema tools, remember that the change will affect all the places you’ve previously linked the tool. Be careful when making updates to not inadvertently change something you didn’t intend.