Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool,
|
| 7 |
|
| 8 |
# (Keep Constants and BasicAgent class as is)
|
| 9 |
# --- Constants ---
|
|
@@ -13,10 +13,9 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 13 |
# --- Awesome Agent Definition ---
|
| 14 |
class AwesomeAgent:
|
| 15 |
|
| 16 |
-
|
| 17 |
def __init__(self):
|
| 18 |
print("AwesomeAgent initialised.")
|
| 19 |
-
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=
|
| 20 |
|
| 21 |
SYSTEM_PROMPT = """
|
| 22 |
You are a precise, domain-agnostic assistant. For every query, perform internal reasoning silently and respond only with a conclusive output using this format:
|
|
@@ -36,7 +35,8 @@ class AwesomeAgent:
|
|
| 36 |
A: 4
|
| 37 |
"""
|
| 38 |
self.agent.prompt_templates["system_prompt"] = self.agent.prompt_templates["system_prompt"] + SYSTEM_PROMPT
|
| 39 |
-
|
|
|
|
| 40 |
def __call__(self, question: str) -> str:
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
raw = self.agent.run(question)
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel
|
| 7 |
|
| 8 |
# (Keep Constants and BasicAgent class as is)
|
| 9 |
# --- Constants ---
|
|
|
|
| 13 |
# --- Awesome Agent Definition ---
|
| 14 |
class AwesomeAgent:
|
| 15 |
|
|
|
|
| 16 |
def __init__(self):
|
| 17 |
print("AwesomeAgent initialised.")
|
| 18 |
+
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=OpenAIServerModel(model_id="gpt-4o"))
|
| 19 |
|
| 20 |
SYSTEM_PROMPT = """
|
| 21 |
You are a precise, domain-agnostic assistant. For every query, perform internal reasoning silently and respond only with a conclusive output using this format:
|
|
|
|
| 35 |
A: 4
|
| 36 |
"""
|
| 37 |
self.agent.prompt_templates["system_prompt"] = self.agent.prompt_templates["system_prompt"] + SYSTEM_PROMPT
|
| 38 |
+
|
| 39 |
+
|
| 40 |
def __call__(self, question: str) -> str:
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
raw = self.agent.run(question)
|