Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,19 +18,18 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
18 |
|
19 |
|
20 |
# --- Basic Agent Definition ---
|
|
|
21 |
class BasicAgent:
|
22 |
def __init__(self):
|
23 |
print("BasicAgent initialized.")
|
24 |
|
25 |
def __call__(self, question: str) -> str:
|
26 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
27 |
-
fixed_answer = self.basic_search(question)
|
28 |
print(f"Agent returning answer: {fixed_answer}")
|
29 |
return fixed_answer
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
def basic_search(query):
|
34 |
url = f"https://www.google.com/search?q={query}"
|
35 |
response = requests.get(url)
|
36 |
return response.text
|
|
|
18 |
|
19 |
|
20 |
# --- Basic Agent Definition ---
|
21 |
+
|
22 |
class BasicAgent:
|
23 |
def __init__(self):
|
24 |
print("BasicAgent initialized.")
|
25 |
|
26 |
def __call__(self, question: str) -> str:
|
27 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
28 |
+
fixed_answer = self.basic_search(question) # Now works correctly
|
29 |
print(f"Agent returning answer: {fixed_answer}")
|
30 |
return fixed_answer
|
31 |
|
32 |
+
def basic_search(self, query): # Fixed: Added 'self'
|
|
|
|
|
33 |
url = f"https://www.google.com/search?q={query}"
|
34 |
response = requests.get(url)
|
35 |
return response.text
|