Spaces:
Starting
Starting
Update agent.py
Browse files
agent.py
CHANGED
@@ -137,24 +137,6 @@ with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
137 |
sys_msg = SystemMessage(content=system_prompt)
|
138 |
|
139 |
|
140 |
-
|
141 |
-
# -------------------------------
|
142 |
-
# Step 1: Load the JSON from a URL
|
143 |
-
# -------------------------------
|
144 |
-
|
145 |
-
json_url = "https://agents-course-unit4-scoring.hf.space/questions" # Replace with your actual JSON file URL
|
146 |
-
response = requests.get(json_url)
|
147 |
-
|
148 |
-
if response.status_code != 200:
|
149 |
-
raise Exception(f"Failed to load JSON from {json_url}. Status code: {response.status_code}")
|
150 |
-
|
151 |
-
# Parse the JSON array
|
152 |
-
tasks = response.json()
|
153 |
-
|
154 |
-
# Ensure that the loaded data is a list (JSON array)
|
155 |
-
if not isinstance(tasks, list):
|
156 |
-
raise ValueError("The JSON file must be a list of objects.")
|
157 |
-
|
158 |
|
159 |
# -------------------------------
|
160 |
# Step 2: Create Documents from Each JSON Object
|
|
|
137 |
sys_msg = SystemMessage(content=system_prompt)
|
138 |
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
# -------------------------------
|
142 |
# Step 2: Create Documents from Each JSON Object
|