corpusio

package
v0.51.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package corpusio loads public tool-retrieval corpora into the bench types (spec 083, US3). Loaders are strict and deterministic: every record is validated, output slices are sorted by stable IDs, and seeded subsetting is reproducible across runs and machines (FR-011/012/013/014, FR-010).

Index

Constants

View Source
const (
	// LiveMCPToolLicense is the license of the LiveMCPTool corpus.
	LiveMCPToolLicense = "Apache-2.0"
	// LiveMCPToolAttribution credits the corpus source (paper arXiv:2508.01780).
	LiveMCPToolAttribution = "LiveMCPTool corpus from LiveMCPBench (ICIP/LiveMCPBench, icip-cas), arXiv:2508.01780"
	// LiveMCPToolSourceURL is the canonical dataset location.
	LiveMCPToolSourceURL = "https://huggingface.co/datasets/ICIP/LiveMCPBench"
)

LiveMCPTool corpus provenance, surfaced in the report's CorpusDescriptor rows (FR-012/013). Full provenance in the snapshot's ATTRIBUTION.md.

Variables

This section is empty.

Functions

func LoadLiveMCPTool

func LoadLiveMCPTool(path string) (*bench.Corpus, *bench.GoldenSet, string, error)

LoadLiveMCPTool reads the committed LiveMCPTool frozen snapshot and converts it into the bench-native Corpus for token/scale measurement (FR-011b).

Return shape: (corpus, goldenSet, goldenAbsenceReason, err). The golden set is always nil for this corpus — relevance labels are not derivable from the LiveMCPBench task annotations — and the reason string records that absence explicitly, per FR-011. Callers surfacing retrieval quality must skip this corpus and may print the reason.

Validation is strict and per-record: empty server/tool names, duplicate server:tool pairs, invalid schema JSON, and count drift against the snapshot's own server_count/tool_count header all fail with the offending record index (edge case: silent tool-count drift must warn loudly — here it is an error because the snapshot is frozen and self-describing).

Determinism (FR-010/021): tool order is the snapshot's committed order (canonically sorted by server:tool at capture) and schemas are compacted to canonical bytes at load, mirroring bench.LoadCorpusV2.

func SubsetQueries

func SubsetQueries(golden *bench.GoldenSet, seed int64, size int) (*bench.GoldenSet, error)

SubsetQueries returns a deterministic seeded subset of size queries (FR-014): the input queries are first sorted by ID (so the caller's order cannot leak into the selection), a math/rand permutation with the fixed seed picks the subset, and the result is re-sorted by ID. Identical revision + seed + size therefore always yields the identical subset. When size >= len(queries) the full sorted set is returned.

Types

type ToolRet

type ToolRet struct {
	// Corpus maps every ToolRet tool to a bench.Tool: ToolID/Name = upstream
	// id, Server = HF config (code|customized|web), Description = the full
	// `documentation` text (opaque — ToolRet docs are heterogeneous JSON/text,
	// NOT MCP input schemas, so Schema stays nil). Version =
	// "toolret-tools@<revision>".
	Corpus *bench.Corpus
	// Golden maps every scoreable query to a bench.GoldenQuery. Query is the
	// upstream `query` text only; the ToolRet `instruction` (its
	// instruction-following retrieval facet) is intentionally NOT concatenated
	// — the BM25 funnel under test receives what an agent would send, and the
	// limitation is documented here rather than hidden in the text.
	//
	// Relevance-grade mapping (FR-012): ToolRet label relevance is an integer
	// (value 1 = relevant at the pinned revision — the dataset is binary);
	// grades are mapped by IDENTITY onto the bench graded scale, so any
	// upstream grade >= 1 feeds NDCG gain unchanged, and labels with
	// relevance < 1 are dropped (bench semantics: 0/absent = irrelevant).
	Golden *bench.GoldenSet
	// ToolsRevision / QueriesRevision are the pinned HF revisions stamped by
	// the fetch script.
	ToolsRevision   string
	QueriesRevision string
	// DroppedUpstream echoes the fetch script's own per-record drop count
	// (dropped_empty_queries in the cache envelope).
	DroppedUpstream int
	// DroppedUnscoreable counts queries dropped at load because no label
	// survived the relevance >= 1 filter (unscoreable by every bench metric).
	DroppedUnscoreable int
}

ToolRet is the loaded ToolRet benchmark: corpus + golden set plus the provenance every report row needs (FR-011/012).

func LoadToolRet

func LoadToolRet(cacheDir string) (*ToolRet, error)

LoadToolRet reads a fetch-script cache directory (bench/results/cache/toolret/<revision>/) and maps it to bench types. Validation is per-record and fail-fast: missing IDs, empty text, duplicate IDs, dangling label references, and missing revision stamps are all errors with the offending record named (FR-011).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL