Sanyam0605 commited on
Commit
d7f1382
·
verified ·
1 Parent(s): d5be480

Delete api_integration.py

Browse files
Files changed (1) hide show
  1. api_integration.py +0 -39
api_integration.py DELETED
@@ -1,39 +0,0 @@
1
- import requests
2
- from typing import List, Dict, Any
3
- from core_agent import GAIAAgent
4
-
5
- class GAIAApiClient:
6
- def __init__(self, api_url="https://agents-course-unit4-scoring.hf.space"):
7
- self.api_url = api_url
8
- self.questions_url = f"{api_url}/questions"
9
- self.submit_url = f"{api_url}/submit"
10
- self.files_url = f"{api_url}/files"
11
-
12
- def get_questions(self) -> List[Dict[str, Any]]:
13
- """Fetch all evaluation questions"""
14
- response = requests.get(self.questions_url)
15
- response.raise_for_status()
16
- return response.json()
17
-
18
- def get_random_question(self) -> Dict[str, Any]:
19
- """Fetch a single random question"""
20
- response = requests.get(f"{self.api_url}/random-question")
21
- response.raise_for_status()
22
- return response.json()
23
-
24
- def get_file(self, task_id: str) -> bytes:
25
- """Download a file for a specific task"""
26
- response = requests.get(f"{self.files_url}/{task_id}")
27
- response.raise_for_status()
28
- return response.content
29
-
30
- def submit_answers(self, username: str, agent_code: str, answers: List[Dict[str, Any]]) -> Dict[str, Any]:
31
- """Submit agent answers and get score"""
32
- data = {
33
- "username": username,
34
- "agent_code": agent_code,
35
- "answers": answers
36
- }
37
- response = requests.post(self.submit_url, json=data)
38
- response.raise_for_status()
39
- return response.json()