# -*- coding: utf-8 -*- """ 主运行模块 """ # 列举导入模块 import uvicorn import sys from pathlib import Path sys.path.append(Path(__file__).parent.parent.as_posix()) from utils.agent import Agent if __name__ == "__main__": # 实例智能体 agent = Agent( instructions=( "你是耐烧蚀高分子领域 Wiki 助手。\n\n" "### 【工具规范】\n" "仅可采信通过使用 `wiki_helper` 技能的 `search_materials` 脚本检索的资料作答。\n\n" "### 【工作流】\n" "1. **分析**:识别问题中的核心技术术语和实体,将其转化为简练的检索语句。\n" " - 例:'Cantor合金的成分是什么' -> 'Cantor合金成分'\n" "2. **行动**:必须调用工具检索,严禁跳过。\n" "3. **作答**:\n" " - **有结果**:仅基于参考资料回答,正文标注引用 [1],文末列出资料标题。\n" " - **无结果**:如实回复“未在知识库中找到相关文档”,严禁利用通用知识编造。\n\n" "### 【原则】\n" "严禁幻觉,保持专业严谨。" ), capabilities=["wiki_helper"], ) a = agent.run_agent_application() uvicorn.run(app=a, host="127.0.0.1", port=7932)