Spaces:
Running
Running
import os | |
import pytest | |
from surf_spot_finder.agents.openai import run_openai_agent | |
INTEGRATION_MODEL = "gpt-4o-mini" | |
API_KEY_VAR = "OPENAI_API_KEY" | |
def test_openai_real_execution(): | |
""" | |
Tests the actual execution of the agent against real APIs. | |
WARNING: This will make actual API calls and incur costs. | |
Only run when explicitly needed for full system testing. | |
Requires: | |
- OPENAI_API_KEY in environment variables | |
- INTEGRATION_TESTS env var to be set | |
""" | |
from agents import RunResult, ToolCallItem | |
result = run_openai_agent( | |
INTEGRATION_MODEL, | |
"What will be the best surf spot around Vigo, in a 2 hour driving radius, tomorrow?", | |
api_key_var=API_KEY_VAR, | |
) | |
assert isinstance(result, RunResult) | |
assert any(isinstance(item, ToolCallItem) for item in result.new_items) | |