Paperbag commited on
Commit
e5bf7aa
·
1 Parent(s): 3970751

Fetch question data from API and update agent to use dynamic question retrieval instead of a static prompt.

Browse files
Files changed (1) hide show
  1. app copy.py +6 -1
app copy.py CHANGED
@@ -26,7 +26,12 @@ class BasicAgent:
26
  return answer
27
 
28
  agent = BasicAgent()
29
- output = agent('How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.')
 
 
 
 
 
30
  print(output)
31
 
32
 
 
26
  return answer
27
 
28
  agent = BasicAgent()
29
+ questions_url = f"{DEFAULT_API_URL}/questions"
30
+ response = requests.get(questions_url, timeout=15)
31
+ response.raise_for_status()
32
+ questions_data = response.json()
33
+ question_text = questions_data[3].get("question")
34
+ output = agent(question_text)
35
  print(output)
36
 
37