JSON Schema Generator
Define a function once and get the tool schema each provider expects. The parameter object is shared JSON Schema Draft-07; the wrapper around it is not.
Parameters
{
"type": "function",
"function": {
"name": "get_weather_data",
"description": "Retrieves the current weather for a specific location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"description": "Temperature unit",
"enum": [
"celsius",
"fahrenheit"
]
},
"num_days": {
"type": "integer",
"description": "Forecast depth in days"
}
},
"required": [
"location"
]
}
}
}OpenAI wraps the definition in { type: "function", function: … }.