astock-agent/backend/app/llm/tools.py
2026-04-30 23:29:52 +08:00

200 lines
6.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""LLM Function Calling 工具定义
定义 Chat Agent 可使用的工具 schemaOpenAI function calling 格式)。
"""
CHAT_TOOLS = [
{
"type": "function",
"function": {
"name": "get_strategy_board",
"description": "获取今日作战结论,包括市场状态、今日打法、建议仓位、重点板块和规避规则",
"parameters": {
"type": "object",
"properties": {},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_market_temperature",
"description": "获取当前市场温度数据,包括涨跌家数、涨停数、连板高度、炸板率等市场情绪指标",
"parameters": {
"type": "object",
"properties": {},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_hot_sectors",
"description": "获取当前热门板块排名,包括板块涨跌幅、资金流入、涨停数、热度评分",
"parameters": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "返回板块数量,默认 10",
},
},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_latest_recommendations",
"description": "获取最新的股票推荐列表,包括综合评分、各维度得分、买卖信号、参考价格",
"parameters": {
"type": "object",
"properties": {},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_user_watchlist_snapshot",
"description": "获取当前用户自选股概览,包括分组、最新结论、建议、触发条件和摘要",
"parameters": {
"type": "object",
"properties": {},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_stock_kline",
"description": "获取个股K线数据含技术指标 MA/MACD/RSI/BOLL用于分析个股走势",
"parameters": {
"type": "object",
"properties": {
"ts_code": {
"type": "string",
"description": "股票代码,如 '000001.SZ'",
},
"days": {
"type": "integer",
"description": "获取天数,默认 60",
},
},
"required": ["ts_code"],
},
},
},
{
"type": "function",
"function": {
"name": "get_stock_capital_flow",
"description": "获取个股资金流向数据,包括主力净流入金额",
"parameters": {
"type": "object",
"properties": {
"ts_code": {
"type": "string",
"description": "股票代码,如 '000001.SZ'",
},
"days": {
"type": "integer",
"description": "获取天数,默认 10",
},
},
"required": ["ts_code"],
},
},
},
{
"type": "function",
"function": {
"name": "search_stock",
"description": "通过名称或代码模糊搜索股票",
"parameters": {
"type": "object",
"properties": {
"keyword": {
"type": "string",
"description": "搜索关键词(股票名称或代码)",
},
},
"required": ["keyword"],
},
},
},
{
"type": "function",
"function": {
"name": "get_stock_technical_signal",
"description": "获取个股技术面信号详情包括均线排列、MACD状态、RSI、布林带位置、量价关系、支撑压力位、位置安全评估",
"parameters": {
"type": "object",
"properties": {
"ts_code": {
"type": "string",
"description": "股票代码,如 '000001.SZ'",
},
},
"required": ["ts_code"],
},
},
},
{
"type": "function",
"function": {
"name": "diagnose_stock",
"description": "对单只 A 股做系统化个股会诊融合今日作战结论、推荐池、板块、K线、资金流和技术信号输出结论、触发条件、失效条件和风险边界",
"parameters": {
"type": "object",
"properties": {
"ts_code": {
"type": "string",
"description": "股票代码,如 '000001.SZ'。如果用户只给名称,应先调用 search_stock 找到 ts_code",
},
"mode": {
"type": "string",
"enum": ["entry", "holding", "review", "tracking"],
"description": "诊断模式entry 建仓前holding 持仓复核review 回撤复盘tracking 继续跟踪。默认 entry",
},
},
"required": ["ts_code"],
},
},
},
{
"type": "function",
"function": {
"name": "get_sector_performance",
"description": "获取板块近期涨跌表现、资金流入、涨停数等综合数据,用于判断板块强弱和轮动方向",
"parameters": {
"type": "object",
"properties": {
"sector_name": {
"type": "string",
"description": "板块名称关键词,如 '半导体''新能源'",
},
},
"required": ["sector_name"],
},
},
},
{
"type": "function",
"function": {
"name": "get_realtime_indices",
"description": "获取指数实时行情数据,包括上证指数、深证成指、创业板指的实时涨跌幅和成交数据。盘中时段返回实时数据,盘后返回当日收盘数据",
"parameters": {
"type": "object",
"properties": {},
"required": [],
},
},
},
]