Update test_agent.py
Browse files- test_agent.py +0 -5
test_agent.py
CHANGED
|
@@ -4,24 +4,20 @@ import pathlib
|
|
| 4 |
import dotenv
|
| 5 |
from smolagents import CodeAgent, OpenAIServerModel
|
| 6 |
|
| 7 |
-
# Load environment
|
| 8 |
if pathlib.Path(".env").exists():
|
| 9 |
dotenv.load_dotenv(".env")
|
| 10 |
|
| 11 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", None)
|
| 12 |
|
| 13 |
if not OPENAI_API_KEY:
|
| 14 |
-
print("Please set OPENAI_API_KEY in your .env file")
|
| 15 |
exit(1)
|
| 16 |
|
| 17 |
-
# Create model
|
| 18 |
model = OpenAIServerModel(
|
| 19 |
model_id="gpt-4o-mini",
|
| 20 |
api_key=OPENAI_API_KEY,
|
| 21 |
)
|
| 22 |
|
| 23 |
def test_simple_calculation():
|
| 24 |
-
"""Test that calc agent can solve a simple math problem and call final_answer()"""
|
| 25 |
from prompt import calc_agent_prompt
|
| 26 |
|
| 27 |
calc_agent = CodeAgent(
|
|
@@ -46,7 +42,6 @@ def test_simple_calculation():
|
|
| 46 |
return False
|
| 47 |
|
| 48 |
def test_simple_search():
|
| 49 |
-
"""Test that web search agent can answer a simple question and call final_answer()"""
|
| 50 |
from smolagents import VisitWebpageTool, WebSearchTool, WikipediaSearchTool
|
| 51 |
|
| 52 |
from prompt import web_search_agent_prompt
|
|
|
|
| 4 |
import dotenv
|
| 5 |
from smolagents import CodeAgent, OpenAIServerModel
|
| 6 |
|
|
|
|
| 7 |
if pathlib.Path(".env").exists():
|
| 8 |
dotenv.load_dotenv(".env")
|
| 9 |
|
| 10 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", None)
|
| 11 |
|
| 12 |
if not OPENAI_API_KEY:
|
|
|
|
| 13 |
exit(1)
|
| 14 |
|
|
|
|
| 15 |
model = OpenAIServerModel(
|
| 16 |
model_id="gpt-4o-mini",
|
| 17 |
api_key=OPENAI_API_KEY,
|
| 18 |
)
|
| 19 |
|
| 20 |
def test_simple_calculation():
|
|
|
|
| 21 |
from prompt import calc_agent_prompt
|
| 22 |
|
| 23 |
calc_agent = CodeAgent(
|
|
|
|
| 42 |
return False
|
| 43 |
|
| 44 |
def test_simple_search():
|
|
|
|
| 45 |
from smolagents import VisitWebpageTool, WebSearchTool, WikipediaSearchTool
|
| 46 |
|
| 47 |
from prompt import web_search_agent_prompt
|