Srj-ai commited on
Commit
eeba562
·
verified ·
1 Parent(s): b797cf6

updated agent

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -12,26 +12,32 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
  class BasicAgent:
14
  def __init__(self):
15
- print("BasicAgent initialized.")
16
-
17
- HF_TOKEN = os.environ.get("HF_TOKEN")
18
-
19
-
20
  def __call__(self, question: str) -> str:
21
  print(f"Agent received question (first 50 chars): {question[:50]}...")
22
 
23
- promt = """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.
24
- This is the question that you need to answer : {question}"""
25
- self.client = InferenceClient(model= "moonshotai/Kimi-K2.5")
 
 
 
 
 
 
 
 
26
  output = self.client.chat.completions.create(
27
  messages= [
28
  {"role":"User","content":question}
29
  ],
30
  stream= False,
31
- max_tokens= 1024,
32
  extra_body={"thinking":{"type":'disabled'}}
33
  )
34
- return output.choices[0].message.content
35
 
36
  def run_and_submit_all( profile: gr.OAuthProfile | None):
37
  """
 
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
  class BasicAgent:
14
  def __init__(self):
15
+ print("Srj's Agent initialized.")
16
+ self.client = InferenceClient(model= "moonshotai/Kimi-K2.5", token = os.environ.get("HF_TOKEN"))
17
+
 
 
18
  def __call__(self, question: str) -> str:
19
  print(f"Agent received question (first 50 chars): {question[:50]}...")
20
 
21
+ promt = f"""Question: {question}
22
+
23
+ Solve step-by-step internally but respond with ONLY the final answer.
24
+ NO "Final Answer:", NO explanation, NO reasoning.
25
+ Just the exact answer string (number, city name, or short list).
26
+
27
+ Examples:
28
+ Capital of France? → Paris
29
+ 2024 Olympics city? → Paris
30
+ 15 × 3? → 45"""
31
+
32
  output = self.client.chat.completions.create(
33
  messages= [
34
  {"role":"User","content":question}
35
  ],
36
  stream= False,
37
+ max_tokens= 50,
38
  extra_body={"thinking":{"type":'disabled'}}
39
  )
40
+ return output.choices[0].message.content.strip()
41
 
42
  def run_and_submit_all( profile: gr.OAuthProfile | None):
43
  """