GoodLuckChuck commited on
Commit
b10a50b
·
verified ·
1 Parent(s): d0370bd

updated agent prompt

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -63,10 +63,10 @@ class AppConfig:
63
  QUESTIONS_URL_PATH = "/questions"
64
  SUBMIT_URL_PATH = "/submit"
65
  SCREENSHOTS_DIR = "screenshots" # Currently not used, but kept for consistency
66
- OPENAI_MODEL_ID = "gpt-4.1" # Using a newer model, ensure API key has access
67
  SERPER_API_NUM_RESULTS = 3
68
  WEB_SEARCH_MAX_OUTPUT_LENGTH = 3000
69
- AGENT_MAX_STEPS = 10 # Increased max steps slightly
70
  AGENT_VERBOSITY_LEVEL = 2 # 0: silent, 1: info, 2: debug
71
 
72
  AGENT_SYSTEM_PROMPT = """You are a highly intelligent and meticulous AI assistant. Your primary goal is to answer the user's question accurately and concisely.
@@ -93,32 +93,32 @@ Follow this process for every question:
93
  6. If you have the information, formulate the final answer according to the formatting rules.
94
 
95
  CRITICAL FINAL ANSWER INSTRUCTIONS:
96
- Your entire response, after all thoughts and tool use, MUST end with the final answer.
97
- This final answer MUST be on its own new line and MUST start with the exact phrase "FINAL ANSWER: " (note the space after the colon).
98
- Only the answer itself should follow this prefix. Do NOT include any of your thought process, conversational text, or additional explanations after the "FINAL ANSWER: " prefix.
99
 
100
- Example of a full agent response structure:
101
- THOUGHT: I need to find the capital of France.
102
  CODE:
103
  ```python
104
- search_result = await web_search(query="capital of France", provider="serpapi")
105
- print(search_result)
106
  ```<end_code>
107
  OBSERVATION: Title: Paris - Wikipedia Snippet: Paris is the capital and most populous city of France...
108
- THOUGHT: The capital of France is Paris. I have sufficient information and will provide this as the final answer, following the formatting rules for a string.
109
  FINAL ANSWER: Paris
110
 
111
  Another Example (for a question "what is the opposite of left?"):
112
- THOUGHT: The question asks for the opposite of the word "left". This is general knowledge and does not require a tool. The opposite of "left" is "right".
113
  FINAL ANSWER: right
114
 
115
- Formatting rules for the value *after* "FINAL ANSWER: ":
116
  - If the question asks for a number: Provide only the number itself (e.g., `FINAL ANSWER: 42`). Do not use commas for thousands separation (e.g., use `FINAL ANSWER: 1234` not `FINAL ANSWER: 1,234`). Do not include units like '$' or '%' unless the question specifically asks for it and it's part of the answer.
117
  - If the question asks for a string: Provide the most concise string possible (e.g., `FINAL ANSWER: right`). Avoid articles (a, an, the) unless grammatically essential. Avoid common abbreviations (e.g., for cities like "NYC" for "New York City") unless the question implies it. Write out numerical digits as words (e.g., `FINAL ANSWER: two` instead of `FINAL ANSWER: 2`) unless numerical digits are requested.
118
  - If the question asks for a comma-separated list: Apply the above string/number rules to each element. Ensure elements are separated ONLY by a comma (e.g., `FINAL ANSWER: item one,item two,three`). NO space after the comma unless it's part of the item itself.
119
  - If the answer is a calculation result, provide just the number (e.g., `FINAL ANSWER: 10`).
120
 
121
- Remember, the "FINAL ANSWER: " prefix is a literal string you must output, followed by the actual answer. Do not try to call a function named `final_answer`. Your response stops after the value following "FINAL ANSWER: ".
122
  """
123
 
124
  CONFIG = AppConfig()
 
63
  QUESTIONS_URL_PATH = "/questions"
64
  SUBMIT_URL_PATH = "/submit"
65
  SCREENSHOTS_DIR = "screenshots" # Currently not used, but kept for consistency
66
+ OPENAI_MODEL_ID = "gpt-4o"
67
  SERPER_API_NUM_RESULTS = 3
68
  WEB_SEARCH_MAX_OUTPUT_LENGTH = 3000
69
+ AGENT_MAX_STEPS = 10
70
  AGENT_VERBOSITY_LEVEL = 2 # 0: silent, 1: info, 2: debug
71
 
72
  AGENT_SYSTEM_PROMPT = """You are a highly intelligent and meticulous AI assistant. Your primary goal is to answer the user's question accurately and concisely.
 
93
  6. If you have the information, formulate the final answer according to the formatting rules.
94
 
95
  CRITICAL FINAL ANSWER INSTRUCTIONS:
96
+ Your *entire response text*, after all thoughts and tool use, MUST CULMINATE in the final answer.
97
+ This final answer MUST be on its own new line and MUST start with the exact literal string "FINAL ANSWER: " (note the space after the colon).
98
+ Only the answer value itself should follow this "FINAL ANSWER: " prefix. Do NOT include any of your thought process, conversational text, or additional explanations *after* this "FINAL ANSWER: " prefix and its value. Your response effectively stops there.
99
 
100
+ Example of a full agent response structure (what you should output):
101
+ THOUGHT: The user is asking for the capital of France. I should use web_search to find this.
102
  CODE:
103
  ```python
104
+ search_results = await web_search(query="capital of France", provider="serpapi")
105
+ print(search_results)
106
  ```<end_code>
107
  OBSERVATION: Title: Paris - Wikipedia Snippet: Paris is the capital and most populous city of France...
108
+ THOUGHT: The search result clearly states that Paris is the capital of France. I have sufficient information. I will provide this as the final answer, following the formatting rules for a string.
109
  FINAL ANSWER: Paris
110
 
111
  Another Example (for a question "what is the opposite of left?"):
112
+ THOUGHT: The question asks for the opposite of the word "left". This is general knowledge and does not require a tool. The opposite of "left" is "right". I will provide this as the final answer.
113
  FINAL ANSWER: right
114
 
115
+ Formatting rules for the value that comes *after* "FINAL ANSWER: ":
116
  - If the question asks for a number: Provide only the number itself (e.g., `FINAL ANSWER: 42`). Do not use commas for thousands separation (e.g., use `FINAL ANSWER: 1234` not `FINAL ANSWER: 1,234`). Do not include units like '$' or '%' unless the question specifically asks for it and it's part of the answer.
117
  - If the question asks for a string: Provide the most concise string possible (e.g., `FINAL ANSWER: right`). Avoid articles (a, an, the) unless grammatically essential. Avoid common abbreviations (e.g., for cities like "NYC" for "New York City") unless the question implies it. Write out numerical digits as words (e.g., `FINAL ANSWER: two` instead of `FINAL ANSWER: 2`) unless numerical digits are requested.
118
  - If the question asks for a comma-separated list: Apply the above string/number rules to each element. Ensure elements are separated ONLY by a comma (e.g., `FINAL ANSWER: item one,item two,three`). NO space after the comma unless it's part of the item itself.
119
  - If the answer is a calculation result, provide just the number (e.g., `FINAL ANSWER: 10`).
120
 
121
+ Remember, the "FINAL ANSWER: " prefix is a literal string you must output as the very last part of your response, followed by the actual answer value. Do not confuse this with any internal `final_answer()` function you might use in your generated code; this is about the final textual output of your entire turn.
122
  """
123
 
124
  CONFIG = AppConfig()