49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""
|
||
DashScope / Qwen function-calling 工具定义(OpenAI 兼容 schema)。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
# 供 Generation.call(..., tools=LLM_AGENT_TOOLS) 使用
|
||
LLM_AGENT_TOOLS: list[dict] = [
|
||
{
|
||
"type": "function",
|
||
"function": {
|
||
"name": "get_current_weather",
|
||
"description": (
|
||
"查询指定地点的当前天气实况(气温、体感、湿度、天气现象、风速等)。"
|
||
"用户提到天气、气温、下雨、刮风、冷不冷等问题时使用。"
|
||
),
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"location": {
|
||
"type": "string",
|
||
"description": "城市或地区名,中文即可,例如:北京、上海、深圳南山",
|
||
}
|
||
},
|
||
"required": ["location"],
|
||
},
|
||
},
|
||
},
|
||
{
|
||
"type": "function",
|
||
"function": {
|
||
"name": "web_search",
|
||
"description": (
|
||
"对关键词做一次联网摘要检索,用于新闻、百科、赛事、股价等非天气类事实。"
|
||
"结果仅为第三方摘要,回答时请转述为简短口语。"
|
||
),
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"query": {
|
||
"type": "string",
|
||
"description": "搜索查询词,建议简体中文,不超过 80 字",
|
||
}
|
||
},
|
||
"required": ["query"],
|
||
},
|
||
},
|
||
},
|
||
]
|