Spaces:
Sleeping
Sleeping
System
Browse files- agent.py +2 -5
- app.py +4 -1
- requirements.txt +2 -1
agent.py
CHANGED
@@ -18,9 +18,6 @@ from tools import (
|
|
18 |
)
|
19 |
|
20 |
# βββββββββββββββββββββββββββ Configuration βββββββββββββββββββββββββββββββ
|
21 |
-
SYSTEM_PROMPT = """
|
22 |
-
You are a general AI assistant. I will ask you a question. Don't report your thoughts, and finish your answer with the following template: FINAL ANSWER: [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 above rules depending of whether the element to be put in the list is a number or a string.
|
23 |
-
"""
|
24 |
MAX_TOOL_CALLS = 5
|
25 |
|
26 |
|
@@ -47,7 +44,7 @@ def build_graph():
|
|
47 |
analyze_code_tool
|
48 |
]
|
49 |
|
50 |
-
# Create the react agent
|
51 |
-
agent = create_react_agent(model=llm, tools=llm_tools
|
52 |
|
53 |
return agent
|
|
|
18 |
)
|
19 |
|
20 |
# βββββββββββββββββββββββββββ Configuration βββββββββββββββββββββββββββββββ
|
|
|
|
|
|
|
21 |
MAX_TOOL_CALLS = 5
|
22 |
|
23 |
|
|
|
44 |
analyze_code_tool
|
45 |
]
|
46 |
|
47 |
+
# Create the react agent - it will use the system prompt from the messages
|
48 |
+
agent = create_react_agent(model=llm, tools=llm_tools)
|
49 |
|
50 |
return agent
|
app.py
CHANGED
@@ -14,6 +14,8 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
14 |
|
15 |
SYSTEM_PROMPT = """
|
16 |
You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [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 above rules depending of whether the element to be put in the list is a number or a string.
|
|
|
|
|
17 |
"""
|
18 |
|
19 |
|
@@ -31,7 +33,8 @@ class BasicAgent:
|
|
31 |
"messages": [
|
32 |
SystemMessage(content=SYSTEM_PROMPT),
|
33 |
HumanMessage(content=question)
|
34 |
-
]
|
|
|
35 |
}
|
36 |
|
37 |
# IMPORTANT: invoke() returns a **new** state instance (or an AddableValuesDict),
|
|
|
14 |
|
15 |
SYSTEM_PROMPT = """
|
16 |
You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [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 above rules depending of whether the element to be put in the list is a number or a string.
|
17 |
+
|
18 |
+
IMPORTANT: When using tools that require file access (such as audio_transcriber_tool, excel_tool, analyze_code_tool, or image_tool), ALWAYS use the task_id parameter only. Do NOT use any file names mentioned by the user - ignore them completely and only pass the task_id.
|
19 |
"""
|
20 |
|
21 |
|
|
|
33 |
"messages": [
|
34 |
SystemMessage(content=SYSTEM_PROMPT),
|
35 |
HumanMessage(content=question)
|
36 |
+
],
|
37 |
+
"task_id": task_id
|
38 |
}
|
39 |
|
40 |
# IMPORTANT: invoke() returns a **new** state instance (or an AddableValuesDict),
|
requirements.txt
CHANGED
@@ -15,4 +15,5 @@ pytesseract
|
|
15 |
openpyxl
|
16 |
duckduckgo-search
|
17 |
wikipedia
|
18 |
-
arxiv
|
|
|
|
15 |
openpyxl
|
16 |
duckduckgo-search
|
17 |
wikipedia
|
18 |
+
arxiv
|
19 |
+
PyMuPDF
|