Spaces:
Running on T4
Running on T4
Download AI-coach-agent/tests/test_live.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 925 Bytes
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/tests/test_live.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/AI-coach-agent/tests/test_live.py
-
curl -L -o test_live.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/tests/test_live.py
925 Bytes
| """Real Gemini calls. Opt-in: needs GOOGLE_API_KEY. Run with: pytest -m live -s""" | |
| import os | |
| import pytest | |
| from ai_coach.config import Settings | |
| from ai_coach.service import CoachService | |
| from .helpers import example_names, load_example | |
| pytestmark = [pytest.mark.live, pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY"), reason="no GOOGLE_API_KEY")] | |
| def test_live_notes_pass_guardrails(name, tmp_path): | |
| settings = Settings(cache_path=tmp_path / "c.sqlite3") | |
| result = CoachService(settings).coach(load_example(name)) | |
| print( | |
| name, | |
| result.source, | |
| result.model, | |
| result.attempts, | |
| f"${result.usage.cost_usd:.5f}", | |
| result.usage.cached_tokens, | |
| result.violations, | |
| ) | |
| assert result.source == "llm", result.violations | |
| assert result.usage.cost_usd < 0.01 | |