Spaces:
Sleeping
Sleeping
Commit
·
75c9b07
1
Parent(s):
ae4a304
prompt change
Browse files
app.py
CHANGED
@@ -290,44 +290,59 @@ tools_list = [
|
|
290 |
tool_descriptions = "\n".join(f"- {tool.name}: {tool.description}" for tool in tools_list)
|
291 |
|
292 |
|
|
|
293 |
## --
|
294 |
# --- System Prompt for the Agent ---
|
|
|
295 |
system_prompt = f"""
|
296 |
-
You are
|
|
|
297 |
|
298 |
{tool_descriptions}
|
299 |
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
-
|
|
|
303 |
|
304 |
-
|
305 |
|
306 |
-
|
307 |
|
308 |
-
|
309 |
-
Your Output: 35
|
310 |
|
311 |
-
|
312 |
-
Your Output: 22
|
313 |
|
314 |
-
|
315 |
-
Your Output: Paris
|
316 |
|
317 |
-
Q:
|
318 |
-
|
319 |
-
Your Output: 2008
|
320 |
|
321 |
-
Q:
|
322 |
-
Your Output:
|
323 |
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
|
332 |
## --- Initialize Hugging Face Model ---
|
333 |
# Generate the chat interface, including the tools
|
|
|
290 |
tool_descriptions = "\n".join(f"- {tool.name}: {tool.description}" for tool in tools_list)
|
291 |
|
292 |
|
293 |
+
|
294 |
## --
|
295 |
# --- System Prompt for the Agent ---
|
296 |
+
|
297 |
system_prompt = f"""
|
298 |
+
You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: [YOUR FINAL ANSWER].
|
299 |
+
You have access to a set of tools that you can use to answer the question:
|
300 |
|
301 |
{tool_descriptions}
|
302 |
|
303 |
+
You must use the tools only if necessary, and you must not use multiple tools in a single call. You should not use a tool if you can answer directly.
|
304 |
+
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
305 |
+
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.
|
306 |
+
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.
|
307 |
+
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.
|
308 |
+
"""
|
309 |
|
310 |
+
# system_prompt = f"""
|
311 |
+
# You are an intelligent assistant with access to the following tools:
|
312 |
|
313 |
+
# {tool_descriptions}
|
314 |
|
315 |
+
# For every question, you must do your internal reasoning using the Thought → Action → Observation → Answer process, but your output to the user should be ONLY the final answer as a single value (number, string, or comma-separated list), with no extra explanation, thoughts, actions, or observations.
|
316 |
|
317 |
+
# **If a tool returns a long text or description (such as from a web scraping tool), you must carefully read and process that output, and extract or identify ONLY the most relevant, concise answer to the user's question, and provide a single string as output. Do not return the full text or irrelevant details.**
|
|
|
318 |
|
319 |
+
# **Your output must be only the answer. Do not include any reasoning, tool calls, or explanations.**
|
|
|
320 |
|
321 |
+
# Examples:
|
|
|
322 |
|
323 |
+
# Q: What is 7 * (3 + 2)?
|
324 |
+
# Your Output: 35
|
|
|
325 |
|
326 |
+
# Q: What’s the weather in Tokyo?
|
327 |
+
# Your Output: 22
|
328 |
|
329 |
+
# Q: What is the capital of France?
|
330 |
+
# Your Output: Paris
|
331 |
+
|
332 |
+
# Q: Which year was python 3.0 released as per the website https://en.wikipedia.org/wiki/Python_(programming_language)?
|
333 |
+
# (Tool returns a long description about Python.)
|
334 |
+
# Your Output: 2008
|
335 |
+
|
336 |
+
# Q: Convert 10 meters to feet.
|
337 |
+
# Your Output: 32.81
|
338 |
+
|
339 |
+
# Instructions:
|
340 |
+
# - Always do your internal reasoning (Thought → Action → Observation → Answer) before producing the answer, but DO NOT show this reasoning to the user.
|
341 |
+
# - Use a tool only if necessary, and don't use multiple tools in a call. Don't use a tool if you can answer directly.
|
342 |
+
# - Your output must be a single value (number, string, or comma-separated list) with no extra explanation or formatting.
|
343 |
+
# - If you cannot answer the question or if you couldn't process the input question just answer as "no_answer".
|
344 |
+
# - Be concise and accurate.
|
345 |
+
# """
|
346 |
|
347 |
## --- Initialize Hugging Face Model ---
|
348 |
# Generate the chat interface, including the tools
|