Created
May 28, 2025 10:05
-
-
Save eliorc/c064998b43ab746e6ca9e02b58348b93 to your computer and use it in GitHub Desktop.
LLM JSON Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "model": "llm-model-name-goes-here", // Example: "gpt-4-turbo" | |
| "tools": [ | |
| { | |
| "type": "function", | |
| "function": { | |
| "name": "get_weather", | |
| "description": "Get the current weather for a specified location.", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "location": { | |
| "type": "string", | |
| "description": "The city and optionally state/country, e.g., 'London' or 'Paris, France'" | |
| }, | |
| "unit": { | |
| "type": "string", | |
| "enum": ["celsius", "fahrenheit"], | |
| "description": "The temperature unit to use." | |
| } | |
| }, | |
| "required": ["location"] | |
| } | |
| } | |
| } | |
| // You could define other tools here | |
| ], | |
| "messages": [ | |
| { | |
| "role": "system", | |
| "content": "You are a helpful assistant. When asked for the weather, please use the get_weather tool. Default to celsius if no unit is specified by the user." | |
| }, | |
| { | |
| "role": "user", | |
| "content": "What's the weather like in London?" | |
| }, | |
| { | |
| "role": "assistant", | |
| "content": null, | |
| "tool_calls": [ | |
| { | |
| "id": "tool_call_london_weather_123", | |
| "type": "function", | |
| "function": { | |
| "name": "get_weather", | |
| "arguments": "{\"location\": \"London\", \"unit\": \"celsius\"}" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "role": "tool", | |
| "tool_call_id": "tool_call_london_weather_123", | |
| "name": "get_weather", | |
| "content": "{\"temperature\": \"15\", \"unit\": \"celsius\", \"conditions\": \"Cloudy\"}" | |
| }, | |
| { | |
| "role": "assistant", | |
| "content": "The weather in London is 15°C and Cloudy." | |
| }, | |
| { | |
| "role": "user", | |
| "content": "Thanks! And what about Paris, but in Fahrenheit?" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment