Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,7 +122,10 @@ def wikipedia_tool(query: str) -> str:
|
|
| 122 |
return formatted_search_docs
|
| 123 |
except Exception as e:
|
| 124 |
return f"Wikipedia search error: {e}"
|
|
|
|
| 125 |
|
|
|
|
|
|
|
| 126 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 127 |
|
| 128 |
|
|
@@ -132,20 +135,11 @@ class BasicAgent:
|
|
| 132 |
def __init__(self):
|
| 133 |
print("BasicAgent initialized.")
|
| 134 |
token=os.environ["OPENROUTER_API_KEY"]
|
| 135 |
-
self.system_prompt= """You are a helpful assistant.
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
Your final answer should be in the following format:
|
| 141 |
-
"your answer here".
|
| 142 |
-
|
| 143 |
-
If you are asked question related to numbers,return the answer in numeric format.
|
| 144 |
-
If you want more details about a topic,person, you can use the wikipedia tool.
|
| 145 |
-
If you want to perform web search to find the answer, use the web_search tool.
|
| 146 |
-
If you are given a task to create an image, you can use the image_generation_tool.
|
| 147 |
-
|
| 148 |
-
Answer only what is asked, do not add any additional information.
|
| 149 |
|
| 150 |
"""
|
| 151 |
|
|
@@ -155,7 +149,7 @@ class BasicAgent:
|
|
| 155 |
provider="auto" # Use openrouter as the provider
|
| 156 |
)
|
| 157 |
self.agent= CodeAgent(
|
| 158 |
-
tools = [add, subtract, multiply, divide, web_search, image_generation_tool
|
| 159 |
model=model,
|
| 160 |
)
|
| 161 |
def __call__(self, question: str, context: str = "") -> str:
|
|
|
|
| 122 |
return formatted_search_docs
|
| 123 |
except Exception as e:
|
| 124 |
return f"Wikipedia search error: {e}"
|
| 125 |
+
|
| 126 |
|
| 127 |
+
|
| 128 |
+
|
| 129 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 130 |
|
| 131 |
|
|
|
|
| 135 |
def __init__(self):
|
| 136 |
print("BasicAgent initialized.")
|
| 137 |
token=os.environ["OPENROUTER_API_KEY"]
|
| 138 |
+
self.system_prompt= """You are a helpful assistant tasked with answering questions using a set of tools.
|
| 139 |
+
Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
|
| 140 |
+
FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 141 |
+
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.
|
| 142 |
+
Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
"""
|
| 145 |
|
|
|
|
| 149 |
provider="auto" # Use openrouter as the provider
|
| 150 |
)
|
| 151 |
self.agent= CodeAgent(
|
| 152 |
+
tools = [add, subtract, multiply, divide, web_search, image_generation_tool],
|
| 153 |
model=model,
|
| 154 |
)
|
| 155 |
def __call__(self, question: str, context: str = "") -> str:
|