Skip to content

external_adapter

diapason.learning.spec_search.external_adapter

Adapt external agent-dataset records into TraceStore rows.

LLM-guided spec search reads student traces from a SQLite TraceStore via its search/get tools. This adapter reuses that pipeline for external agent corpora (e.g. ADP, ToolOrchestra, GeneralThoughts): each EvalRecord from a provider becomes a synthetic Trace so the teacher proposer can reason over it without a live student run on the corpus task.

These synthetic traces carry feedback=0.5 by default (no ground truth). Tool calls are empty. The source_name tag in each trace's metadata is how multi-source corpora are filtered downstream.

write_external_records_as_traces(store, records, *, source_name, feedback_score=0.5)

Write each EvalRecord to store as a synthetic Trace.

The LLM-guided spec search proposer reads from the TraceStore via its search/get tools; this lets the diagnose phase substitute live student traces with records from pre-existing agent-task corpora (ADP / ToolOrchestra / GeneralThoughts).

Parameters:

Name Type Description Default
store TraceStore

Destination TraceStore.

required
records Iterable[EvalRecord]

Iterable of EvalRecord (e.g. from a dataset provider).

required
source_name str

Label recorded in each trace's metadata["source"] so multi-source setups can filter later.

required
feedback_score float

Value for Trace.feedback (0..1). Defaults to 0.5 because external records carry no ground-truth outcome.

0.5

Returns:

Type Description
int

Number of traces written.