Skip to content

Commit cb8030a

Browse files
committed
fix: fix test
Signed-off-by: Nick Goncharenko <[email protected]>
1 parent 3c671e9 commit cb8030a

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/evaluator/agent-eval/evaluate-deployed-agent.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ from nemo_evaluator_sdk.agent_inference import make_agent_inference_fn
131131
agent = GenericAgent(
132132
name="hermes-agent",
133133
url="http://127.0.0.1:8642/v1/responses",
134-
api_key_secret=SecretRef("API_SERVER_KEY"),
134+
api_key_secret=SecretRef("HERMES_TOKEN"),
135135
body={
136136
"model": "hermes-agent",
137137
"input": "{{ instruction }}",
@@ -153,7 +153,7 @@ evaluator = AgentEvaluator(
153153
)
154154
```
155155

156-
The SDK sends the bearer token from `API_SERVER_KEY` env variable, preserves the raw stream as evidence, and
156+
The SDK sends the bearer token from the `HERMES_TOKEN` environment variable, preserves the raw stream as evidence, and
157157
passes the extracted output text to the task's metrics. The Hermes translator reads the terminal
158158
`response.completed` payload, validates completion, and records user/agent steps plus token usage in
159159
ATIF-v1.7.

packages/nemo_evaluator_sdk/examples/hermes/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __call__(
154154
return AgentStreamTranslation(trajectory=trajectory.model_dump(mode="python", exclude_none=True))
155155

156156

157-
def _require_api_server_key() -> None:
157+
def _require_hermes_token() -> None:
158158
if os.getenv(HERMES_TOKEN_ENV_NAME):
159159
return
160160
raise RuntimeError(
@@ -170,7 +170,7 @@ async def evaluate(
170170
client: httpx.AsyncClient | None = None,
171171
) -> AgentEvalResult:
172172
"""Run the Hermes streaming evaluation."""
173-
_require_api_server_key()
173+
_require_hermes_token()
174174
evaluator = AgentEvaluator(
175175
agent_inference_fn_factory=partial(
176176
make_agent_inference_fn,
@@ -184,7 +184,7 @@ async def evaluate(
184184
task = AgentEvalTask(
185185
id="hermes-streaming",
186186
intent="Return the requested phrase over SSE.",
187-
inputs={"instruction": f"Reply with exactly: {EXPECTED_TEXT}"},
187+
inputs={"instruction": f"Reply with exactly: {EXPECTED_TEXT}."},
188188
reference={"expected": EXPECTED_TEXT},
189189
metrics=[KeywordMatchMetric()],
190190
)

packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ Hermes supplies domain knowledge through a translator while using a
468468
target = GenericAgent(
469469
url="http://127.0.0.1:8642/v1/responses",
470470
name="hermes-agent",
471-
api_key_secret=SecretRef("API_SERVER_KEY"),
471+
api_key_secret=SecretRef("HERMES_TOKEN"),
472472
body={
473473
"model": "hermes-agent",
474474
"input": "{{ instruction }}",

packages/nemo_evaluator_sdk/tests/agent_eval/test_hermes_example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def handle(request: httpx.Request) -> httpx.Response:
5656
headers={"content-type": "text/event-stream"},
5757
)
5858

59-
monkeypatch.setenv("API_SERVER_KEY", "test-token")
59+
monkeypatch.setenv(hermes.HERMES_TOKEN_ENV_NAME, "test-token")
6060
async with httpx.AsyncClient(transport=httpx.MockTransport(handle)) as client:
6161
result = await hermes.evaluate(agent_url="http://hermes.test/v1/responses", client=client)
6262

@@ -204,7 +204,7 @@ async def test_incomplete_stream_records_translation_error(monkeypatch: pytest.M
204204
event: response.output_text.done
205205
data: {"type":"response.output_text.done","text":"streaming works"}
206206
"""
207-
monkeypatch.setenv("API_SERVER_KEY", "test-token")
207+
monkeypatch.setenv(hermes.HERMES_TOKEN_ENV_NAME, "test-token")
208208
transport = httpx.MockTransport(
209209
lambda request: httpx.Response(200, content=incomplete, headers={"content-type": "text/event-stream"})
210210
)
@@ -221,20 +221,20 @@ async def test_incomplete_stream_records_translation_error(monkeypatch: pytest.M
221221

222222

223223
@pytest.mark.asyncio
224-
async def test_missing_api_server_key_fails_before_request(monkeypatch: pytest.MonkeyPatch) -> None:
224+
async def test_missing_hermes_token_fails_before_request(monkeypatch: pytest.MonkeyPatch) -> None:
225225
request_count = 0
226226

227227
def handle(request: httpx.Request) -> httpx.Response:
228228
nonlocal request_count
229229
request_count += 1
230230
return httpx.Response(500, request=request)
231231

232-
monkeypatch.delenv(hermes.API_SERVER_KEY_ENV_NAME, raising=False)
232+
monkeypatch.delenv(hermes.HERMES_TOKEN_ENV_NAME, raising=False)
233233
async with httpx.AsyncClient(transport=httpx.MockTransport(handle)) as client:
234234
with pytest.raises(RuntimeError) as exc_info:
235235
await hermes.evaluate(agent_url="http://hermes.test/v1/responses", client=client)
236236

237237
message = str(exc_info.value)
238238
assert request_count == 0
239-
assert "export API_SERVER_KEY=<your-api-server-key>" in message
239+
assert "export HERMES_TOKEN=<your-hermes-token>" in message
240240
assert hermes.HERMES_API_SERVER_DOCS_URL in message

0 commit comments

Comments
 (0)