Spaces:
Sleeping
Sleeping
Change prompt
Browse files- app.py +13 -1
- prompt.txt +17 -0
app.py
CHANGED
@@ -9,6 +9,18 @@ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, OpenAIServer
|
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# --- Basic Agent Definition ---
|
14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
@@ -28,7 +40,7 @@ class BasicAgent:
|
|
28 |
print("BasicAgent initialized.")
|
29 |
def __call__(self, question: str) -> str:
|
30 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
31 |
-
prompt =
|
32 |
fixed_answer = self.agent.run(prompt+"\n\n"+"###Question:\n"+question)
|
33 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
34 |
return fixed_answer
|
|
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
12 |
+
my_prompt = """
|
13 |
+
You are a general AI assistant. When I ask a question, follow these steps:
|
14 |
+
|
15 |
+
1. Show your chain of thought.
|
16 |
+
2. On the last line, provide only the answer itself—no labels or keywords—formatted according to these rules:
|
17 |
+
|
18 |
+
* If it’s a single number, write it without commas or unit symbols (unless I specify otherwise).
|
19 |
+
* If it’s a single word or phrase, use as few words as possible; omit articles and abbreviations; spell out any digits in plain text unless I ask otherwise.
|
20 |
+
* If it’s a list, separate items with commas and apply the above formatting rules to each element.
|
21 |
+
|
22 |
+
Do not include anything like “FINAL ANSWER:” or similar.
|
23 |
+
"""
|
24 |
|
25 |
# --- Basic Agent Definition ---
|
26 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
40 |
print("BasicAgent initialized.")
|
41 |
def __call__(self, question: str) -> str:
|
42 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
43 |
+
prompt = my_prompt
|
44 |
fixed_answer = self.agent.run(prompt+"\n\n"+"###Question:\n"+question)
|
45 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
46 |
return fixed_answer
|
prompt.txt
CHANGED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# بسم الله الرحمن الرحیم
|
2 |
+
|
3 |
+
|
4 |
+
You are a general AI assistant. I will ask you a question. When answering, provide only the requested answer with no explanatory text, formatting, or preamble.. 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.
|
5 |
+
------------------------
|
6 |
+
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.
|
7 |
+
------------------------
|
8 |
+
You are a general AI assistant. When I ask a question, follow these steps:
|
9 |
+
|
10 |
+
1. Show your chain of thought.
|
11 |
+
2. On the last line, provide only the answer itself—no labels or keywords—formatted according to these rules:
|
12 |
+
|
13 |
+
* If it’s a single number, write it without commas or unit symbols (unless I specify otherwise).
|
14 |
+
* If it’s a single word or phrase, use as few words as possible; omit articles and abbreviations; spell out any digits in plain text unless I ask otherwise.
|
15 |
+
* If it’s a list, separate items with commas and apply the above formatting rules to each element.
|
16 |
+
|
17 |
+
Do not include anything like “FINAL ANSWER:” or similar.
|