mahadewa commited on
Commit
b02ca9a
·
verified ·
1 Parent(s): 558b71f

Update base_agent.py

Browse files
Files changed (1) hide show
  1. base_agent.py +17 -23
base_agent.py CHANGED
@@ -59,28 +59,22 @@ class BaseAgent:
59
  print(f"Error calling LLM: {str(e)}")
60
  return f"Error: {str(e)}"
61
 
62
- @staticmethod
63
- def extract_final_answer(text: str) -> str:
64
- """
65
- Extract the final answer from potentially verbose LLM output.
66
-
67
- Args:
68
- text: The full text from the LLM
69
-
70
- Returns:
71
- The extracted answer, removing any explanation
72
- """
73
- # Look for explicit markers
74
- markers = ["Final Answer:", "Answer:", "Therefore, the answer is"]
75
- for marker in markers:
76
- if marker in text:
77
- parts = text.split(marker, 1)
78
- if len(parts) > 1:
79
- return parts[1].strip()
80
 
81
- # If no markers, return the last non-empty line
82
- lines = [line.strip() for line in text.splitlines() if line.strip()]
83
- if lines:
84
- return lines[-1]
 
 
 
 
 
85
 
86
- return text.strip()
 
 
 
 
 
 
 
59
  print(f"Error calling LLM: {str(e)}")
60
  return f"Error: {str(e)}"
61
 
62
+ def ask_james(question) -> str:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ system_prompt = """
65
+ You are a general AI Assistant.
66
+ You must provide only the exact answer requested by the user, in the correct type and minimal format, based purely on the provided information.
67
+
68
+ YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
69
+ 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.
70
+ 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.
71
+ 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.
72
+ If you cannot find the answer based on the provided information, reply only with "Unknown".
73
 
74
+ You must not explain your answer, restate the question, or add any commentary.
75
+
76
+ Output must be a single line, without punctuation or extra whitespace.
77
+ """
78
+ final_answer = self.llm_call(system_prompt, question, temperature=0.0)
79
+
80
+ return final_answer