Documentation
¶
Index ¶
- Constants
- Variables
- func BuildContrastiveCriteria(criteria map[string]string, shortlistKeys []string) map[string]string
- func CheckMediaKeys(body []byte) error
- func ErrorStatus(err error) (int, string)
- func FitsServingImage(req SystemOneRequest) bool
- func FormatInstructions(instr any) string
- func FormatState(state any) string
- func FusePriorWithGateMode(rawProbs map[string]float64, priorLogits map[string]float64, optKeys []string, ...) (probs map[string]float64, winner string, h, normH, rawH, rawNormH float64, ...)
- func FusePriorWithHesitationGate(rawProbs map[string]float64, priorLogits map[string]float64, optKeys []string, ...) (probs map[string]float64, winner string, h, normH, rawH, rawNormH float64, ...)
- func NewSystemOneHTTPHandler(cli *client.Client, opts EngineOptions) http.HandlerFunc
- func NormalizeAndScaleProbabilities(raw map[string]float64, optKeys []string, tempScale float64) (map[string]float64, string, float64, float64)
- func NormalizeCosinePriorLogits(cosines map[string]float64, temperature float64) map[string]float64
- func SaveSuiteJSONL(path string, rows []SuiteRow) error
- func ValidateImages(images []string) error
- type AreaSummary
- type BenchmarkSummary
- type CaseEvalResult
- type DecisionIndexReport
- type EngineOptions
- type EvaluationTrace
- type ShortlistFunc
- type SuiteRow
- type SystemOneAnswer
- type SystemOneMedia
- type SystemOneQuestion
- type SystemOneRequest
- type SystemOneResponse
Constants ¶
const ( // MaxOptionsPerSlot is the hardware/tokenizer ceiling of single-letter [A-Z] slot mapping in structured_server.py. MaxOptionsPerSlot = 26 // BracketSize is the chunk size used when partitioning wide choices (27..255 options) into Round-1 brackets. BracketSize = 20 // MaxSlotsPerPass is the safe per-pass slot count to prevent 256-token diffusion canvas overflow ("the canvas holds"). MaxSlotsPerPass = 8 )
const ( OptionOrderAlpha = "alpha" // sort option keys (default; the adapter's original behaviour) OptionOrderSource = "source" // keep the order the request listed them )
Option orders for EngineOptions.OptionOrder.
const ( LabelsAZ = "az" // A-Z, at most 26 options per read (default) LabelsAZAA = "az_aa" // A-Z then AA-AZ, at most 52 LabelsAZLower = "az_lower" // A-Z then a-z, at most 52 (server: requests of up to 10 questions) )
Label sets for EngineOptions.Labels (the serving image's "labels" schema key).
const DefaultCosinePriorTemperature = 0.07
DefaultCosinePriorTemperature is the default InfoNCE / bi-encoder temperature tau used when converting cosine similarity scores in [-1, 1] into normalized log-probabilities via NormalizeCosinePriorLogits.
Variables ¶
var ErrInvalidImage = errors.New("invalid image")
ErrInvalidImage marks an image reference the adapter refuses. Local file paths are rejected because the adapter runs as a network server: a path would read the adapter host's own filesystem.
var ErrInvalidRequest = errors.New("invalid request")
ErrInvalidRequest marks a request body or question the adapter can't read (400): an unknown question type, or criteria of the wrong shape for the type.
var ErrUnsupportedMedia = errors.New("unsupported media")
ErrUnsupportedMedia marks a request carrying media the model can't read (audio, video). DiffusionGemma is text + image only; such fields used to be dropped silently and the request answered as a guess.
var ErrUnsupportedQuestion = errors.New("unsupported question")
ErrUnsupportedQuestion marks a well-formed question the model can't answer in one read (422, the same class as the server's capacity refusals): a score question with no or more than MaxOptionsPerSlot levels, or repeated levels.
var OfficialAreas = []struct { ID string Label string }{ {ID: "knowledge", Label: "Knowledge & Reasoning"}, {ID: "language", Label: "Language Understanding"}, {ID: "retrieval", Label: "Retrieval & Classification"}, {ID: "tools", Label: "Tools & Automation"}, {ID: "arts", Label: "Arts & Human Judgment"}, }
Official 5 Areas from apolinario/decision-index/decision_index/constants.py
var OfficialChanceBaselines = map[string]float64{
"BFCL": 0.2592,
"ToolRet": 0.0937,
"API-Bank": 0.0189,
"BANKING77": 0.0127,
"CLINC150+OOS": 0.0066,
"RouterBench": 0.0909,
"ContractNLI": 0.3333,
"ANLI": 0.3333,
"BPoMP": 0.2500,
"Humicroedit": 0.5000,
"POP909-CL": 0.1250,
"cfcolor": 0.2000,
"MMLU": 0.2500,
"GPQA Diamond": 0.2500,
"GSM8K": 0.2000,
"ChessBench": 0.2500,
"BRIGHT": 0.1120,
"Amazon ESCI": 0.2500,
"iSarcasmEval": 0.2500,
"VAST": 0.3333,
"CRUXEval": 0.2500,
"CLadder": 0.5000,
"Habermas Machine": 0.2500,
}
OfficialChanceBaselines stores the frozen random-chance baselines (in 0..1 fraction) from decision_index/data/chance-baselines.json.
var PanelMembership = map[string]bool{ "MMLU": true, "GPQA Diamond": true, "GSM8K": true, "ChessBench": true, "CRUXEval": true, "CLadder": true, "ContractNLI": true, "iSarcasmEval": true, "VAST": true, "BRIGHT": true, "Amazon ESCI": true, "BFCL": true, "ToolRet": true, "RouterBench": true, "BPoMP": true, "Humicroedit": true, "POP909-CL": true, "cfcolor": true, "Habermas Machine": true, "API-Bank": false, "BANKING77": false, "CLINC150+OOS": false, "ANLI": false, }
PanelMembership indicates whether a dataset is in the 19-benchmark scored panel vs display-only.
var UnsupportedMediaKeys = []string{"audio", "audios", "video", "videos", "input_audio", "video_url", "videos_url"}
UnsupportedMediaKeys are top-level request fields refused with ErrUnsupportedMedia.
Functions ¶
func BuildContrastiveCriteria ¶
BuildContrastiveCriteria enriches each shortlisted option's description with the tokens that distinguish it from sibling candidates in the shortlist (e.g., pack counts "6x100ml" vs "1x100ml", variant badges, or compound suffixes).
func CheckMediaKeys ¶
CheckMediaKeys returns ErrUnsupportedMedia when a JSON request body has any of UnsupportedMediaKeys at top level. Bodies that aren't JSON objects pass (the caller's own decoding reports those).
func ErrorStatus ¶
ErrorStatus maps an ExecuteSystemOne error to the HTTP status and message the adapter answers with. Requests the server refuses (bad schema, too many options, an image it can't fetch or decode, context overflow) are the caller's to fix: 422 with the upstream message (the Decision Index kit scores 422 as a capacity refusal, not a failure). Everything else is 500. Shared by `dgem systemone serve` and the gateway's /v1/systemone route.
func FitsServingImage ¶
func FitsServingImage(req SystemOneRequest) bool
FitsServingImage reports whether the serving image's own /v1/systemone can answer req in one read exactly as sent: at most MaxSlotsPerPass questions (the server keeps its readable "lines" answer format up to 10), every choice with 2..MaxOptionsPerSlot options and every score with 2..MaxOptionsPerSlot levels, and only known question types. Requests that fit can be forwarded unchanged; the rest need the adapter (batching, brackets, one-option answers). Call after MergeMedia.
func FormatInstructions ¶
FormatInstructions converts instructions (string or structured object) into a concise string.
func FormatState ¶
FormatState converts an arbitrary Decision Index state (string or JSON object) into a valid JSON string for structured_server.py.
func FusePriorWithGateMode ¶
func FusePriorWithGateMode( rawProbs map[string]float64, priorLogits map[string]float64, optKeys []string, tempScale float64, priorWeight float64, hesitationGate float64, gateMode string, ) (probs map[string]float64, winner string, h, normH, rawH, rawNormH float64, fused bool)
FusePriorWithGateMode implements Pre-Gated Product-of-Experts Prior Fusion. It always computes temperature-scaled token probabilities and raw normalized hesitation (rawNormH = H_raw / ln K) before touching priorLogits so downstream cascade telemetry (RawNormalizedH) is never masked by priors. Supported gateMode schedules:
- "" or "confident": fuse with priorWeight when hesitationGate <= 0 || rawNormH < hesitationGate.
- "hesitant": fuse with priorWeight when rawNormH >= hesitationGate (breaks ties on uncertain items).
- "proportional": fuse with effective weight priorWeight * rawNormH.
- "always": fuse with priorWeight across all items while still preserving pre-fusion rawNormH.
func FusePriorWithHesitationGate ¶
func FusePriorWithHesitationGate( rawProbs map[string]float64, priorLogits map[string]float64, optKeys []string, tempScale float64, priorWeight float64, hesitationGate float64, ) (probs map[string]float64, winner string, h, normH, rawH, rawNormH float64, fused bool)
FusePriorWithHesitationGate implements Pre-Gated Product-of-Experts Prior Fusion using the default "confident" gate schedule (fusing when rawNormH < hesitationGate).
func NewSystemOneHTTPHandler ¶
func NewSystemOneHTTPHandler(cli *client.Client, opts EngineOptions) http.HandlerFunc
NewSystemOneHTTPHandler returns an http.HandlerFunc serving POST /v1/systemone compatible with `python -m decision_index run --engine http`.
func NormalizeAndScaleProbabilities ¶
func NormalizeAndScaleProbabilities(raw map[string]float64, optKeys []string, tempScale float64) (map[string]float64, string, float64, float64)
NormalizeAndScaleProbabilities applies temperature scaling T > 0, guarantees strict positivity and exact normalization (abs(sum(p)-1) < 1e-9) required by decision_index/engines/base.py:validate(), and returns (probabilities, argmaxWinner, shannonEntropyNats, normalizedEntropy).
func NormalizeCosinePriorLogits ¶
NormalizeCosinePriorLogits converts caller embedding cosine similarities s_k into temperature-scaled log-softmax logits:
l_k = (s_k / tau) - log(sum_j exp(s_j / tau))
Raw cosine scores occupy a narrow interval in [-1, 1] and carry an arbitrary scale across candidate counts K; normalizing them with a calibrated bi-encoder temperature (default DefaultCosinePriorTemperature = 0.07 when temperature <= 0) puts prior_logits onto a proper log-probability simplex while strictly preserving rank order for PriorLogitsShortlist. Non-finite entries (NaN, +-Inf) are ignored; returns nil when no finite entry exists.
func SaveSuiteJSONL ¶
SaveSuiteJSONL writes the SuiteRow slice to a JSONL file.
func ValidateImages ¶
ValidateImages checks that every image is a data: URI or an http(s) URL (empty entries are skipped, as client.BuildMultimodalContent does).
Types ¶
type AreaSummary ¶
type AreaSummary struct {
AreaID string `json:"area_id"`
Label string `json:"label"`
BenchmarkCount int `json:"benchmark_count"`
CoveragePct float64 `json:"coverage_pct"`
PlainScore float64 `json:"plain_score"` // Coverage-adjusted 0..100
SupportedScore float64 `json:"supported_score"` // On supported subset 0..100
SkillScore float64 `json:"skill_score"` // Chance-normalized 0..100
Benchmarks []BenchmarkSummary `json:"benchmarks"`
}
AreaSummary aggregates one of the 5 equal-weight areas of the Decision Index.
type BenchmarkSummary ¶
type BenchmarkSummary struct {
CatalogID int `json:"catalog_id"`
Dataset string `json:"dataset"`
Area string `json:"area"`
InPanel bool `json:"in_panel"`
TotalCases int `json:"total_cases"`
SupportedCases int `json:"supported_cases"`
CoveragePct float64 `json:"coverage_pct"`
SupportedScore float64 `json:"supported_score"` // 0..100 on supported cases
CoverageAdjScore float64 `json:"coverage_adj_score"` // 0..100 (unsupported = 0.0, official headline metric)
ChanceBaseline float64 `json:"chance_baseline"` // 0..100
SkillScore float64 `json:"skill_score"` // Chance-normalized skill 0..100
MeanBrier float64 `json:"mean_brier"`
MeanEntropy float64 `json:"mean_entropy"`
MeanNormalizedH float64 `json:"mean_normalized_entropy"`
MeanPassesPerReq float64 `json:"mean_passes_per_req"`
}
BenchmarkSummary aggregates metrics for one benchmark in the Decision Index panel.
type CaseEvalResult ¶
type CaseEvalResult struct {
ID string `json:"id"`
CatalogID int `json:"catalog_id"`
Dataset string `json:"dataset"`
Area string `json:"area"`
TotalFields int `json:"total_fields"`
CorrectFields int `json:"correct_fields"`
MaxOptions int `json:"max_options"`
WholeCaseExact bool `json:"whole_case_exact"`
FieldAccuracy float64 `json:"field_accuracy"`
Supported bool `json:"supported"`
ErrorMsg string `json:"error_msg,omitempty"`
MeanConfidence float64 `json:"mean_confidence"`
MeanBrier float64 `json:"mean_brier"`
MeanEntropy float64 `json:"mean_entropy"`
MeanNormalizedH float64 `json:"mean_normalized_entropy"`
ForwardPasses int `json:"forward_passes"`
WallTimeMs float64 `json:"wall_time_ms"`
Answers map[string]SystemOneAnswer `json:"answers,omitempty"`
Expected map[string]string `json:"expected,omitempty"`
}
CaseEvalResult stores the evaluation result for a single SuiteRow.
func ScoreSingleCase ¶
func ScoreSingleCase(row SuiteRow, resp *SystemOneResponse, err error) CaseEvalResult
ScoreSingleCase evaluates a SystemOneResponse against the expected gold answers of a SuiteRow.
type DecisionIndexReport ¶
type DecisionIndexReport struct {
SuiteEdition string `json:"suite_edition"`
EngineMode string `json:"engine_mode"`
TemperatureScale float64 `json:"temperature_scale"`
TotalRequests int `json:"total_requests"`
SupportedRequests int `json:"supported_requests"`
CoveragePct float64 `json:"coverage_pct"`
TotalFields int `json:"total_fields"`
TotalForwardPasses int `json:"total_forward_passes"`
HeadlineDecisionIndex float64 `json:"headline_decision_index"` // Mean of 5 equal-weight areas (coverage-adjusted, 0..100)
SupportedDecisionIndex float64 `json:"supported_decision_index"` // Mean of 5 areas on supported subset (0..100)
SkillDecisionIndex float64 `json:"skill_decision_index"` // Chance-normalized skill index (0..100)
WideOptionAccuracy float64 `json:"wide_option_accuracy"` // Accuracy on questions with K > 26 options
MultiSlotCanvasAcc float64 `json:"multi_slot_canvas_accuracy"` // Accuracy on requests with M > 10 slots
ECE10Bin float64 `json:"ece_10bin"`
MeanBrier float64 `json:"mean_brier"`
P50LatencyMs float64 `json:"p50_latency_ms"`
Areas []AreaSummary `json:"areas"`
DisplayBenchmarks []BenchmarkSummary `json:"display_benchmarks,omitempty"`
Results []CaseEvalResult `json:"results,omitempty"`
}
DecisionIndexReport is the complete official Decision Index scorecard (index.json + benchmark-summary.json).
func ComputeDecisionIndex ¶
func ComputeDecisionIndex(results []CaseEvalResult, engineMode string, tempScale float64) DecisionIndexReport
ComputeDecisionIndex aggregates CaseEvalResults into the official 5-Area Decision Index Report.
type EngineOptions ¶
type EngineOptions struct {
MaxSlotsPerPass int
MaxOptionsPerSlot int
NaiveLimits bool // If true, mimics naive 26-option / 10-slot capacity rejections (HTTP 422 Unsupported)
TemperatureScale float64 // Post-hoc slot temperature scaling T* (1.0 = unscaled, default)
MaxConcurrency int
DualMirror bool // Evaluate forward + reversed option orderings on the same diffusion canvas
NullPriorDebias bool // Divide out content-free positional 'A'-bias prior
PriorAlpha float64 // Damping exponent alpha in [0, 1] for null-prior de-biasing
BracketSize int // Max options per Round-1 bracket for wide (>26) choices; <=1 means BracketSize
CatchAll string // Wide-option catch-all handling: "off" (default), "final", "both" or "verify"; see catchAllKeys
NoulMode string // How yes/no questions are read: "noul" (default) or "choice" (2-option choice; see noulAsChoice)
Labels string // Server label set for choice options: "az" (default, 26) or "az_aa"/"az_lower" (52). Wide sets read up to 52 options natively and bracket above that with 52-wide brackets
OptionOrder string // How options are labelled A, B, C…: "alpha" (default, sorted keys) or "source" (request order)
PromptLayout string // Server prompt layout: "document_first" (default: state first, then questions) or "schema_first"/"" (questions as the system prompt)
PriorWeight float64 // Log-linear fusion weight alpha >= 0 for PriorLogits; 0 disables fusion (cascades should gate on RawNormalizedH)
HesitationGate float64 // Raw normalized entropy threshold tau in [0, 1] used by PriorGateMode (default 0.16)
PriorGateMode string // Gate schedule for PriorLogits: "confident" (default: fuse when rawNormH < tau), "hesitant" (rawNormH >= tau; recommended for tie-break priors), "proportional" (weight * rawNormH), or "always"
ShortlistTopK int // Candidate count M <= MaxOptionsPerSlot retained by ShortlistFunc for wide choices (default 0 = off)
ShortlistContrastive bool // Append [distinguishing: ...] sibling token tags on shortlisted wide choices (default false; schema-dependent)
ShortlistFunc ShortlistFunc
}
EngineOptions configures the Decision Index execution adapter.
func DefaultEngineOptions ¶
func DefaultEngineOptions() EngineOptions
DefaultEngineOptions returns production settings with Wide-Option Tournament + Multi-Slot Batching enabled (T*=1.0).
type EvaluationTrace ¶
type EvaluationTrace struct {
TotalQuestions int `json:"total_questions"`
MaxOptionsSeen int `json:"max_options_seen"`
ForwardPasses int `json:"forward_passes"`
WideBracketedQs int `json:"wide_bracketed_questions"`
MultiSlotBatches int `json:"multi_slot_batches"`
WallTimeMs float64 `json:"wall_time_ms"`
// ServerMs is the serving image's own time for this request: the sum of diagnostics.timing.total_ms over every
// pass the adapter made (batches, bracket rounds). Omitted when the server reports no timing.
ServerMs float64 `json:"server_ms,omitempty"`
TemperatureScale float64 `json:"temperature_scale,omitempty"`
}
EvaluationTrace records dgem's multi-slot batching and wide-option bracket telemetry.
type ShortlistFunc ¶
type ShortlistFunc func( ctx context.Context, stateText string, images []string, qKey string, q SystemOneQuestion, topK int, ) (shortlistKeys []string, priorLogits map[string]float64, err error)
ShortlistFunc selects at most topK candidate option keys (and optional stage-1 prior logits) for a wide choice question (K > MaxOptionsPerSlot) so it can be resolved in a single diffusion pass.
func LexicalOverlapShortlist ¶
func LexicalOverlapShortlist(defaultTopK int) ShortlistFunc
LexicalOverlapShortlist returns a ShortlistFunc that delegates to PriorLogitsShortlist when q.PriorLogits is populated, and otherwise scores each candidate option using generic IDF-weighted token/subword and character n-gram overlap between (stateText + q.Instructions) and the option's key/description, always preserving catch-all options.
func PriorLogitsShortlist ¶
func PriorLogitsShortlist(defaultTopK int) ShortlistFunc
PriorLogitsShortlist returns a ShortlistFunc that ranks options by q.PriorLogits (descending, tie-broken deterministically by option key), retaining the topK highest-prior options plus any catch-all options. When q.PriorLogits is empty, it returns nil so ExecuteSystemOne falls back to 2-stage bracket tournament routing.
type SuiteRow ¶
type SuiteRow struct {
ID string `json:"id"`
Family string `json:"family,omitempty"`
CatalogID int `json:"catalog_id"`
Dataset string `json:"dataset"`
Area string `json:"area"`
State any `json:"state"`
Questions map[string]SystemOneQuestion `json:"questions"`
Expected map[string]string `json:"expected"`
ChanceBase float64 `json:"chance_baseline,omitempty"`
}
SuiteRow represents one row from apolinario/decision-index selected-rows.jsonl(.gz) or panel_suite.jsonl.
func DefaultPanelSuite ¶
func DefaultPanelSuite() []SuiteRow
DefaultPanelSuite returns a curated 22-benchmark Decision Index evaluation suite spanning all 19 scored panel benchmarks across the 5 official areas + 3 wide-option display benchmarks (API-Bank, BANKING77, CLINC150+OOS). Specifically includes M > 10 multi-slot requests (ContractNLI, BRIGHT, ToolRet) and K > 26 wide-option choice slots (API-Bank 30 opts, BANKING77 32 opts, CLINC150+OOS 36 opts) that trigger HTTP 422 capacity rejections on naive 26-option / 10-slot engines.
func LoadSuiteJSONL ¶
LoadSuiteJSONL loads a Decision Index JSONL dataset from disk, or falls back to DefaultPanelSuite().
type SystemOneAnswer ¶
type SystemOneAnswer struct {
Type string `json:"type"`
Choice string `json:"choice,omitempty"`
Score *float64 `json:"score,omitempty"`
Legend map[string]string `json:"legend,omitempty"`
Probabilities map[string]float64 `json:"probabilities,omitempty"`
Noul *float64 `json:"noul,omitempty"`
// Confidence is the probability of the answer given (choice: the chosen option; score: the most likely level;
// noul: max(p, 1-p)), as the serving image's jev_answer reports it.
Confidence *float64 `json:"confidence,omitempty"`
Entropy float64 `json:"entropy,omitempty"`
NormalizedH float64 `json:"normalized_entropy,omitempty"`
PassesUsed int `json:"passes_used,omitempty"`
// RawEntropy and RawNormalizedH preserve the pre-prior-fusion token uncertainty when PriorLogits are supplied.
RawEntropy float64 `json:"raw_entropy,omitempty"`
RawNormalizedH float64 `json:"raw_normalized_entropy,omitempty"`
PriorFused bool `json:"prior_fused,omitempty"`
// Evidence records the co-denoised evidence slot choice when EvidencePrompt is set on the question.
Evidence string `json:"evidence,omitempty"`
}
SystemOneAnswer matches the per-question answer validated by decision_index.engines.base:validate(). Score answers follow the serving image's jev_answer: probabilities keyed "0".."n-1" (level index), score the 0-indexed expected level sum(i * p_i), legend the level text per index.
type SystemOneMedia ¶
SystemOneMedia is one entry of a request's "media" array. Data is a data: URI or raw base64 of MimeType. Other fields (e.g. "name") are ignored.
type SystemOneQuestion ¶
type SystemOneQuestion struct {
Type string `json:"type"`
Instructions any `json:"instructions"`
Criteria map[string]string `json:"criteria"`
// PriorLogits are optional caller-supplied per-option log-prior scores keyed by option name.
// Ignored by default; used for pre-gated log-linear fusion when EngineOptions.PriorWeight > 0, and reused
// for wide-option shortlist ranking when ShortlistFunc is enabled.
PriorLogits map[string]float64 `json:"prior_logits,omitempty"`
// EvidencePrompt requests a co-denoised evidence slot (<q>_evidence) ahead of the choice slot on the same canvas.
EvidencePrompt string `json:"evidence_prompt,omitempty"`
// EvidenceCriteria are the caller-supplied options for <q>_evidence (required when EvidencePrompt is set; at least 2 options).
EvidenceCriteria map[string]string `json:"evidence_criteria,omitempty"`
// EvidenceOrder is the EvidenceCriteria keys in the order the request listed them (set by UnmarshalJSON).
EvidenceOrder []string `json:"-"`
// Levels are a score question's levels, lowest first (criteria given as an array; set by UnmarshalJSON).
Levels []string `json:"-"`
// Order is the criteria keys in the order the request listed them (set by UnmarshalJSON). Go maps drop order;
// with EngineOptions.OptionOrder "source" the adapter labels options in this order instead of alphabetically.
Order []string `json:"-"`
}
SystemOneQuestion matches the Jev / apolinario/decision-index question specification. "criteria" is an object for choice and noul questions and an array of ordered levels for score questions:
{"type": "choice", "instructions": "...", "criteria": {"opt_key": "description", ...}}
{"type": "score", "instructions": "...", "criteria": ["lowest level", ..., "highest level"]}
func (*SystemOneQuestion) UnmarshalJSON ¶
func (q *SystemOneQuestion) UnmarshalJSON(b []byte) error
UnmarshalJSON accepts any JSON value as an option description. The Decision Index suite sends objects (POP909 chords, ChessBench moves) and arrays (cfcolor swatches) as well as strings. Strings pass through unchanged; any other value is rendered as compact JSON text for the prompt (a mechanical format conversion, no content change). A "criteria" array is read as score levels, in order. Before this a score question failed to parse and the gateway silently forwarded the whole request unbatched.
type SystemOneRequest ¶
type SystemOneRequest struct {
Model string `json:"model,omitempty"`
State any `json:"state"`
Questions map[string]SystemOneQuestion `json:"questions"`
// Images are data: URIs or http(s) URLs shown to the model ahead of the state, the same "images" field the
// serving image's /v1/systemone accepts. Every sub-request (batches and bracket rounds) carries them.
Images []string `json:"images,omitempty"`
// Media is an alias for Images in the form some Jev clients send: image/* entries are appended to
// Images by MergeMedia; any other type is refused.
Media []SystemOneMedia `json:"media,omitempty"`
}
SystemOneRequest matches the POST /v1/systemone payload sent by decision_index.engines.http:HttpSystemOne.
func (*SystemOneRequest) MergeMedia ¶
func (r *SystemOneRequest) MergeMedia() error
MergeMedia moves the request's image media into Images (after any images already there, in order) and clears Media. Non-image media is ErrUnsupportedMedia; a URL or an empty entry is ErrInvalidImage (URLs go in "images", where the gateway fetches them with its public-host checks). Safe to call more than once.
type SystemOneResponse ¶
type SystemOneResponse struct {
Answers map[string]SystemOneAnswer `json:"answers"`
EvaluationTrace *EvaluationTrace `json:"evaluation_trace,omitempty"`
}
SystemOneResponse matches the response envelope validated by decision_index.
func ExecuteSystemOne ¶
func ExecuteSystemOne(ctx context.Context, cli *client.Client, req SystemOneRequest, opts EngineOptions) (*SystemOneResponse, error)
ExecuteSystemOne evaluates a Decision Index request against a dgem Client, automatically applying: 1. Wide-Option Tournament Routing when any question has >26 options (up to 255 options) 2. Multi-Slot Canvas Batching when a request has >MaxSlotsPerPass simultaneous questions 3. Post-hoc Slot Temperature Scaling T* while strictly preserving argmax and sum(p)=1.0.