Tool calling
Tool Calling is a great way to introduce ShuttleAI into your project seamlessly.
Tool calling gives you the ability to give the model certain information about a function and the model will choose how to use that information to generate a function-ready formatted respnse for you automatically.
shuttle-3
and shuttle-3-mini
, support it even during streaming.What is a Tool?
Currently there is only one type
of tool, a “function”; this is subject to change in the future.
A “function” lets you give certain information of your function and its requiremnts, and then receive a formatted response ready for that function.
How should a Tool look?
Below we have a basic tool utilizing our get_current_weather
function
Lets also make the function that we will call as well:
Now that we have our tools and functions set up, lets make our request:
This will result in something similar to the following:
With this response, we can easily use Python’s built in json
module with import json
and using json.loads(response['choices'][0]['message']['tool_calls']['function']['arguments'])
to get the required properties for your function.
For a full example using Tools, check out Web Access!