neznib commited on
Commit
f6a0f4a
·
1 Parent(s): c89ee7c
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -12,13 +12,20 @@ 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
  def __call__(self, question: str) -> str:
17
  print(f"Agent received question (first 50 chars): {question[:50]}...")
18
  # fixed_answer = "This is a default answer."
19
  # fixed_answer = r'{"task_id": "task_id_1", "model_answer": "Between 2000 and 2009 (inclusive), Mercedes Sosa published three studio albums: Corazón Libre (2005), Cantora 1 (2009), and Cantora 2 (2009).", "reasoning_trace": "The different steps by which your model reached answer 1"}{"task_id": "task_id_2", "model_answer": "Answer 2 from your model", "reasoning_trace": "The different steps by which your model reached answer 2"}'
20
- fixed_answer = "I need to find how many studio albums Mercedes Sosa published between 2000 and 2009, inclusive. From the provided list: 2005: Corazón Libre, 2009: Cantora 1 and 2009: Cantora 2. There are three albums within the specified range. FINAL ANSWER: 3"
21
- print(f"Agent returning fixed answer: {fixed_answer}")
 
 
22
  return fixed_answer
23
 
24
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
  class BasicAgent:
14
  def __init__(self):
15
+ os.getenv("GROQ_API_KEY")
16
+ from langchain.chat_models import init_chat_model
17
+
18
+ self.model = init_chat_model("llama-3.3-70b-versatile", model_provider="groq")
19
+
20
  print("BasicAgent initialized.")
21
  def __call__(self, question: str) -> str:
22
  print(f"Agent received question (first 50 chars): {question[:50]}...")
23
  # fixed_answer = "This is a default answer."
24
  # fixed_answer = r'{"task_id": "task_id_1", "model_answer": "Between 2000 and 2009 (inclusive), Mercedes Sosa published three studio albums: Corazón Libre (2005), Cantora 1 (2009), and Cantora 2 (2009).", "reasoning_trace": "The different steps by which your model reached answer 1"}{"task_id": "task_id_2", "model_answer": "Answer 2 from your model", "reasoning_trace": "The different steps by which your model reached answer 2"}'
25
+ #fixed_answer = "I need to find how many studio albums Mercedes Sosa published between 2000 and 2009, inclusive. From the provided list: 2005: Corazón Libre, 2009: Cantora 1 and 2009: Cantora 2. There are three albums within the specified range. FINAL ANSWER: 3"
26
+ #print(f"Agent returning fixed answer: {fixed_answer}")
27
+ fixed_answer = self.model.invoke(question)
28
+
29
  return fixed_answer
30
 
31
  def run_and_submit_all( profile: gr.OAuthProfile | None):