Skip to main content

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

Components

Types

from latch_eval_tools import Eval, EvalResult

eval_case = Eval(
    id="test_001",
    task="Count cells in the dataset",
    data_node="latch:///data/sample.h5ad",
    grader={"type": "numeric_tolerance", "config": {...}}
)

Graders

Available graders: numeric_tolerance, label_set_jaccard, distribution_comparison, marker_gene_precision_recall, marker_gene_separation, spatial_adjacency, multiple_choice

from latch_eval_tools.graders import get_grader, NumericToleranceGrader

grader = get_grader("numeric_tolerance")
result = grader.evaluate(
    agent_answer={"n_cells": 1523},
    config={
        "ground_truth": {"n_cells": 1500},
        "tolerances": {"n_cells": {"type": "relative", "value": 0.05}}
    }
)
print(result.passed)
print(result.reasoning)

Harness

Run evaluations with different agents:

from latch_eval_tools.harness import EvalRunner, run_minisweagent_task

runner = EvalRunner("evals/count_cells.json", cache_name=".scbench")
result = runner.run(agent_function=lambda task, work_dir: 
    run_minisweagent_task(task, work_dir, model_name="anthropic/claude-sonnet-4")
)

def my_agent(task_prompt: str, work_dir: Path) -> dict:
    return {"answer": json.loads((work_dir / "eval_answer.json").read_text())}

runner.run(agent_function=my_agent)

Built-in agents: run_minisweagent_task, run_claudecode_task, run_plotsagent_task

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 Schema

{
  "id": "unique_test_id",
  "task": "Task description for the agent",
  "data_node": "latch:///path/to/data.h5ad",
  "grader": {
    "type": "numeric_tolerance",
    "config": {
      "ground_truth": {"field": 42},
      "tolerances": {"field": {"type": "absolute", "value": 1}}
    }
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latch_eval_tools-0.1.15.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latch_eval_tools-0.1.15-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file latch_eval_tools-0.1.15.tar.gz.

File metadata

  • Download URL: latch_eval_tools-0.1.15.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.9

File hashes

Hashes for latch_eval_tools-0.1.15.tar.gz
Algorithm Hash digest
SHA256 6f23c3ed218a8853c39ea8bc7f5bf173c83858782276f2c2813b2e1d0e2651d6
MD5 4e511f69ae717a3b88b4fe673f45c190
BLAKE2b-256 2e7b3ce449e35f5f7d0a43bbe58ec77d3b9cb07adb3dd6b99e4cf48dac770856

See more details on using hashes here.

File details

Details for the file latch_eval_tools-0.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for latch_eval_tools-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 74645a4058214ab5ff3b27f111c0ed00c51af0cd0b5963ad3ef7b073faef732b
MD5 c8ceee3fbd4da0dc25c27b40beafa280
BLAKE2b-256 5d5ffc8bf37b3f8a779cd2b1d6bc4c42fdb3f5fc9717831ca911d6ed04b534f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page