Fetch question data from API and update agent to use dynamic question retrieval instead of a static prompt.
Browse files- app copy.py +6 -1
app copy.py
CHANGED
|
@@ -26,7 +26,12 @@ class BasicAgent:
|
|
| 26 |
return answer
|
| 27 |
|
| 28 |
agent = BasicAgent()
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|