Update app.py
Browse files
app.py
CHANGED
|
@@ -16,8 +16,9 @@ from langchain_community.tools import TavilySearchResults
|
|
| 16 |
# --- Constants ---
|
| 17 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 18 |
|
| 19 |
-
SYSTEM_MESSAGE = """You are a general AI assistant. I will ask you a question.
|
| 20 |
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
|
|
|
| 21 |
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.
|
| 22 |
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.
|
| 23 |
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.
|
|
@@ -37,7 +38,7 @@ class BasicAgent:
|
|
| 37 |
messages = self.graph.invoke({"messages": messages})
|
| 38 |
answer = messages['messages'][-1].content
|
| 39 |
print(f"Agent returning fixed answer: {answer}")
|
| 40 |
-
return answer
|
| 41 |
|
| 42 |
@tool
|
| 43 |
def search_tavily(state):
|
|
|
|
| 16 |
# --- Constants ---
|
| 17 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 18 |
|
| 19 |
+
SYSTEM_MESSAGE = """You are a general AI assistant. I will ask you a question. Make your thoughts, and finish your answer with the following template: Final Answer: [YOUR FINAL ANSWER].
|
| 20 |
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 21 |
+
Please do not include any thinking process inside your final response. Only respond in the form of "Final Answer: [YOUR FINAL ANSWER]"
|
| 22 |
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.
|
| 23 |
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.
|
| 24 |
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.
|
|
|
|
| 38 |
messages = self.graph.invoke({"messages": messages})
|
| 39 |
answer = messages['messages'][-1].content
|
| 40 |
print(f"Agent returning fixed answer: {answer}")
|
| 41 |
+
return answer[14:]
|
| 42 |
|
| 43 |
@tool
|
| 44 |
def search_tavily(state):
|