Files
nousresearch--hermes-agent/tests/run_agent/test_fireworks_live.py
T
wehub-resource-sync b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:56:03 +08:00

65 lines
2.3 KiB
Python

"""Live Fireworks smoke test — exercises the Hermes runtime, not a raw SDK client.
Opt-in only:
HERMES_LIVE_TESTS=1 FIREWORKS_API_KEY=fw_... \\
pytest tests/run_agent/test_fireworks_live.py -q
Unlike a bare OpenAI() client pointed at the endpoint, this drives Hermes'
own provider resolution — ``resolve_provider_client('fireworks')`` — so it
verifies the auth/config/base-URL/aux-model wiring that the
bundled provider actually ships, then makes a real call through that client.
"""
from __future__ import annotations
import os
import pytest
LIVE = os.environ.get("HERMES_LIVE_TESTS") == "1"
FIREWORKS_KEY = os.environ.get("FIREWORKS_API_KEY", "")
pytestmark = [
pytest.mark.skipif(not LIVE, reason="live-only: set HERMES_LIVE_TESTS=1"),
pytest.mark.skipif(not FIREWORKS_KEY, reason="FIREWORKS_API_KEY not configured"),
pytest.mark.integration,
]
def _resolve_runtime_client(provider="fireworks"):
"""Build the Fireworks client the way the Hermes runtime does."""
from agent.auxiliary_client import resolve_provider_client
client, model = resolve_provider_client(provider)
assert client is not None, "Hermes failed to build a Fireworks client"
return client, model
def test_hermes_wires_fireworks_client():
"""The runtime resolves a Fireworks client pointed at the right endpoint
with the partner-attribution headers applied — no network required."""
client, model = _resolve_runtime_client()
assert "api.fireworks.ai" in str(client.base_url)
# Default aux model must be a PAYG /models/ id (works with an fw_ key).
assert model.startswith("accounts/fireworks/models/")
def test_fireworks_basic_chat_through_runtime():
"""A single-turn completion via the Hermes-resolved client returns text."""
client, model = _resolve_runtime_client()
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Say exactly the word 'pong' and nothing else."}],
timeout=60,
)
content = response.choices[0].message.content
assert content and "pong" in content.lower()
def test_fireworks_alias_resolves_through_runtime():
"""The 'fw' alias resolves to the same Fireworks client via the runtime."""
client, _ = _resolve_runtime_client("fw")
assert "api.fireworks.ai" in str(client.base_url)