kirbah commited on
Commit
94b3ee9
·
1 Parent(s): 65061e7

Add comments for LLM proxy usage and enhance task instructions

Browse files
Files changed (1) hide show
  1. basic_agent.py +22 -14
basic_agent.py CHANGED
@@ -56,6 +56,7 @@ class BasicAgent:
56
  api_key=os.getenv("GROQ_API_KEY")
57
  )
58
 
 
59
  model = LiteLLMModel(
60
  model_id="groq/deepseek-r1-distill-llama-70b",
61
  api_base="http://127.0.0.1:4000"
@@ -95,22 +96,29 @@ class BasicAgent:
95
  Your primary goal is to accurately and concisely answer the provided question using your available tools and any supplied information.
96
 
97
  Key Instructions:
98
- 1. **Understand the Task**: Carefully read the entire question. Crucially, examine the "File Information" section that follows the question. This section will state if a local file is available for this task and provide its exact path if so.
99
- 2. **Select Tools Strategically**:
100
- * Choose the best tool(s) based on the question and any file details. Tool descriptions will help guide your choice.
101
- * For web research, use search tools. Use `VisitWebpageTool` for exploring specific URLs.
102
- * **Working with Local Files**: If the "File Information" section provides a local file path:
103
- * You **MUST** use the `PythonInterpreterTool` if the file's content is needed to answer the question.
104
- * Your Python code for the tool should open this file using the full, exact local path given in "File Information". Then, read, process, or execute its content as appropriate.
105
- * For general calculations, data analysis (not from a local file mentioned in "File Information"), or other Python tasks, use `PythonInterpreterTool`.
106
- 3. **Verify and Combine Information**:
107
- * If multiple steps or tools are used, synthesize the information.
108
- * Always evaluate information for accuracy and direct relevance to the question asked.
109
- * Base your final answer *only* on the information you have gathered.
110
- 4. **Formulate Your Response**:
 
 
 
 
 
 
 
111
  * Provide only the final, concise answer to the question.
112
  * Do not include your reasoning steps, apologies, self-correction narratives, or any conversational filler in the final answer.
113
- * If, after a thorough investigation with all relevant tools, you cannot determine a definitive answer, respond with the exact phrase 'I don't know'.
114
 
115
  --- Start of Question & File Information ---
116
  {question_to_llm}
 
56
  api_key=os.getenv("GROQ_API_KEY")
57
  )
58
 
59
+ # use LLM proxy server to avoid rate limits issues
60
  model = LiteLLMModel(
61
  model_id="groq/deepseek-r1-distill-llama-70b",
62
  api_base="http://127.0.0.1:4000"
 
96
  Your primary goal is to accurately and concisely answer the provided question using your available tools and any supplied information.
97
 
98
  Key Instructions:
99
+ 1. **Understand the Task**: Carefully read the entire question. Pay close attention to the "File Information" section provided below the question; it states if a local file is available and its path.
100
+ 2. **Strategize and Select Tools**:
101
+ * Choose the most appropriate tool(s) based on the question, file details, and tool capabilities.
102
+ * For web research, use `web_search` or `wikipedia_search`. Use `visit_webpage` to get content from specific URLs found or given.
103
+ * **Working with Local Files**: If the "File Information" section provides a local file path *and that file's content is needed*:
104
+ * The primary tool to access this local file is the `PythonInterpreterTool`.
105
+ * Generate Python code for this tool to open the file (using its full, exact local path from "File Information"), then read, process, or execute its content as required.
106
+ * For general calculations, data analysis not involving a mentioned local file, or other Python tasks, use `PythonInterpreterTool`.
107
+ 3. **Information Analysis & Verification**:
108
+ * When examining content from web pages or files, critically evaluate the information.
109
+ * **Pay specific attention to details like names, dates, and roles (e.g., distinguish between a nominator, a promoter, an author, etc.).**
110
+ * Synthesize information from multiple steps or tools if necessary.
111
+ * Base your final answer *only* on confirmed facts from the information gathered. Do not make assumptions.
112
+ 4. **Handling Tool Errors**:
113
+ * If a tool call results in an error (e.g., PythonInterpreterTool syntax error, file not found by a tool):
114
+ a. **Analyze the error message.**
115
+ b. **Do not immediately retry the exact same tool call with the exact same arguments.**
116
+ c. Instead, try to **correct the input to the tool** (e.g., fix the Python code, verify a URL or file path).
117
+ d. If correction isn't obvious or fails, consider if a different tool or a different approach is more suitable.
118
+ 5. **Formulate Your Response**:
119
  * Provide only the final, concise answer to the question.
120
  * Do not include your reasoning steps, apologies, self-correction narratives, or any conversational filler in the final answer.
121
+ * If, after a thorough investigation and attempts to use tools effectively (including handling errors), you cannot determine a definitive answer, respond with the exact phrase 'I don't know'.
122
 
123
  --- Start of Question & File Information ---
124
  {question_to_llm}