1. 天气查询工具声明
AI 应用开发者背景
正在开发一个支持切换多模型后端的智能助手,需要定义一个获取城市天气和多天预报的通用函数。
问题
手动编写 OpenAI、Claude 和 Gemini 三种不同结构的 JSON Schema 耗时且容易出现类型大小写与结构错误。
如何使用
输入工具名 `get_weather`,填写描述,并在参数框输入城市名称、温度单位枚举及预报天数三行 DSL,选择启用严格模式并生成。
toolName: get_weather
toolDescription: Get the current weather for a city. Use when the user asks about temperature, conditions, or whether it will rain today.
paramsInput:
city | string | required | City name, e.g. "Paris"
units | enum<celsius,fahrenheit> | optional | Temperature unit for the report
forecast_days | integer | optional | Days of forecast to include (1-7)
strictMode: true
toolChoice: auto结果
直接获取 OpenAI(含 strict 标记)、Anthropic(input_schema)和 Gemini(大写 OBJECT 类型声明)三份 Payload 代码,即拷即用。