Spaces:
Sleeping
Sleeping
Upload agent.py
Browse files
agent.py
CHANGED
|
@@ -21,7 +21,7 @@ def web_search(query: str) -> str:
|
|
| 21 |
search_docs = TavilySearchResults(max_results=3).invoke(input=query)
|
| 22 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 23 |
[
|
| 24 |
-
f'<Document source="{doc["title"]}" page="{doc.get("url", "")}"/>\n{doc[
|
| 25 |
for doc in search_docs
|
| 26 |
])
|
| 27 |
return {"web_results": formatted_search_docs}
|
|
@@ -137,7 +137,7 @@ def build_graph():
|
|
| 137 |
|
| 138 |
if __name__=="__main__":
|
| 139 |
system_prompt = "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."
|
| 140 |
-
question = "whats 2 +
|
| 141 |
question = f"{system_prompt} \
|
| 142 |
The question: \
|
| 143 |
{question} \
|
|
|
|
| 21 |
search_docs = TavilySearchResults(max_results=3).invoke(input=query)
|
| 22 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 23 |
[
|
| 24 |
+
f'<Document source="{doc["title"]}" page="{doc.get("url", "")}"/>\n{doc["content"]}\n</Document>'
|
| 25 |
for doc in search_docs
|
| 26 |
])
|
| 27 |
return {"web_results": formatted_search_docs}
|
|
|
|
| 137 |
|
| 138 |
if __name__=="__main__":
|
| 139 |
system_prompt = "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."
|
| 140 |
+
question = "whats 2 + 30?"
|
| 141 |
question = f"{system_prompt} \
|
| 142 |
The question: \
|
| 143 |
{question} \
|