Skip to content

Instantly share code, notes, and snippets.

@lukehinds
Created September 27, 2025 08:52
Show Gist options
  • Select an option

  • Save lukehinds/dbc5f858081f8130a0a7c92342eee83c to your computer and use it in GitHub Desktop.

Select an option

Save lukehinds/dbc5f858081f8130a0a7c92342eee83c to your computer and use it in GitHub Desktop.
{
"messages": [
{
"role": "system",
"content": "You are a function calling AI model. You are provided with function signatures\nwithin <tools></tools> XML tags. You may call one or more functions to assist\nwith the user query. For each function call return a json object with function\nname and arguments within <tool_call></tool_call> XML tags.\n\n\nHere are the available tools:\n<tools>\n[\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_weather\",\n \"description\": \"Get current weather conditions for a location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"str\",\n \"description\": \"City name or location (e.g., 'Paris', 'New York')\"\n },\n \"time\": {\n \"type\": \"str\",\n \"description\": \"Time period for weather data\"\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"search_web\",\n \"description\": \"Search the web for information\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"query\": {\n \"type\": \"str\",\n \"description\": \"Search query terms\"\n },\n \"limit\": {\n \"type\": \"int\",\n \"description\": \"Maximum number of results to return\"\n }\n },\n \"required\": [\n \"query\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"calculate\",\n \"description\": \"Evaluate mathematical expressions\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"expression\": {\n \"type\": \"str\",\n \"description\": \"Mathematical expression to evaluate (e.g., '2 + 2', 'sin(pi/2)')\"\n }\n },\n \"required\": [\n \"expression\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_time\",\n \"description\": \"Get current time for a timezone\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone\": {\n \"type\": \"str\",\n \"description\": \"Timezone name (e.g., 'UTC', 'America/New_York')\"\n }\n },\n \"required\": []\n }\n }\n }\n]\n</tools>"
},
{
"role": "user",
"content": "What is the weather in London tomorrow and what is the probability of rain?"
},
{
"role": "assistant",
"content": "<think>Analysis: The user is asking for weather information for a specific location and time, and also wants to know the probability of rain. The `get_weather` tool is the most appropriate for this task. I need to specify the location as 'London' and the time as 'tomorrow'. I will then extract the temperature, conditions, and precipitation chance from the tool's output.\n\nStep-by-step reasoning:\n\nStep 1: The user is asking for weather information for a specific location ('London') and a specific time ('tomorrow'). They are also asking for the probability of rain. The `get_weather` tool is designed for this purpose. → Call `get_weather` tool.\n\nStep 2: The `get_weather` tool requires a 'location' and optionally a 'time'. I will set the 'location' to 'London' as specified by the user. For the 'time', the user asked for 'tomorrow'. I need to determine what 'tomorrow' translates to in a format the tool can understand. Assuming the tool can interpret relative dates like 'tomorrow', I will use that. If not, I might need to use `get_time` first to get today's date and then calculate tomorrow's date. → Set `location` to 'London' and `time` to 'tomorrow'.\n\nStep 3: After calling the `get_weather` tool with the determined parameters, I need to parse the output to find the relevant information: temperature, conditions, and precipitation chance. The user specifically asked for the probability of rain, which should be available in the precipitation chance data. → Parse the output of the `get_weather` tool.\n\nTool selection: The `get_weather` tool is selected because the user's query is directly about weather conditions (temperature, rain probability) for a specific location and time.\n\nParameters: The `location` parameter is set to 'London' based on the explicit mention in the user's question. The `time` parameter is set to 'tomorrow' as requested by the user. It's assumed the `get_weather` tool can interpret 'tomorrow' relative to the current date.</think><tool_call>\n{\"name\": \"get_weather\", \"arguments\": {\"location\": \"London\", \"time\": \"tomorrow\"}}\n</tool_call>"
},
{
"role": "tool",
"content": "<tool_response>\n{\"temperature\": \"15°C\", \"conditions\": \"Partly Cloudy\", \"precipitation_chance\": \"20%\"}\n</tool_response>"
},
{
"role": "assistant",
"content": "The tool output contains weather data for London tomorrow. I need to extract the 'temperature', 'conditions', and 'precipitation_chance' to answer the user's question. The 'precipitation_chance' will directly address the probability of rain.\n\nThe weather in London tomorrow will be partly cloudy with a temperature of 15°C. There is a 20% chance of rain."
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment