Commit 3
Browse files
app.py
CHANGED
|
@@ -18,6 +18,11 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 18 |
class BasicAgent:
|
| 19 |
def __init__(self):
|
| 20 |
print("BasicAgent initializing...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
model = AzureOpenAIServerModel(
|
| 22 |
azure_endpoint=os.environ.get("AZendpoint"),
|
| 23 |
api_version=os.environ.get("api_version"),
|
|
@@ -27,7 +32,7 @@ class BasicAgent:
|
|
| 27 |
|
| 28 |
self.smart_agent = CodeAgent(
|
| 29 |
model=model,
|
| 30 |
-
tools=[
|
| 31 |
additional_authorized_imports=["pandas"],
|
| 32 |
max_steps=20,
|
| 33 |
)
|
|
@@ -37,7 +42,7 @@ class BasicAgent:
|
|
| 37 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 38 |
answer = self.smart_agent.run(question)
|
| 39 |
print(f"Agent returning answer: {answer}")
|
| 40 |
-
return
|
| 41 |
|
| 42 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 43 |
"""
|
|
|
|
| 18 |
class BasicAgent:
|
| 19 |
def __init__(self):
|
| 20 |
print("BasicAgent initializing...")
|
| 21 |
+
|
| 22 |
+
duckduckgo=DuckDuckGoSearchTool()
|
| 23 |
+
visit_page=VisitWebpageTool()
|
| 24 |
+
final_answer=FinalAnswerTool()
|
| 25 |
+
|
| 26 |
model = AzureOpenAIServerModel(
|
| 27 |
azure_endpoint=os.environ.get("AZendpoint"),
|
| 28 |
api_version=os.environ.get("api_version"),
|
|
|
|
| 32 |
|
| 33 |
self.smart_agent = CodeAgent(
|
| 34 |
model=model,
|
| 35 |
+
tools=[duckduckgo,visit_page,final_answer],
|
| 36 |
additional_authorized_imports=["pandas"],
|
| 37 |
max_steps=20,
|
| 38 |
)
|
|
|
|
| 42 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 43 |
answer = self.smart_agent.run(question)
|
| 44 |
print(f"Agent returning answer: {answer}")
|
| 45 |
+
return answer
|
| 46 |
|
| 47 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 48 |
"""
|