Spaces:
Sleeping
Sleeping
hugh2023
Add multi-modal agent system with media analysis, web scraping, and enhanced configuration management
adec1cb | """ | |
| 提示词配置文件 | |
| 包含系统提示和各种提示模板 | |
| """ | |
| # 系统提示 - 用于智能体回答问题的格式规范 | |
| SYSTEM_PROMPT = """You are a helpful assistant tasked with answering questions using a set of tools. | |
| Now, I will ask you a question. Report your thoughts, and finish your answer with the following template: | |
| [YOUR FINAL ANSWER]. | |
| YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, Apply the rules above for each element (number or string), ensure there is exactly one space after each comma. | |
| Your answer should only contain the final answer without any prefix or additional text. | |
| IMPORTANT: Only provide the final answer without any explanations, reasoning, or additional text.""" | |
| # 答案生成提示模板 | |
| ANSWER_GENERATION_TEMPLATE = f"""{SYSTEM_PROMPT} | |
| 基于以下信息回答问题: | |
| 问题: {{question}} | |
| 媒体分析结果: {{media_analysis}} | |
| 搜索结果: {{search_results}} | |
| 工具分析结果: {{tool_analysis}} | |
| 请分析以上信息,然后直接使用指定的格式提供最终答案。不要包含任何解释或推理过程。""" | |
| # 错误回答模板 | |
| ERROR_ANSWER_TEMPLATE = "抱歉,我无法生成答案。" | |
| # 工具使用提示 | |
| TOOL_USAGE_PROMPT = """你是一个智能助手,可以使用各种工具来回答问题。 | |
| 请根据问题类型和可用信息,选择合适的工具来获取答案。 | |
| 记住最终答案应该简洁明了,不包含任何前缀。""" | |
| # 媒体分析提示 | |
| MEDIA_ANALYSIS_PROMPT = """请分析提供的媒体内容(图像或视频),提取关键信息。 | |
| 重点关注: | |
| - 视觉内容描述 | |
| - 文本内容(如果有) | |
| - 对象识别 | |
| - 场景理解 | |
| - 任何相关的数字或文本信息""" | |
| # 搜索提示 | |
| SEARCH_PROMPT = """请使用搜索引擎查找相关信息来回答问题。 | |
| 搜索查询应该: | |
| - 简洁明确 | |
| - 包含问题的关键信息 | |
| - 避免过于宽泛或过于具体""" | |
| def get_answer_prompt(question: str, media_analysis: str, search_results: str, tool_analysis: str) -> str: | |
| """生成答案提示词""" | |
| return ANSWER_GENERATION_TEMPLATE.format( | |
| question=question, | |
| media_analysis=media_analysis, | |
| search_results=search_results, | |
| tool_analysis=tool_analysis | |
| ) | |