Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/evaluator/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Submit your evaluation to the Evaluator service using the NeMo Platform SDK:

```python
from nemo_evaluator.sdk import Evaluator
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager
from nemo_platform import NeMoPlatform


Expand All @@ -69,7 +70,12 @@ evaluator: Evaluator = sdk.evaluator
local_result = evaluator.run(metric=metric, dataset=dataset, config=config)

# Production evaluation as a durable platform job
job = evaluator.submit(metric=metric, dataset=dataset, config=config)
job = evaluator.submit(
metric=metric,
dataset=dataset,
config=config,
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
```
Expand Down
2 changes: 2 additions & 0 deletions docs/evaluator/metrics/agent-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ from nemo_evaluator_sdk import Agent, RunConfigOnline


from nemo_evaluator_sdk import ExactMatchMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager
metric = ExactMatchMetric(reference="{{item.expected_answer}}")
agent = Agent(
url="https://my-nat-agent.example.com",
Expand All @@ -184,6 +185,7 @@ job = evaluator.submit(
{"role": "user", "content": "{{item.question}}"},
],
},
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down
14 changes: 14 additions & 0 deletions docs/evaluator/metrics/agentic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfig
from nemo_evaluator_sdk.metrics.ragas import ToolCallAccuracyMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager
metric = ToolCallAccuracyMetric()

job = evaluator.submit(
Expand All @@ -250,6 +251,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down Expand Up @@ -428,6 +430,7 @@ print(result.aggregate_scores)

```python
from nemo_evaluator_sdk import RunConfig, ToolCallingMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

metric = ToolCallingMetric(reference="{{item.tool_calls}}")

Expand Down Expand Up @@ -462,6 +465,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down Expand Up @@ -568,6 +572,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfig, Model
from nemo_evaluator_sdk.metrics.ragas import TopicAdherenceMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

judge_model = Model(
url="https://integrate.api.nvidia.com/v1/chat/completions",
Expand All @@ -591,6 +596,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down Expand Up @@ -762,6 +768,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfig, Model
from nemo_evaluator_sdk.metrics.ragas import AgentGoalAccuracyMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

judge_model = Model(
url="https://integrate.api.nvidia.com/v1/chat/completions",
Expand Down Expand Up @@ -791,6 +798,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down Expand Up @@ -917,6 +925,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfig, Model
from nemo_evaluator_sdk.metrics.ragas import AgentGoalAccuracyMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

judge_model = Model(
url="https://integrate.api.nvidia.com/v1/chat/completions",
Expand Down Expand Up @@ -954,6 +963,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand Down Expand Up @@ -1013,6 +1023,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfig, Model
from nemo_evaluator_sdk.metrics.ragas import AnswerAccuracyMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

judge_model = Model(
url="https://integrate.api.nvidia.com/v1/chat/completions",
Expand All @@ -1031,6 +1042,7 @@ job = evaluator.submit(
}
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
job.wait_until_done()
result = job.get_result()
Expand All @@ -1043,6 +1055,7 @@ print(result.aggregate_scores)
```python
from nemo_evaluator_sdk import RunConfigOnlineModel, InferenceParams, Model
from nemo_evaluator_sdk.metrics.ragas import AnswerAccuracyMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

judge_model = Model(
url="https://integrate.api.nvidia.com/v1/chat/completions",
Expand Down Expand Up @@ -1077,6 +1090,7 @@ job = evaluator.submit(
}
]
},
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)

job.wait_until_done()
Expand Down
2 changes: 2 additions & 0 deletions docs/evaluator/metrics/job-management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ from nemo_evaluator.sdk import Evaluator
from nemo_platform import NeMoPlatform
from nemo_evaluator_sdk import RunConfig
from nemo_evaluator_sdk import ExactMatchMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

sdk = NeMoPlatform(
base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
Expand All @@ -37,6 +38,7 @@ job = evaluator.submit(
{"expected": "Berlin", "output": "Munich"},
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
print("Submitted job:", job.name)

Expand Down
2 changes: 2 additions & 0 deletions docs/evaluator/metrics/llm-as-a-judge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ For production workloads, submit the same metric and dataset as a durable platfo

```python
from nemo_evaluator_sdk import RunConfig, JSONScoreParser, Model, RubricScore, LLMJudgeMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

metric = LLMJudgeMetric(
model=Model(
Expand Down Expand Up @@ -346,6 +347,7 @@ job = evaluator.submit(
{"input": "What is 2 + 2?", "output": "4"},
],
config=RunConfig(parallelism=8, limit_samples=100),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
print("Submitted job:", job.name)

Expand Down
2 changes: 2 additions & 0 deletions docs/evaluator/metrics/manage-metrics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ For online evaluations, provide a model or agent target and use the online param

```python
from nemo_evaluator_sdk import RunConfig, ExactMatchMetric
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

metric = ExactMatchMetric(reference="{{item.expected}}", candidate="{{item.output}}")

Expand All @@ -108,6 +109,7 @@ job = evaluator.submit(
{"expected": "Berlin", "output": "Munich"},
],
config=RunConfig(parallelism=4),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)

job.wait_until_done()
Expand Down
38 changes: 37 additions & 1 deletion docs/evaluator/metrics/model-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,43 @@ Use plain `RunConfig` for offline evaluations where the dataset already contains

## Model References

The plugin SDK examples on this page use inline `Model` objects. If your deployment resolves platform model entities into model endpoint details, perform that lookup before constructing the `Model`, then pass the resulting inline model to the metric or request.
You can supply the evaluation target two ways. Which one is valid depends on whether you run the evaluation locally or submit it as a durable platform job.

### Inline `Model` (required for `evaluator.run(...)`)

`evaluator.run(...)` executes in your local Python process, so it needs the resolved endpoint details inline. Always pass an inline `Model` as the `target` (or as a judge/embeddings field on the metric). If your deployment stores platform model entities, resolve the entity into endpoint details before constructing the `Model`:

```python
from nemo_evaluator_sdk import Model

model_entity = client.models.retrieve("my-model", workspace="default")
model = Model(
url=client.models.get_model_entity_route_openai_url(model_entity),
name="my-model",
api_key_secret="NVIDIA_API_KEY",
)

result = evaluator.run(metric=metric, dataset=dataset, target=model)
```

### `ModelRef` (supported by `evaluator.submit(...)`)

Durable remote `evaluator.submit(...)` jobs additionally accept a `ModelRef` target. A `ModelRef` names a platform model entity (`workspace/model-name`) and is resolved by the evaluator backend when the job runs, so you do not have to resolve the endpoint yourself. Use this for platform-managed model routing. A `ModelRef` target generates outputs online, so it requires an online run config (`RunConfigOnlineModel`):

```python
from nemo_evaluator_sdk import ModelRef, RunConfigOnlineModel
from nemo_evaluator.shared.metric_bundles.cloudpickle import CloudpickleMetricBundlePackager

job = evaluator.submit(
metric=metric,
dataset=dataset,
config=RunConfigOnlineModel(),
target=ModelRef(root="default/my-model"),
metric_bundle_packager=CloudpickleMetricBundlePackager(),
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
```

`ModelRef` is **not** valid for `evaluator.run(...)`; the local runtime cannot resolve a platform entity. Pass an inline `Model` for local runs and either a `Model` or a `ModelRef` for remote submits. See the [Define and Run Custom Python Metrics](/documentation/evaluate-models/tutorials/define-and-run-custom-python-metrics) tutorial for an end-to-end `ModelRef` + `FilesetRef` submit example.

<Note>

Expand Down
Loading
Loading