Shared eval tools for single-cell bench, spatial bench, and future biology benchmarks.
Project description
latch-eval-tools
Shared eval tools for single-cell bench, spatial bench, and future biology benchmarks.
Installation
pip install latch-eval-tools
What is included
Eval/EvalResulttypes- Built-in graders +
get_grader() EvalRunnerharness to run an agent against one eval JSONeval-lintCLI and Python linter APIs
Quickstart
from latch_eval_tools import EvalRunner, run_minisweagent_task
runner = EvalRunner("evals/count_cells.json")
result = runner.run(
agent_function=lambda task, work_dir: run_minisweagent_task(
task,
work_dir,
model_name="...your model name...",
)
)
print(result["passed"])
print(result["grader_result"].reasoning if result["grader_result"] else "No grader result")
EvalRunner.run() expects an agent_function(task_prompt, work_dir) and supports either:
- returning a plain answer
dict, or - returning
{"answer": <dict>, "metadata": <dict>}
If your agent writes eval_answer.json in work_dir, the runner will load it automatically.
Graders
Available grader types:
numeric_tolerance, jaccard_label_set, distribution_comparison, marker_gene_precision_recall, marker_gene_separation, spatial_adjacency, multiple_choice
from latch_eval_tools.graders import get_grader
grader = get_grader("numeric_tolerance")
result = grader.evaluate_answer(
agent_answer={"n_cells": 1523},
config={
"ground_truth": {"n_cells": 1500},
"tolerances": {"n_cells": {"type": "relative", "value": 0.05}},
},
)
print(result.passed, result.reasoning)
Built-in harness helpers:
run_minisweagent_taskrun_claudecode_task(requiresANTHROPIC_API_KEYandclaudeCLI)run_openaicodex_task(requiresOPENAI_API_KEYorCODEX_API_KEYandcodexCLI)run_plotsagent_task(experimental latch-plots harness)
Linter
Validate eval JSON files:
eval-lint evals/my_dataset/
eval-lint evals/ --format json
from latch_eval_tools.linter import lint_eval, lint_directory
result = lint_eval("evals/test.json")
print(result.passed, result.issues)
Eval JSON shape
{
"id": "unique_test_id",
"task": "Task description. Include an <EVAL_ANSWER> JSON template in this text.",
"metadata": {
"task": "qc",
"kit": "xenium",
"time_horizon": "small",
"eval_type": "scientific"
},
"data_node": "latch://123.node/path/to/data.h5ad",
"grader": {
"type": "numeric_tolerance",
"config": {
"ground_truth": {"field": 42},
"tolerances": {"field": {"type": "absolute", "value": 1}}
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file latch_eval_tools-0.1.19.tar.gz.
File metadata
- Download URL: latch_eval_tools-0.1.19.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24cba67fe5d1f8ef65f6e79cf6d56a85c8007c6cc9120eef577a4c6b5809e28c
|
|
| MD5 |
0b72434b06ab5e2116e2b05144e73079
|
|
| BLAKE2b-256 |
d60f27b69f50f2551482eca8d7ed08331edc39e6835a7f29d83a22510dc67c08
|
File details
Details for the file latch_eval_tools-0.1.19-py3-none-any.whl.
File metadata
- Download URL: latch_eval_tools-0.1.19-py3-none-any.whl
- Upload date:
- Size: 59.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d0bb19907819d66345c9edce1d847908a040eda12a1a6c79b1f966fcc0ca0f5
|
|
| MD5 |
448a537e2b038ecd2a35e00fdf0f9ad4
|
|
| BLAKE2b-256 |
a6bda0b5244b66604759931f8f8d124700420a04716755557113dfd755021b06
|