The evaluation client is available on the main Netra entry point after initialization.
from netra import NetraNetra.init(app_name="sample-app")# Access the evaluation clientNetra.evaluation.create_dataset(...)Netra.evaluation.add_dataset_item(...)Netra.evaluation.get_all_datasets(...)Netra.evaluation.get_dataset(...)Netra.evaluation.run_test_suite(...)Netra.evaluation.get_run_results(...)
from netra import Netrafrom netra.evaluation import DatasetItemNetra.init(app_name="sample-app")result = Netra.evaluation.add_dataset_item( dataset_id="dataset-123", item=DatasetItem( input="What is the return policy for electronics?", expected_output="Electronics can be returned within 30 days with original packaging.", tags=["policy", "returns"], metadata={"category": "electronics", "priority": "high"}, ),)print(f"Item added: {result.id}")print(f"Input: {result.input}")
Fetch all datasets, optionally filtered by a specific tag.
from netra import NetraNetra.init(app_name="sample-app")# Fetch all datasetsall_datasets = Netra.evaluation.get_all_datasets()# Fetch only datasets that include a specific tagtagged_datasets = Netra.evaluation.get_all_datasets(tag="production")if tagged_datasets: print(f"Found {len(tagged_datasets.datasets)} dataset(s)") for dataset in tagged_datasets.datasets: print(f"{dataset.id} | {dataset.name} | {dataset.tags}")
Fetch detailed results for a completed test run by its run ID. Use this after run_test_suite to retrieve evaluation scores, item-level outcomes, and other run metadata from the backend.
from netra import NetraNetra.init(app_name="sample-app")# After running a test suiteresult = Netra.evaluation.run_test_suite( name="GPT-4o Mini Evaluation", data=dataset, task=my_task, evaluators=["correctness", "relevance"],)run_id = result["runId"]# Fetch the full run resultsrun_results = Netra.evaluation.get_run_results(run_id=run_id)print(f"Run results: {run_results}")
Returns the JSON response from the backend containing the full run results, including evaluation scores and item-level details. Returns None if the run_id is empty or the request fails.The top-level response wraps the run data:
Field
Type
Description
success
bool
Whether the request succeeded
data
RunResult
The run result object (see below)
error
Any?
Error details, null on success
meta
dict
Request metadata (timestamp, path, version, status code)
Pair get_run_results with run_test_suite to programmatically inspect evaluation outcomes. The run_id is available in the runId field of the run_test_suite response. Use redirectUrl from the response to jump directly to the run in the Netra dashboard.
create_dataset / add_dataset_item / get_all_datasets / get_datasetBuild and manage test datasets programmatically. Use for CI/CD pipelines or when generating test cases from production data.
Test Execution
run_test_suiteExecute your AI task against a dataset with automatic tracing and evaluation. Use for regression testing and model comparisons.
Results Retrieval
get_run_resultsFetch detailed results for a completed run, including evaluation scores and item-level outcomes. Use for post-run analysis and CI/CD assertions.
Advanced Workflows
create_runCreate runs without immediate execution. Use when you need custom orchestration or want to manage run lifecycle separately.
Evaluators
Evaluator IDs or ConfigsPass evaluator IDs to run_test_suite to automatically score outputs. Configure custom evaluators in the Netra dashboard.