Judgment Labs Logo

Discovery

TypeScript JQL discovery kinds, options, and returned catalog rows.

judgeval-js JQL source on GitHub

client.discover(kind, options?: DiscoveryOptions & JqlRequestOptions)

Discovery returns the normal JqlQueryResponse envelope. Its rows vary by kind.

KindValid optionsReturned row columns
judgeshistory?, limit?Current: id, name, judge_type, score_type, online_evaluation_mode, judge_description; history: judge_name
behaviorshistory?, limit?Current: judge_id, judge_name, value, description; history: judge_name, values
span_namestime?, limit?span_name
modelstime?, limit?model
fieldssource required, limit?Field capability descriptor; see below
citationsjudge required, value?, time?, limit?trace_id, session_id, cited_spans, reason
ruleslimit?rule_id, name, description, conditions, active, actions
judge_promptslimit?name, judge_id, judge_major_version, prompt
judge_configlimit?name, judge_description, judge_type, score_type, online_evaluation_mode

source is valid only for fields and must be traces or spans. time is meaningful for span_names, models, and citations; discovery accepts last and since but not between, and passing time to a config-store kind fails with BAD_QUERY. judge is required for citations.

client.discover sends its limit as the request cap only. The IR-level limit shown below is set by building the discovery object directly.

Field descriptor

{
  "field": "cost",
  "label": "Cost",
  "source": "spans",
  "origin": "canonical",
  "data_type": "number",
  "unit": "usd",
  "filter_operators": ["eq", "ne", "gt", "gte", "lt", "lte"],
  "aggregate_functions": [
    "sum",
    "avg",
    "min",
    "max",
    "quantile",
    "count_distinct"
  ],
  "groupable": false,
  "sortable": true,
  "default_format": "currency_usd"
}

Use descriptors rather than assuming that a field can be filtered, grouped, sorted, or aggregated. Trace discovery also exposes derived span_count, which is a projection-only field and is not filterable, groupable, sortable, or aggregatable.

Canonical discovery IR

{
  "op": "discovery",
  "kind": "span_names",
  "time": { "last": "7d" },
  "limit": 100
}