enable da for doc qa

This commit is contained in:
garylin2099 2024-08-14 14:58:20 +08:00
parent dce5502c07
commit 9963f90c92
5 changed files with 12 additions and 9 deletions

View file

@ -101,8 +101,3 @@ class LLMConfig(YamlModel):
@classmethod
def check_timeout(cls, v):
return v or LLM_API_TIMEOUT
@field_validator("compress_type")
@classmethod
def check_compress_type(cls, v):
return CompressType.get_type(v)

View file

@ -7,7 +7,8 @@ EXTRA_INSTRUCTION = """
- Make sure the command_name are certainly in Available Commands when you use the Browser tool.
- For information searching requirement, you should use the Browser tool instead of web scraping.
- When no link is provided, you should use the Browser tool to search for the information.
7. When you are making plan. It is highly recommend to plan and append all the tasks in first response once time.
7. When you are making plan. It is highly recommend to plan and append all the tasks in first response once time, except for 7.1.
7.1. When the requirement is given with a file, read the file first through either Editor.read (write code instead for excel) WITHOUT a plan. After reading the file content, use RoleZero.reply_to_human if the requirement can be answered straightaway, otherwise, make a plan if further calculation is needed.
8. Don't finish_current_task multiple times for the same task.
9. Finish current task timely, such as when the code is written and executed successfully.
10. When using the command 'end', add the command 'finish_current_task' before it.

View file

@ -26,11 +26,11 @@ from metagpt.tools.tool_registry import register_tool
class DataAnalyst(RoleZero):
name: str = "David"
profile: str = "DataAnalyst"
goal: str = "Take on any data-related tasks, such as data analysis, machine learning, deep learning, web browsing, web scraping, web searching, web deployment, terminal operation, etc."
goal: str = "Take on any data-related tasks, such as data analysis, machine learning, deep learning, web browsing, web scraping, web searching, web deployment, terminal operation, document QA & analysis, etc."
instruction: str = ROLE_INSTRUCTION + EXTRA_INSTRUCTION
task_type_desc: str = TASK_TYPE_DESC
tools: list[str] = ["Plan", "DataAnalyst", "RoleZero", "Browser"]
tools: list[str] = ["Plan", "DataAnalyst", "RoleZero", "Browser", "Editor:write,read"]
custom_tools: list[str] = ["web scraping", "Terminal"]
custom_tool_recommender: ToolRecommender = None
experience_retriever: Annotated[ExpRetriever, Field(exclude=True)] = KeywordExpRetriever()

View file

@ -24,7 +24,10 @@ class FileBlock(BaseModel):
@register_tool()
class Editor(BaseModel):
"""A tool for reading, understanding, writing, and editing files"""
"""
A tool for reading, understanding, writing, and editing files.
Support local file including text-based files (txt, md, json, py, html, js, css, etc.), pdf, docx, excluding images, excel, or online links
"""
model_config = ConfigDict(arbitrary_types_allowed=True)

View file

@ -143,6 +143,10 @@ clone https://github.com/garylin2099/simple_calculator, checkout a new branch na
Commit your changes and push, finally, create a PR to the master branch of https://github.com/mannaandpoem/simple_calculator.
"""
IMAGE2CODE_REQ = "Please write a frontend web page similar to this image /Users/gary/Files/temp/workspace/temp_img.png, I want the same title and color. code only"
DOC_QA_REQ1 = "Tell me what this paper is about /Users/gary/Files/temp/workspace/2308.09687.pdf"
DOC_QA_REQ2 = "Summarize this doc /Users/gary/Files/temp/workspace/2401.14295.pdf"
DOC_QA_REQ3 = "请总结/Users/gary/Files/temp/workspace/2309.04658.pdf里的关键点"
DOC_QA_REQ4 = "这份报表/Users/gary/Files/temp/workspace/9929550.md中营业收入TOP3产品各自的收入占比是多少"
TL_CHAT1 = """Summarize the paper for me""" # expecting clarification
TL_CHAT2 = """Solve the issue at this link""" # expecting clarification