Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyPromptLayout(schemaJSON, layout string) (string, error)
- func Execute()
- func FetchGCPAccessToken() string
- func FetchGCPAccessTokenWithStats() (string, bool)
- func FetchGCPIdentityToken(explicitAudience, targetURL string) string
- func FetchGCPIdentityTokenWithStats(explicitAudience, targetURL string) (string, bool)
- func GetClient() *client.Client
- func GetClientForURL(targetURL string) *client.Client
- func GetConfiguredCascadeModels() []string
- func InjectUnclassifiedCatchAll(schemaJSON string) (string, map[string]bool, map[string][]client.ProposedOption)
- func IsUnclassifiedBucket(choice string) bool
- func MarkGPUWarm(latencyMs ...int64)
- func NormalizeCascadeThresholdMode(mode string) (string, error)
- func NormalizePromptLayout(layout string) (string, error)
- func NormalizeStage2Prior(mode string) (string, error)
- func NotifyColdStartWarmup()
- func ParseSuggestedOptionFromThought(thought string) (client.ProposedOption, bool)
- func ParseSuggestedOptionFromThoughtWithExisting(thought string, existing []client.ProposedOption) (client.ProposedOption, bool)
- func PrintStats(stats *client.RequestStats)
- func RecordLocalReadoutLatency(latencyMs int64)
- func RecordVertexReadoutLatency(latencyMs int64)
- func SanitizeCascadeModel(raw string) string
- func SynthesizeTaxonomyExpansions(ctx context.Context, c *client.Client, templatePath string, ...) []client.TaxonomyExpansionSuggestion
- func VersionInfo() map[string]string
- func WithCascadeThresholdMode(ctx context.Context, mode string) context.Context
- func WithStage2Prior(ctx context.Context, mode string) context.Context
- type BBoxCoords
- type BatchExpectedSlot
- type BatchPresetItem
- type BatchPresetSuite
- type BboxBaseline
- type BboxBenchmarkReport
- type BboxCaseResult
- type BboxEdgeStats
- type BboxEdgeTelemetry
- type BboxGridSplit
- type BboxPairedOcclusion
- type BboxStat
- type BboxSuiteItem
- type BboxTagBreakdown
- type BboxVariantSummary
- type BenchmarkReport
- type CalibrationCase
- type CalibrationCaseResult
- type CalibrationGroupSummary
- type CalibrationReport
- type CascadeExecutionSummary
- type CascadeSlotTelemetry
- type CascadeSummary
- type CaseResult
- type CustomQuestionSpec
- type DecideCustomToolInput
- type DecidePolicyToolInput
- type DecisionIndexReceipt
- type EvalCase
- type GatewayDecideRequest
- type GatewayDecideResponse
- type GuidedCall
- type GuidedDgem
- type GuidedItemResult
- type GuidedReport
- type HealthAndGPUStatusOutput
- type IntentCase
- type IntentResult
- type JevCaseResult
- type JevManifestLock
- type JevParitySummary
- type JevQuestionSpec
- type JevReport
- type JevSplitLock
- type JevTask
- type JudgeItem
- type JudgeReport
- type JudgeSummary
- type ListTemplatesToolInput
- type ListTemplatesToolOutput
- type LocateBBoxToolInput
- type LocateBBoxToolOutput
- type LocateDgem
- type LocateGemini
- type LocateMask
- type LocateRequest
- type LocateResult
- type ReliabilityBin
- type StatusToolInput
- type TemperatureFit
- type TemplateCatalogEntry
- type TraceSpanRecord
- type VisionAnswer
- type VisionAspectSummary
- type VisionCaseResult
- type VisionItemRow
- type VisionReport
- type WarmupGPUInput
- type WarmupGPUOutput
- type WarmupStageBreakdown
- type WarmupTelemetryStats
Constants ¶
const ( DefaultCascadeGeminiModel = "gemini-3.8-flash" DefaultCascadeGeminiModels = "gemini-3.8-flash,gemini-3.5-flash-lite" )
const DefaultInjectedCatchAllDesc = "Unclassified, emerging topic, or out-of-scope pattern not covered by the listed options"
const DefaultInjectedCatchAllName = "other_unclassified"
Variables ¶
var ( Version = "dev" Commit = "" Date = "" )
Build metadata, set at build time with
-ldflags "-X github.com/GoogleCloudPlatform/dgem/cmd.Version=v0.1.0 -X github.com/GoogleCloudPlatform/dgem/cmd.Commit=<sha> -X github.com/GoogleCloudPlatform/dgem/cmd.Date=<rfc3339>"
Version is `git describe --tags --match 'v*'`: a release tag such as v0.4.0 on a release build, or v0.4.0-3-gabc1234 for commits after it. Unset values fall back to Go's embedded module/VCS BuildInfo so `go install github.com/GoogleCloudPlatform/dgem@vX.Y.Z` reports vX.Y.Z rather than "dev".
var CascadeThresholdModes = []string{"nats", "normalized"}
CascadeThresholdModes are the accepted cascade_threshold_mode values. "nats" (default) compares raw Shannon entropy, which grows with the option count (max ln K), so wide slots escalate more readily; "normalized" compares H / ln K, the Studio's Hesitation scale (#123).
var ErrImageFetch = client.ErrImageFetch
ErrImageFetch marks an image URL the gateway could not fetch or that is not an image: the caller's input, so 422. It is pkg/client's sentinel, so errors from either fetch path compare equal.
var PromptLayouts = []string{"document_first", "schema_first"}
PromptLayouts are the serving image's prompt layouts (schema key "layout", serving v0.2.0+):
- document_first: the state first, then the questions, both in the user turn (the server default from v0.2.0)
- schema_first: the questions as the system prompt, the state as the user turn (the layout before v0.2.0)
See docs/policies/prompt-layout.md.
var RootCmd = &cobra.Command{
Use: "dgem",
Short: "dgem is a CLI assistant and evaluation tool for DiffusionGemma",
Long: `dgem interacts with local or remote DiffusionGemma inference engines.
It provides high-performance discrete diffusion slot readout decisions (slot-evaluated
in a single forward pass without conversational text overhead),
generative prompt execution, Go template rendering, and comprehensive request/response telemetry.`,
}
RootCmd is the base command for dgem.
var Stage2PriorModes = []string{"full", "soft", "none"}
Stage2PriorModes control how much of Stage 1's answer the Stage-2 prompt shows (issue #75):
- full: Stage 1's answer, confidence, entropy and full distribution, presented as "the candidate";
- soft: only that a fast first stage leaned toward an answer and may be wrong;
- none: the question alone (allowed values are still enforced by the response schema).
Functions ¶
func ApplyPromptLayout ¶
ApplyPromptLayout sets the "layout" key of a rendered schema. An empty layout leaves the schema untouched (the template's own "layout", if any, or the server default), so servers and backends that predate the key never see it.
func FetchGCPAccessToken ¶
func FetchGCPAccessToken() string
FetchGCPAccessToken mints an OAuth2 access token (cloud-platform scope) for Vertex AI Endpoints (:rawPredict). It checks (1) GOOGLE_OAUTH_ACCESS_TOKEN, (2) GCP Metadata Server, (3) pure-Go ADC (application_default_credentials.json), and (4) gcloud CLI.
func FetchGCPAccessTokenWithStats ¶ added in v0.4.1
FetchGCPAccessTokenWithStats returns the OAuth2 access token and whether it was served without a network/CLI mint (either from the in-memory tokenCache or GOOGLE_OAUTH_ACCESS_TOKEN).
func FetchGCPIdentityToken ¶
FetchGCPIdentityToken mints an OIDC identity token for Cloud Run IAM / IAP, or automatically mints an OAuth2 access token when targetURL is a Vertex AI Endpoint (:rawPredict).
func FetchGCPIdentityTokenWithStats ¶ added in v0.4.1
FetchGCPIdentityTokenWithStats returns the OIDC identity token (or Vertex OAuth2 access token) and whether it hit tokenCache.
func GetClientForURL ¶
GetClientForURL returns a configured API client targeting an explicit upstream URL (either a Cloud Run /v1 URL, IAP Gateway URL, or Vertex AI :rawPredict endpoint URL).
func GetConfiguredCascadeModels ¶
func GetConfiguredCascadeModels() []string
GetConfiguredCascadeModels returns the ordered list of selectable Stage-2 Gemini 3.x models from DGEM_CASCADE_MODELS or --cascade-models (defaulting to gemini-3.8-flash, gemini-3.5-flash-lite).
func InjectUnclassifiedCatchAll ¶
func InjectUnclassifiedCatchAll(schemaJSON string) (string, map[string]bool, map[string][]client.ProposedOption)
InjectUnclassifiedCatchAll inspects a rendered schema JSON string and appends an "other_unclassified" option to any "type": "choice" question that lacks a catch-all option and has fewer than 26 options.
func IsUnclassifiedBucket ¶
IsUnclassifiedBucket returns true if a choice name represents an unknown, OOS, or catch-all bucket.
func MarkGPUWarm ¶
func MarkGPUWarm(latencyMs ...int64)
MarkGPUWarm records that the upstream Cloud Run vLLM engine successfully completed a decision readout and wakes any callers waiting on an in-flight warmup broadcast channel.
func NormalizeCascadeThresholdMode ¶
NormalizeCascadeThresholdMode validates a threshold mode; "" means "nats".
func NormalizePromptLayout ¶
NormalizePromptLayout validates a layout name. An empty value means "the server's default" and is returned as "".
func NormalizeStage2Prior ¶
NormalizeStage2Prior validates a prior mode; "" means the default (DGEM_CASCADE_PRIOR, else "soft": on image cascades at 0.10 nats, soft scored +2.6 points over full and was never worse on text, issue #75).
func NotifyColdStartWarmup ¶
func NotifyColdStartWarmup()
NotifyColdStartWarmup ensures that if a decision request arrives while the GPU is scaled to zero, the global status coordinator immediately starts the single-flight background warmup worker (just as if "Wake GPU" had been pressed) and guarantees warmupInProgress is cleared on completion or timeout.
func ParseSuggestedOptionFromThought ¶
func ParseSuggestedOptionFromThought(thought string) (client.ProposedOption, bool)
ParseSuggestedOptionFromThought extracts a {"name", "description"} pair from DiffusionGemma's thought text.
func ParseSuggestedOptionFromThoughtWithExisting ¶
func ParseSuggestedOptionFromThoughtWithExisting(thought string, existing []client.ProposedOption) (client.ProposedOption, bool)
ParseSuggestedOptionFromThoughtWithExisting extracts a {"name", "description"} pair from DiffusionGemma's thought text, including DiffusionGemma's native `* <entity> (<DomainA>/<DomainB>)` thought decomposition bullets.
func PrintStats ¶
func PrintStats(stats *client.RequestStats)
PrintStats prints formatted telemetry from the request and response.
func RecordLocalReadoutLatency ¶
func RecordLocalReadoutLatency(latencyMs int64)
RecordLocalReadoutLatency records the most recent local diffgemma (Metal) readout latency without marking the scale-to-zero Cloud Run GPU container as warm.
func RecordVertexReadoutLatency ¶
func RecordVertexReadoutLatency(latencyMs int64)
RecordVertexReadoutLatency records the most recent Vertex AI /invoke/* readout latency without marking the scale-to-zero Cloud Run GPU container as warm.
func SanitizeCascadeModel ¶
SanitizeCascadeModel keeps Stage 2 on generally available Gemini models (default gemini-3.8-flash). Older or pre-GA aliases are remapped: gemini-3.5-flash and gemini-3.7-flash -> gemini-3.8-flash, gemini-3.1-flash-lite -> gemini-3.5-flash-lite, and any gemini-1.x / gemini-2.x -> gemini-3.8-flash.
func SynthesizeTaxonomyExpansions ¶
func SynthesizeTaxonomyExpansions( ctx context.Context, c *client.Client, templatePath string, stateContent string, resp *client.StructuredDecisionResponse, injectedSlots map[string]bool, existingOptions map[string][]client.ProposedOption, entropyThreshold float64, upstreamURL ...string, ) []client.TaxonomyExpansionSuggestion
SynthesizeTaxonomyExpansions checks all choice slots in resp.Answers for unclassified ("other*") selections or high Shannon entropy (H >= entropyThreshold) and generates ProposedOption expansions.
func VersionInfo ¶
VersionInfo is reported by `dgem --version` and the gateway's /health.
func WithCascadeThresholdMode ¶
WithCascadeThresholdMode sets the threshold mode for cascades run with this context.
Types ¶
type BBoxCoords ¶
type BatchExpectedSlot ¶
type BatchExpectedSlot struct {
Question string `json:"question"` // Slot key in template (e.g. "urgent", "team", "answer")
Label string `json:"label"` // Short human-readable question prompt
Type string `json:"type"` // "bool" | "choice" | "score"
Expected string `json:"expected"` // Ground-truth answer string
}
BatchExpectedSlot describes a single ground-truth question slot within a batch evaluation item.
type BatchPresetItem ¶
type BatchPresetItem struct {
ID string `json:"id"`
Domain string `json:"domain"`
Tier string `json:"tier"`
Preview string `json:"preview"`
Template string `json:"template,omitempty"`
CustomTemplate string `json:"custom_template,omitempty"`
Variables map[string]interface{} `json:"variables"`
ExpectedSlots []BatchExpectedSlot `json:"expected_slots"`
// ImageURL is an optional image (URL or data URI) for multimodal items.
ImageURL string `json:"image_url,omitempty"`
}
BatchPresetItem represents one evaluation item (1 forward pass, 1 or more question slots).
type BatchPresetSuite ¶
type BatchPresetSuite struct {
ID string `json:"id"`
Title string `json:"title"`
Category string `json:"category"`
Badge string `json:"badge"`
Description string `json:"description"`
DefaultConcurrency int `json:"default_concurrency"`
TotalItems int `json:"total_items"`
TotalQuestions int `json:"total_questions"`
Items []BatchPresetItem `json:"items"`
}
BatchPresetSuite represents a named collection of benchmark items for real-time batch evaluation.
type BboxBaseline ¶
type BboxBaseline struct {
Name string `json:"name"`
Description string `json:"description"`
MeanIoU BboxStat `json:"mean_iou"`
AccAt50Pct float64 `json:"acc_at_50_pct"`
CenterHitPct float64 `json:"center_hit_pct"`
Box *[4]float64 `json:"box,omitempty"`
LiftExpectation BboxStat `json:"model_expectation_lift"`
LiftArgmax BboxStat `json:"model_argmax_lift"`
}
BboxBaseline is a predictor that ignores the image, scored on the original variant.
type BboxBenchmarkReport ¶
type BboxBenchmarkReport struct {
Timestamp string `json:"timestamp"`
Mode string `json:"mode"`
TargetURL string `json:"target_url"`
TargetModel string `json:"target_model"`
ServerVersion string `json:"server_version,omitempty"`
ServerRevision string `json:"server_revision,omitempty"`
GitCommit string `json:"git_commit,omitempty"`
Dataset string `json:"dataset,omitempty"`
Repeats int `json:"repeats,omitempty"`
Samples int `json:"samples,omitempty"`
VariantsRequested []string `json:"variants_requested,omitempty"`
SourceReceipt string `json:"source_receipt,omitempty"`
TotalCases int `json:"total_cases"`
MeanArgmaxIoU float64 `json:"mean_argmax_iou"`
MeanExpectationIoU float64 `json:"mean_expectation_iou"`
SubBinIoUGainPct float64 `json:"subbin_iou_gain_pct"`
AccAt50ArgmaxPct float64 `json:"acc_at_50_argmax_pct"`
AccAt50ExpectationPct float64 `json:"acc_at_50_expectation_pct"`
AccAt75ArgmaxPct float64 `json:"acc_at_75_argmax_pct"`
AccAt75ExpectationPct float64 `json:"acc_at_75_expectation_pct"`
VisibleEdgeMeanHNorm float64 `json:"visible_edge_mean_h_norm"`
OccludedEdgeMeanHNorm float64 `json:"occluded_edge_mean_h_norm"`
OcclusionEntropyRatio float64 `json:"occlusion_entropy_multiplier"`
Baselines []BboxBaseline `json:"baselines,omitempty"`
Breakdowns []BboxTagBreakdown `json:"breakdowns,omitempty"`
Variants []BboxVariantSummary `json:"variants,omitempty"`
Cases []BboxCaseResult `json:"cases"`
}
BboxBenchmarkReport summarizes a full run. The top-level metric fields describe the original variant (averaged over repeats) and keep the pre-2026-10 receipt shape.
type BboxCaseResult ¶
type BboxCaseResult struct {
ID string `json:"id"`
Variant string `json:"variant,omitempty"`
Repeat int `json:"repeat"`
Tier string `json:"tier"`
PairID string `json:"pair_id,omitempty"`
Target string `json:"target"`
Tags map[string]string `json:"tags,omitempty"`
ObjectPresentGT bool `json:"object_present_gt"`
ObjectPresentPred bool `json:"object_present_pred"`
PresenceAsked bool `json:"presence_asked,omitempty"`
OccludedEdge string `json:"occluded_edge"`
GTBox [4]float64 `json:"gt_box"`
GTBox2 *[4]float64 `json:"gt_box_2,omitempty"`
ArgmaxBox [4]float64 `json:"argmax_box"`
ExpectationBox [4]float64 `json:"expectation_box"`
ArgmaxBox2 *[4]float64 `json:"argmax_box_2,omitempty"`
ExpectationBox2 *[4]float64 `json:"expectation_box_2,omitempty"`
ObjectsSwapped bool `json:"objects_swapped,omitempty"`
ClassHits int `json:"class_hits,omitempty"`
ClassTotal int `json:"class_total,omitempty"`
ArgmaxIoU float64 `json:"argmax_iou"`
ExpectationIoU float64 `json:"expectation_iou"`
VisibleIoU *float64 `json:"visible_iou,omitempty"`
IoUGain float64 `json:"iou_gain"`
PassAcc50 bool `json:"pass_acc_50"`
PassAcc75 bool `json:"pass_acc_75"`
InvalidBox bool `json:"invalid_box,omitempty"`
MissingSlots []string `json:"missing_slots,omitempty"`
MaxEdgeEntropy float64 `json:"max_edge_normalized_entropy"`
HighestEntropyDir string `json:"highest_entropy_edge"`
Edges map[string]BboxEdgeTelemetry `json:"edges,omitempty"`
Skipped string `json:"skipped,omitempty"`
Error string `json:"error,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
}
BboxCaseResult captures the outcome for a single fixture, variant and repeat.
type BboxEdgeStats ¶
type BboxEdgeStats struct {
SignedBiasExpectation float64 `json:"signed_bias_expectation"`
SignedBiasArgmax float64 `json:"signed_bias_argmax"`
MAEArgmax float64 `json:"mae_argmax"`
MAEExpectation float64 `json:"mae_expectation"`
MeanHNorm float64 `json:"mean_h_norm"`
N int `json:"n"`
}
BboxEdgeStats summarizes one box edge across cases.
type BboxEdgeTelemetry ¶
type BboxEdgeTelemetry struct {
QuestionID string `json:"question_id,omitempty"`
Edge string `json:"edge,omitempty"`
ArgmaxBin string `json:"argmax_bin"`
ArgmaxCoord float64 `json:"argmax_coord"`
ExpectedCoord float64 `json:"expected_coord"`
Confidence float64 `json:"confidence"`
RawEntropyNats float64 `json:"raw_entropy_nats"`
NormalizedEntropy float64 `json:"normalized_entropy"`
// K is the number of labels the slot offers; LabelsReturned how many came back with a
// probability (fewer than K means the entropy is over a truncated distribution).
K int `json:"k,omitempty"`
LabelsReturned int `json:"labels_returned,omitempty"`
BinWidth float64 `json:"bin_width,omitempty"`
LabelMin float64 `json:"label_min,omitempty"`
LabelMax float64 `json:"label_max,omitempty"`
GTCoord float64 `json:"gt_coord,omitempty"`
HasGT bool `json:"has_gt,omitempty"`
Missing bool `json:"missing,omitempty"`
NoDistribution bool `json:"no_distribution,omitempty"`
}
BboxEdgeTelemetry stores one coordinate slot's prediction and normalized entropy.
type BboxGridSplit ¶
type BboxGridSplit struct {
OnGridN int `json:"on_grid_n"`
OnGridMAEArgmax float64 `json:"on_grid_mae_argmax"`
OnGridMAEExpectation float64 `json:"on_grid_mae_expectation"`
OffGridN int `json:"off_grid_n"`
OffGridMAEArgmax float64 `json:"off_grid_mae_argmax"`
OffGridMAEExpect float64 `json:"off_grid_mae_expectation"`
// QuantizationFloorMAE is the mean distance from ground truth to the nearest label: the
// error a perfect argmax reader would still make. Error above it is localization error.
QuantizationFloorMAE float64 `json:"quantization_floor_mae"`
// ArgmaxBinsOff counts edges by how many label steps the argmax sits from the label
// nearest the ground truth.
ArgmaxBinsOff map[int]int `json:"argmax_bins_off"`
}
BboxGridSplit compares argmax and expectation error on edges whose ground truth sits on a label (no quantization error) against edges between labels.
type BboxPairedOcclusion ¶
type BboxPairedOcclusion struct {
PairID string `json:"pair_id"`
OccludedEdge string `json:"occluded_edge"`
HOccluded float64 `json:"h_norm_occluded_edge"`
HTwin float64 `json:"h_norm_same_edge_in_twin"`
Delta float64 `json:"delta_occluded_edge"`
OtherEdgesDelta float64 `json:"delta_other_edges_mean"`
// RankInCase is the occluded edge's entropy rank among the 4 edges (1 = highest).
RankInCase int `json:"occluded_edge_rank_in_case"`
}
BboxPairedOcclusion compares an occluded image's entropy with its unoccluded twin.
type BboxStat ¶
type BboxStat struct {
Mean float64 `json:"mean"`
Lo float64 `json:"ci95_lo"`
Hi float64 `json:"ci95_hi"`
N int `json:"n"`
}
BboxStat is a mean with a case-level bootstrap 95% interval.
type BboxSuiteItem ¶
type BboxSuiteItem struct {
ID string `json:"id"`
Tier string `json:"tier"`
PairID string `json:"pair_id,omitempty"`
Template string `json:"template"`
ImagePath string `json:"image_path"`
SVGPath string `json:"svg_path"`
Target string `json:"target"`
ObjectPresent bool `json:"object_present"`
GTBoxContinuous [4]float64 `json:"gt_box_continuous"`
SecondaryBoxContinuous *[4]float64 `json:"secondary_box_continuous,omitempty"`
OccludedEdge string `json:"occluded_edge"`
ExpectedDiscreteSlots map[string]interface{} `json:"expected_discrete_slots"`
Notes string `json:"notes"`
// Tags label the factors of a generated sweep (scripts/generate_bbox_sweep.py); the report
// breaks results down by every tag value.
Tags map[string]string `json:"tags,omitempty"`
// VisibleBoxContinuous is the unoccluded part of the target when it differs from the full box.
VisibleBoxContinuous *[4]float64 `json:"visible_box_continuous,omitempty"`
}
BboxSuiteItem represents a row in benchmarks/bbox_suite.jsonl.
type BboxTagBreakdown ¶
type BboxTagBreakdown struct {
Tag string `json:"tag"`
Value string `json:"value"`
Cases int `json:"cases"`
BoxCases int `json:"box_cases"`
MeanExpectationIoU BboxStat `json:"mean_expectation_iou"`
AccAt50Pct float64 `json:"acc_at_50_pct"`
CenterHitPct float64 `json:"center_hit_pct"`
MeanVisibleIoU *float64 `json:"mean_visible_iou,omitempty"`
// PresentRate: share of runs answered "present" (on absent targets, the false-positive rate).
PresentRate float64 `json:"present_rate"`
// TaggedEdgeHNorm: mean normalized entropy of the edge named by the case's "edge" tag.
TaggedEdgeHNorm *float64 `json:"tagged_edge_h_norm,omitempty"`
MeanMaxEdgeHNorm float64 `json:"mean_max_edge_h_norm"`
}
BboxTagBreakdown summarizes original-variant results for one tag value of a generated sweep.
type BboxVariantSummary ¶
type BboxVariantSummary struct {
Variant string `json:"variant"`
Runs int `json:"runs"`
Cases int `json:"cases"`
BoxCases int `json:"box_cases"`
Skipped int `json:"skipped"`
Errors int `json:"errors"`
MeanArgmaxIoU BboxStat `json:"mean_argmax_iou"`
MeanExpectationIoU BboxStat `json:"mean_expectation_iou"`
AccAt50Argmax float64 `json:"acc_at_50_argmax_pct"`
AccAt50Expectation float64 `json:"acc_at_50_expectation_pct"`
AccAt75Argmax float64 `json:"acc_at_75_argmax_pct"`
AccAt75Expectation float64 `json:"acc_at_75_expectation_pct"`
// CenterHitPct: share of box runs whose expectation-box centre lies inside the true box (a
// "click" hit, as in ScreenSpot). Unlike IoU it does not punish small targets for edge error.
CenterHitPct float64 `json:"center_hit_pct"`
// Expectation-minus-argmax IoU, split by whether every edge is on a label.
ExpectationGainOnGrid BboxStat `json:"expectation_gain_on_grid_cases"`
ExpectationGainOffGrid BboxStat `json:"expectation_gain_off_grid_cases"`
MissingSlotRuns int `json:"missing_slot_runs"`
InvalidBoxRate float64 `json:"invalid_box_rate"`
PresenceAsked int `json:"presence_asked"`
// PredictedPresentRate is how often the model answered "present" when asked; on the blank
// variant it should be near 0.
PredictedPresentRate *float64 `json:"predicted_present_rate,omitempty"`
PresenceCorrect int `json:"presence_correct"`
AbsentRuns int `json:"absent_runs"`
FalsePositives int `json:"false_positives"`
ClassAccuracy *float64 `json:"class_accuracy,omitempty"`
MeanPredictedBox [4]float64 `json:"mean_predicted_expectation_box"`
Edges map[string]BboxEdgeStats `json:"edges"`
Grid BboxGridSplit `json:"grid_split"`
// EntropyErrorAUROC: does an edge's normalized entropy rank edges whose argmax is more
// than one label step from the ground truth above the rest? 0.5 = no signal.
EntropyErrorAUROC float64 `json:"entropy_error_auroc"` // -1 when undefined (no distributions)
EntropyErrorPositive int `json:"entropy_error_positive"`
EntropyErrorNegative int `json:"entropy_error_negative"`
// Spearman correlation between edge entropy and absolute expectation error.
EntropyErrorSpearman float64 `json:"entropy_error_spearman"` // -1 when undefined
PairedOcclusion []BboxPairedOcclusion `json:"paired_occlusion,omitempty"`
// Repeat stability (only with --repeat > 1).
EdgeArgmaxAgreement *float64 `json:"edge_argmax_agreement,omitempty"`
RepeatPairwiseIoU *float64 `json:"repeat_pairwise_expectation_iou,omitempty"`
// Transform consistency: IoU between the variant's box and the original's box mapped
// into the variant's frame (same case, same repeat). Needs no ground truth.
ConsistencyIoU *BboxStat `json:"consistency_iou_vs_transformed_original,omitempty"`
}
BboxVariantSummary aggregates one variant across cases and repeats.
type BenchmarkReport ¶
type BenchmarkReport struct {
Timestamp string `json:"timestamp"`
TargetURL string `json:"target_url"`
TargetModel string `json:"target_model"`
TotalCases int `json:"total_cases"`
FailedCases int `json:"failed_cases"`
TotalRetries int `json:"total_retries"`
Workers int `json:"workers"`
TotalElapsedSec float64 `json:"total_elapsed_sec"`
Mode string `json:"mode"`
SlotAvgDenoise float64 `json:"slot_avg_denoise_ms"`
SlotAvgWall float64 `json:"slot_avg_wall_ms"`
SlotAccuracy float64 `json:"slot_accuracy_pct"`
SlotMultiReads int `json:"slot_multi_reads_triggered"`
GenAvgWall float64 `json:"gen_avg_wall_ms,omitempty"`
GenAvgTokens float64 `json:"gen_avg_tokens,omitempty"`
GenSyntaxRate float64 `json:"gen_syntax_rate_pct,omitempty"`
Cases []CaseResult `json:"cases"`
}
BenchmarkReport summarizes the aggregated benchmark run.
type CalibrationCase ¶
type CalibrationCase struct {
ID string `json:"id"`
Metric string `json:"metric"`
Tier string `json:"tier"`
Category string `json:"category"`
Fields map[string]string `json:"fields"`
Expected string `json:"expected"`
}
CalibrationCase represents one item in benchmarks/calibration_suite.jsonl.
type CalibrationCaseResult ¶
type CalibrationCaseResult struct {
ID string `json:"id"`
TemperatureApplied float64 `json:"temperature_applied,omitempty"` // per-case T of a k-fold --auto-temperature report
Metric string `json:"metric"`
Category string `json:"category"`
Tier string `json:"tier"`
Expected string `json:"expected"`
Actual string `json:"actual"`
Accurate bool `json:"accurate"`
Confidence float64 `json:"confidence"`
Entropy float64 `json:"entropy_nats"`
NormalizedEntropy float64 `json:"normalized_entropy,omitempty"`
VocabCardinality int `json:"vocab_cardinality,omitempty"`
ChanceBaseline float64 `json:"chance_baseline,omitempty"`
BrierScore float64 `json:"brier_score,omitempty"`
TVDGold float64 `json:"tvd_gold,omitempty"`
Stderr float64 `json:"stderr,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
Escalated bool `json:"escalated,omitempty"`
PriorGuided bool `json:"prior_guided,omitempty"`
Pass1Actual string `json:"pass1_actual,omitempty"`
Pass1Accurate bool `json:"pass1_accurate,omitempty"`
Pass1Entropy float64 `json:"pass1_entropy_nats,omitempty"`
Pass1NormalizedEntropy float64 `json:"pass1_normalized_entropy,omitempty"`
Pass1LatencyMs float64 `json:"pass1_latency_ms,omitempty"`
Pass2LatencyMs float64 `json:"pass2_latency_ms,omitempty"`
TopProbabilities map[string]float64 `json:"top_probabilities,omitempty"`
IDC *permutation.SlotIDCDetail `json:"idc,omitempty"`
Error string `json:"error,omitempty"`
}
CalibrationCaseResult holds the evaluated decision and uncertainty telemetry for one item.
type CalibrationGroupSummary ¶
type CalibrationGroupSummary struct {
Name string `json:"name"`
Total int `json:"total"`
Correct int `json:"correct"`
AccuracyPct float64 `json:"accuracy_pct"`
ChanceBaselinePct float64 `json:"chance_baseline_pct,omitempty"`
ChanceCorrectedPct float64 `json:"chance_corrected_pct,omitempty"`
AvgConfidence float64 `json:"avg_confidence"`
AvgEntropy float64 `json:"avg_entropy_nats"`
AvgNormalizedEntropy float64 `json:"avg_normalized_entropy,omitempty"`
AvgBrierScore float64 `json:"avg_brier_score,omitempty"`
ECE10Bin float64 `json:"ece_10bin,omitempty"`
AvgLatencyMs float64 `json:"avg_latency_ms"`
}
CalibrationGroupSummary aggregates accuracy and uncertainty metrics for a category or tier.
type CalibrationReport ¶
type CalibrationReport struct {
Timestamp string `json:"timestamp"`
IDCConfig string `json:"idc_config,omitempty"`
IDCWarning string `json:"idc_warning,omitempty"`
TargetURL string `json:"target_url"`
TargetModel string `json:"target_model"`
Workers int `json:"workers"`
TotalCases int `json:"total_cases"`
TotalCorrect int `json:"total_correct"`
OverallAccuracyPct float64 `json:"overall_accuracy_pct"`
ChanceBaselinePct float64 `json:"chance_baseline_pct,omitempty"`
ChanceCorrectedAccPct float64 `json:"chance_corrected_acc_pct,omitempty"`
AvgConfidence float64 `json:"avg_confidence"`
AvgEntropyNats float64 `json:"avg_entropy_nats"`
AvgNormalizedEntropy float64 `json:"avg_normalized_entropy,omitempty"`
AvgBrierScore float64 `json:"avg_brier_score,omitempty"`
ECE10Bin float64 `json:"ece_10bin,omitempty"`
P50LatencyMs float64 `json:"p50_latency_ms,omitempty"`
P95LatencyMs float64 `json:"p95_latency_ms,omitempty"`
AvgWallTimeMs float64 `json:"avg_wall_time_ms"`
TotalElapsedSec float64 `json:"total_elapsed_sec"`
TemperatureScale float64 `json:"temperature_scale,omitempty"`
TemperatureFit *TemperatureFit `json:"temperature_fit,omitempty"`
JevParity *JevParitySummary `json:"jev_parity,omitempty"`
Cascade *CascadeSummary `json:"cascade,omitempty"`
Categories []CalibrationGroupSummary `json:"categories"`
Tiers []CalibrationGroupSummary `json:"tiers"`
Cases []CalibrationCaseResult `json:"cases"`
}
CalibrationReport represents the full exported JSON report.
type CascadeExecutionSummary ¶
type CascadeExecutionSummary struct {
Mode string `json:"mode"`
Model string `json:"model"`
Threshold float64 `json:"threshold"`
// ThresholdMode says what Threshold is compared with: "nats" (raw entropy) or "normalized" (entropy / ln K).
ThresholdMode string `json:"threshold_mode"`
Triggered bool `json:"triggered"`
EscalatedCount int `json:"escalated_count"`
TotalSlots int `json:"total_slots"`
LatencyMs int64 `json:"latency_ms"`
Error string `json:"error,omitempty"`
Slots map[string]CascadeSlotTelemetry `json:"slots,omitempty"`
// ImageCount is how many images were sent to Stage 2 with the escalated slots.
ImageCount int `json:"image_count,omitempty"`
// Prior is how Stage 1's answer was shown to Stage 2: "full", "soft" or "none" (see Stage2PriorModes).
Prior string `json:"prior,omitempty"`
}
CascadeExecutionSummary summarizes Stage 2 Gemini escalation for a decision call.
func ExecuteStage2GeminiCascade ¶
func ExecuteStage2GeminiCascade( ctx context.Context, cascadeMode string, cascadeThreshold float64, requestedModel string, expectedAnswers map[string]string, schemaContent string, stateContent string, resp *client.StructuredDecisionResponse, ) *CascadeExecutionSummary
ExecuteStage2GeminiCascade evaluates whether any slot in resp.Answers requires Stage 2 escalation under cascadeMode ("entropy" or "on_miss") and forwards escalated slots to Vertex AI Gemini 3.x (defaulting to gemini-3.8-flash) with Stage 1 DiffusionGemma restricted-softmax priors.
func ExecuteStage2GeminiCascadeWithImages ¶
func ExecuteStage2GeminiCascadeWithImages( ctx context.Context, cascadeMode string, cascadeThreshold float64, requestedModel string, expectedAnswers map[string]string, schemaContent string, stateContent string, resp *client.StructuredDecisionResponse, images []string, ) *CascadeExecutionSummary
ExecuteStage2GeminiCascadeWithImages is ExecuteStage2GeminiCascade for multimodal decisions: the images Stage 1 saw (local paths, data: URIs or http(s) URLs) are sent to Stage 2 too, so Gemini resolves image questions from the image rather than from Stage 1's distribution alone.
type CascadeSlotTelemetry ¶
type CascadeSlotTelemetry struct {
QuestionID string `json:"question_id"`
Escalated bool `json:"escalated"`
Reason string `json:"reason,omitempty"`
Stage1Value string `json:"stage1_value"`
Stage1Confidence float64 `json:"stage1_confidence"`
Stage1Entropy float64 `json:"stage1_entropy"`
// Stage1NormalizedEntropy is Stage1Entropy / ln K (K = number of options), the Studio's Hesitation scale.
Stage1NormalizedEntropy float64 `json:"stage1_normalized_entropy"`
Stage2Value string `json:"stage2_value,omitempty"`
Stage2Confidence float64 `json:"stage2_confidence,omitempty"`
Explanation string `json:"explanation,omitempty"`
}
CascadeSlotTelemetry records Stage 1 (dgemma) vs Stage 2 (Gemini 3.x) per-slot resolution.
type CascadeSummary ¶
type CascadeSummary struct {
CascadeMode string `json:"cascade_mode,omitempty"`
Pass1Model string `json:"pass1_model"`
Pass2Model string `json:"pass2_model"`
EntropyThreshold float64 `json:"entropy_threshold_nats"`
NormalizedEntropy bool `json:"normalized_entropy,omitempty"`
PriorGuided bool `json:"prior_guided,omitempty"`
SelfThinkTokens int `json:"self_think_tokens,omitempty"`
TotalCases int `json:"total_cases"`
EscalatedCases int `json:"escalated_cases"`
EscalationRatePct float64 `json:"escalation_rate_pct"`
Pass1Correct int `json:"pass1_correct"`
Pass1AccuracyPct float64 `json:"pass1_accuracy_pct"`
CascadeCorrect int `json:"cascade_correct"`
CascadeAccuracyPct float64 `json:"cascade_accuracy_pct"`
AccuracyGainPct float64 `json:"accuracy_gain_pct"`
Pass1AvgLatencyMs float64 `json:"pass1_avg_latency_ms"`
Pass2AvgLatencyMs float64 `json:"pass2_avg_latency_ms"`
CascadeAvgLatMs float64 `json:"cascade_avg_latency_ms"`
}
CascadeSummary holds metrics when running an Entropy-Gated Cascade (Cross-Model or Intra-Model Self-Cascade).
type CaseResult ¶
type CaseResult struct {
ID string `json:"id"`
Domain string `json:"domain"`
Tier string `json:"tier"`
SlotAccurate bool `json:"slot_accurate"`
SlotDenoiseMs float64 `json:"slot_denoise_ms"`
SlotPrefillMs float64 `json:"slot_prefill_ms"`
SlotWallTimeMs float64 `json:"slot_wall_time_ms"`
SlotSamples int `json:"slot_samples"`
SlotExtended bool `json:"slot_extended"`
SlotRetries int `json:"slot_retries,omitempty"`
Error string `json:"error,omitempty"`
HTTPStatus int `json:"http_status,omitempty"`
SlotAnswers map[string]interface{} `json:"slot_answers,omitempty"`
GenWallTimeMs float64 `json:"gen_wall_time_ms,omitempty"`
GenTokens int `json:"gen_tokens,omitempty"`
GenValidJSON bool `json:"gen_valid_json,omitempty"`
GenResponse string `json:"gen_response,omitempty"`
}
CaseResult holds measured telemetry for one evaluation item.
type CustomQuestionSpec ¶
type CustomQuestionSpec struct {
ID string `json:"id" jsonschema:"Short slot identifier (e.g. 'is_urgent', 'category')."`
Type string `json:"type" jsonschema:"Question type: 'boolean', 'choice' (<=26 options), or 'score' (1..5)."`
Question string `json:"question" jsonschema:"Prompt question for this slot."`
Options []string `json:"options,omitempty" jsonschema:"List of choices (required when type is 'choice', max 26)."`
}
type DecideCustomToolInput ¶
type DecideCustomToolInput struct {
Context string `json:"context" jsonschema:"Input text, document, code diff, or event log to evaluate."`
Questions []CustomQuestionSpec `json:"questions" jsonschema:"List of structured decision slots to evaluate simultaneously in 1 forward pass."`
Backend string `` /* 209-byte string literal not displayed */
VertexURL string `json:"vertex_url,omitempty" jsonschema:"Optional Vertex AI Endpoint ID or /invoke/* URL override."`
Image string `` /* 160-byte string literal not displayed */
CascadeMode string `` /* 239-byte string literal not displayed */
CascadeThreshold float64 `` /* 202-byte string literal not displayed */
CascadeThresholdMode string `` /* 217-byte string literal not displayed */
CascadeModel string `` /* 147-byte string literal not displayed */
ExpectedAnswers map[string]string `json:"expected_answers,omitempty" jsonschema:"Optional map of slot_id -> expected value for 'on_miss' cascade mode."`
SuggestExpansions bool `` /* 232-byte string literal not displayed */
ExpansionEntropy float64 `` /* 155-byte string literal not displayed */
Stage2Prior string `` /* 259-byte string literal not displayed */
Temperature float64 `` /* 204-byte string literal not displayed */
TemperatureByType map[string]float64 `` /* 172-byte string literal not displayed */
Layout string `` /* 235-byte string literal not displayed */
}
type DecidePolicyToolInput ¶
type DecidePolicyToolInput struct {
Template string `` /* 170-byte string literal not displayed */
Variables map[string]interface{} `json:"variables" jsonschema:"Key-value map of template variables (e.g. {'ticket': 'Double charged on invoice #9481'})."`
Image string `json:"image,omitempty" jsonschema:"Optional image URL or base64 data URI for multimodal policies."`
Backend string `` /* 295-byte string literal not displayed */
VertexURL string `json:"vertex_url,omitempty" jsonschema:"Optional Vertex AI Endpoint ID or /invoke/* URL override."`
CascadeMode string `` /* 239-byte string literal not displayed */
CascadeThreshold float64 `` /* 202-byte string literal not displayed */
CascadeThresholdMode string `` /* 217-byte string literal not displayed */
CascadeModel string `` /* 147-byte string literal not displayed */
ExpectedAnswers map[string]string `json:"expected_answers,omitempty" jsonschema:"Optional map of slot_id -> expected value for 'on_miss' cascade mode."`
SuggestExpansions bool `` /* 232-byte string literal not displayed */
ExpansionEntropy float64 `` /* 155-byte string literal not displayed */
Stage2Prior string `` /* 259-byte string literal not displayed */
Temperature float64 `` /* 242-byte string literal not displayed */
TemperatureByType map[string]float64 `` /* 172-byte string literal not displayed */
Layout string `` /* 235-byte string literal not displayed */
}
type DecisionIndexReceipt ¶
type DecisionIndexReceipt struct {
Timestamp string `json:"timestamp"`
Endpoint string `json:"endpoint"`
Model string `json:"model"`
DgemReport *decisionindex.DecisionIndexReport `json:"dgem_wide_canvas_report"`
NaiveReport *decisionindex.DecisionIndexReport `json:"naive_26opt_10slot_report,omitempty"`
HeadlineDelta float64 `json:"headline_index_delta,omitempty"`
CoverageDelta float64 `json:"coverage_pct_delta,omitempty"`
}
DecisionIndexReceipt bundles the full dgem Wide-Canvas Decision Index report alongside the Naive 26-opt/10-slot baseline comparison.
type EvalCase ¶
type EvalCase struct {
ID string `json:"id"`
Domain string `json:"domain"`
Template string `json:"template"`
Variables map[string]interface{} `json:"variables"`
Expected map[string]string `json:"expected"`
Tier string `json:"tier"`
}
EvalCase represents a single labeled benchmark item.
type GatewayDecideRequest ¶
type GatewayDecideRequest struct {
Template string `json:"template,omitempty"`
CustomTemplate string `json:"custom_template,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty"`
Image string `json:"image,omitempty"`
ImageURL string `json:"image_url,omitempty"`
Images []string `json:"images,omitempty"`
Backend string `json:"backend,omitempty"`
VertexURL string `json:"vertex_url,omitempty"`
CascadeMode string `json:"cascade_mode,omitempty"` // "off" (default), "entropy", or "on_miss"
CascadeThreshold float64 `json:"cascade_threshold,omitempty"` // default 0.35 nats, or 0.16 with cascade_threshold_mode "normalized"
// CascadeThresholdMode: "nats" (default, raw entropy) or "normalized" (entropy / ln K, the Hesitation scale).
CascadeThresholdMode string `json:"cascade_threshold_mode,omitempty"`
CascadeModel string `json:"cascade_model,omitempty"` // default "gemini-3.8-flash"
ExpectedAnswers map[string]string `json:"expected_answers,omitempty"` // optional slot_id -> expected value for "on_miss" cascade
SuggestExpansions bool `json:"suggest_expansions,omitempty"` // dynamically inject 'other_unclassified' and propose new {"name", "description"} options
ExpansionEntropy float64 `json:"expansion_entropy,omitempty"` // Shannon entropy threshold (in nats) for expansion suggestions (default 0.35)
Layout string `json:"layout,omitempty"` // prompt layout: "document_first" | "schema_first"; empty = template or server default
Stage2Prior string `json:"stage2_prior,omitempty"` // how Stage 1's answer is shown to the Stage-2 cascade: "full" | "soft" | "none"; empty = DGEM_CASCADE_PRIOR or "soft"
Temperature *client.Temperature `json:"temperature,omitempty"` // post-hoc temperature: a number, or {"noul":T,"choice":T,"score":T}; overrides the template's "temperature"
}
GatewayDecideRequest is the JSON body accepted by POST /api/decide.
type GatewayDecideResponse ¶
type GatewayDecideResponse struct {
Template string `json:"template"`
Answers map[string]client.QuestionAnswer `json:"answers"`
Diagnostics client.Diagnostics `json:"diagnostics"`
Decision *client.StructuredDecisionResponse `json:"decision,omitempty"`
Cascade *CascadeExecutionSummary `json:"cascade,omitempty"`
Temperature *client.Temperature `json:"temperature,omitempty"` // temperature applied to the answers (request, else template), if any
SuggestedExpansions []client.TaxonomyExpansionSuggestion `json:"suggested_expansions,omitempty"`
MaxEntropy float64 `json:"max_entropy"`
WallTimeMs int64 `json:"wall_time_ms"`
GpuForwardMs int64 `json:"gpu_forward_ms"`
ColdStartWaitMs int64 `json:"cold_start_wait_ms"`
WarmupAttempts int `json:"warmup_attempts"`
Model string `json:"model"`
BackendTarget string `json:"backend_target"`
UpstreamURL string `json:"upstream_url"`
TraceID string `json:"trace_id,omitempty"`
TraceSpans []TraceSpanRecord `json:"trace_spans,omitempty"`
}
GatewayDecideResponse is returned by POST /api/decide.
type GuidedCall ¶
type GuidedCall struct {
ItemID string `json:"item_id"`
Positive bool `json:"positive"`
Condition string `json:"condition"`
Strategy string `json:"strategy"`
Thinking string `json:"thinking"`
Present bool `json:"present"`
BoxPct *[4]float64 `json:"box_pct,omitempty"`
Polygon [][2]float64 `json:"polygon_pct,omitempty"` // [y, x] percent
Cropped bool `json:"cropped,omitempty"`
CropPct *[4]float64 `json:"crop_pct,omitempty"`
FellBack bool `json:"fell_back,omitempty"`
GeminiMs float64 `json:"gemini_ms"`
PromptTokens int32 `json:"prompt_tokens"`
ImageTokens int32 `json:"image_tokens"`
ThoughtToks int32 `json:"thought_tokens"`
OutputTokens int32 `json:"output_tokens"`
Calls int `json:"calls"`
Error string `json:"error,omitempty"`
}
GuidedCall is one Gemini call (or chain, for crop with fallback) under one condition.
type GuidedDgem ¶
type GuidedDgem struct {
Present string `json:"present"`
PresentH float64 `json:"present_h_norm"`
GridCell string `json:"grid_cell"`
GridH float64 `json:"grid_h_norm"`
Ms float64 `json:"ms"`
Error string `json:"error,omitempty"`
CellCorrect *bool `json:"cell_correct,omitempty"`
}
GuidedDgem is dgem's first pass for an item.
type GuidedItemResult ¶
type GuidedItemResult struct {
ID string `json:"id"`
Target string `json:"target"`
Positive bool `json:"positive"`
GTBox *[4]float64 `json:"gt_box,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Dgem GuidedDgem `json:"dgem"`
Calls []GuidedCall `json:"calls"`
}
type GuidedReport ¶
type GuidedReport struct {
Timestamp string `json:"timestamp"`
GeminiModel string `json:"gemini_model"`
DgemModel string `json:"dgem_model"`
ServerVersion string `json:"server_version,omitempty"`
Dataset string `json:"dataset"`
Conditions []string `json:"conditions"`
NegConditions []string `json:"neg_conditions"`
Confident float64 `json:"confident_h_norm"`
GitCommit string `json:"git_commit,omitempty"`
Items []GuidedItemResult `json:"items"`
}
type HealthAndGPUStatusOutput ¶
type HealthAndGPUStatusOutput struct {
GatewayHealthy bool `json:"gateway_healthy"`
GPUAvailable bool `json:"gpu_available"`
GPUState string `json:"gpu_state"` // "warm_and_ready", "warming_up", "scaled_to_zero"
ActiveBackend string `json:"active_backend"` // "vertex" or "cloudrun"
RequestedBackend string `json:"requested_backend"` // "vertex_first", "vertex", or "cloudrun"
ContainerReachable bool `json:"container_reachable"`
WarmupInProgress bool `json:"warmup_in_progress"`
WarmupElapsedSeconds int `json:"warmup_elapsed_seconds,omitempty"`
WarmupPhase string `json:"warmup_phase,omitempty"`
WarmupPhaseLabel string `json:"warmup_phase_label,omitempty"`
WarmupBytesStagedGB float64 `json:"warmup_bytes_staged_gb,omitempty"`
EWMAWakeSeconds int `json:"ewma_wake_seconds"`
SecondsSinceLastRead int `json:"seconds_since_last_read,omitempty"`
IdleRemainingSeconds int `json:"idle_remaining_seconds,omitempty"`
IdleTTLSeconds int `json:"idle_ttl_seconds,omitempty"`
LastReadoutMs int64 `json:"last_readout_ms,omitempty"`
EstimatedWakeSeconds int `json:"estimated_wake_seconds"`
UpstreamURL string `json:"upstream_url"`
Model string `json:"model"`
GPUTier string `json:"gpu_tier"`
TemplatesAvailable int `json:"templates_available"`
AuthenticatedUser string `json:"authenticated_user,omitempty"`
Detail string `json:"detail"`
}
HealthAndGPUStatusOutput is returned by GET /api/status and the get_health_and_gpu_status MCP tool.
func CheckHealthAndGPUStatus ¶
func CheckHealthAndGPUStatus(ctx context.Context, userEmail string) HealthAndGPUStatusOutput
CheckHealthAndGPUStatus inspects both the gateway, the Vertex AI Dedicated Endpoint (when vertex_first or vertex is configured), and the upstream Cloud Run GPU service.
func CheckHealthAndGPUStatusForBackend ¶
func CheckHealthAndGPUStatusForBackend(ctx context.Context, userEmail, backendOverride string) HealthAndGPUStatusOutput
CheckHealthAndGPUStatusForBackend inspects the readiness and telemetry of the requested backend target ("vertex_first", "vertex", or "cloudrun").
type IntentCase ¶
type IntentCase struct {
ID string `json:"id"`
Dataset string `json:"dataset"`
Text string `json:"text"`
ExpectedDomain string `json:"expected_domain,omitempty"`
ExpectedIntent string `json:"expected_intent"`
IsOOS bool `json:"is_oos,omitempty"`
Domains []string `json:"domains,omitempty"`
Options []string `json:"options"`
}
type IntentResult ¶
type IntentResult struct {
ID string `json:"id"`
Dataset string `json:"dataset"`
Text string `json:"text"`
IsOOS bool `json:"is_oos,omitempty"`
ExpectedDomain string `json:"expected_domain,omitempty"`
ActualDomain string `json:"actual_domain,omitempty"`
DomainAccurate bool `json:"domain_accurate,omitempty"`
ExpectedIntent string `json:"expected_intent"`
Pass1Intent string `json:"pass1_intent"`
Pass1Accurate bool `json:"pass1_accurate"`
ActualIntent string `json:"actual_intent"`
IntentAccurate bool `json:"intent_accurate"`
Confidence float64 `json:"confidence"`
Logprob float64 `json:"logprob"`
Entropy float64 `json:"entropy"`
TopProbabilities map[string]float64 `json:"top_probabilities,omitempty"`
TieBreakTriggered bool `json:"tie_break_triggered"`
FinalistOptions []string `json:"finalist_options,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
}
type JevCaseResult ¶
type JevCaseResult struct {
ID string `json:"id"`
Tier string `json:"tier"`
Family string `json:"family"`
Topic string `json:"topic,omitempty"`
Group string `json:"group,omitempty"`
QuestionType string `json:"question_type"`
VocabCardinality int `json:"vocab_cardinality"`
ChanceBaseline float64 `json:"chance_baseline"`
Expected string `json:"expected"`
Actual string `json:"actual"`
Accurate bool `json:"accurate"`
Confidence float64 `json:"confidence"`
Entropy float64 `json:"entropy_nats"`
NormalizedEnt float64 `json:"normalized_entropy"`
BrierScore float64 `json:"brier_score"`
TVDGold float64 `json:"tvd_gold,omitempty"`
HasGoldProbs bool `json:"has_gold_probs,omitempty"`
EvidenceFocus string `json:"evidence_focus,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
Escalated bool `json:"escalated,omitempty"`
PriorGuided bool `json:"prior_guided,omitempty"`
Pass1Actual string `json:"pass1_actual,omitempty"`
Pass1Accurate bool `json:"pass1_accurate,omitempty"`
Pass1Entropy float64 `json:"pass1_entropy,omitempty"`
Pass1NormalizedEnt float64 `json:"pass1_normalized_entropy,omitempty"`
Pass1LatencyMs float64 `json:"pass1_latency_ms,omitempty"`
Pass2LatencyMs float64 `json:"pass2_latency_ms,omitempty"`
TopProbabilities map[string]float64 `json:"top_probabilities,omitempty"`
TemperatureApplied float64 `json:"temperature_applied,omitempty"` // per-task T of a k-fold --auto-temperature report
ScoreReadout string `json:"score_readout,omitempty"` // score items: "ordinal" (levels sent as a score question) or "flattened" (--flatten-score)
IDC *permutation.SlotIDCDetail `json:"idc,omitempty"`
GoldProbs map[string]float64 `json:"gold_probs,omitempty"`
Error string `json:"error,omitempty"`
}
JevCaseResult records per-item evaluation telemetry on JevBench.
type JevManifestLock ¶
type JevManifestLock struct {
UpstreamRepo string `json:"upstream_repo"`
GitRef string `json:"git_ref"`
CommitSHA string `json:"commit_sha"`
Protocol string `json:"protocol"`
SyncedAtUTC string `json:"synced_at_utc"`
TotalPublic int `json:"total_public_items"`
UnifiedSHA256 string `json:"unified_dataset_sha256"`
Splits []JevSplitLock `json:"splits"`
TopicsRevision string `json:"topics_revision,omitempty"`
}
JevManifestLock is stored in benchmarks/jevbench/manifest.lock.json.
type JevParitySummary ¶
type JevParitySummary struct {
ProtocolVersion string `json:"protocol_version"`
TemperatureApplied float64 `json:"temperature_applied"`
TemperatureMethod string `json:"temperature_method,omitempty"` // kfold: cases carry their own held-out T; the T=1 columns are then held-out values
OptimalTemperature float64 `json:"optimal_temperature"`
ChanceBaselinePct float64 `json:"chance_baseline_pct"`
ChanceCorrectedAccPct float64 `json:"chance_corrected_acc_pct"`
IntelligenceScore float64 `json:"intelligence_score"`
CalibrationScore float64 `json:"calibration_score"`
SpeedScore float64 `json:"speed_score"`
CostScore float64 `json:"cost_score"`
CompositeJevBenchScore float64 `json:"composite_jevbench_score"`
ECE10Bin float64 `json:"ece_10bin"`
BrierMean float64 `json:"brier_mean"`
SoftTVDMean float64 `json:"soft_tvd_mean"`
ProbabilityFidelity float64 `json:"probability_fidelity"`
P50LatencySec float64 `json:"p50_latency_sec"`
P95LatencySec float64 `json:"p95_latency_sec"`
USDPer1kDecisions float64 `json:"usd_per_1k_decisions"`
Presets map[string]float64 `json:"presets"`
RawT1ECE10Bin float64 `json:"raw_t1_ece_10bin"`
RawT1BrierMean float64 `json:"raw_t1_brier_mean"`
RawT1CalibrationScore float64 `json:"raw_t1_calibration_score"`
RawT1CompositeScore float64 `json:"raw_t1_composite_score"`
ReliabilityBins []ReliabilityBin `json:"reliability_bins"`
// JevBench v1.4 Protocol Metrics (composite_v14.py)
EndpointKind string `json:"endpoint_kind,omitempty"`
RawSpeedScore float64 `json:"raw_speed_score,omitempty"`
AdjustedSpeedScore float64 `json:"adjusted_speed_score,omitempty"`
V14IntelligenceScore float64 `json:"v14_intelligence_score,omitempty"`
V14CalibrationScore float64 `json:"v14_calibration_score,omitempty"`
V14CompositeScore float64 `json:"v14_composite_score,omitempty"`
V14PublicOnlyEstimate bool `json:"v14_public_only_estimate,omitempty"`
SealedAccuracy float64 `json:"sealed_accuracy,omitempty"`
GapPenaltyPct float64 `json:"gap_penalty_pct,omitempty"`
}
JevParitySummary holds the JevBench v1.3.1 & v1.4 4-Axis parity metrics and temperature-scaling comparison.
type JevQuestionSpec ¶
type JevQuestionSpec struct {
Type string `json:"type"`
Instructions string `json:"instructions"`
Criteria interface{} `json:"criteria,omitempty"`
}
JevQuestionSpec holds the JevBench rubric definition.
type JevReport ¶
type JevReport struct {
Timestamp string `json:"timestamp"`
IDCConfig string `json:"idc_config,omitempty"`
IDCWarning string `json:"idc_warning,omitempty"`
Source string `json:"source"`
TargetURL string `json:"target_url"`
TargetModel string `json:"target_model"`
LockCommitSHA string `json:"lock_commit_sha,omitempty"`
TotalCases int `json:"total_cases"`
TotalCorrect int `json:"total_correct"`
OverallAccuracyPct float64 `json:"overall_accuracy_pct"`
ChanceBaselinePct float64 `json:"chance_baseline_pct"`
ChanceCorrectedAccPct float64 `json:"chance_corrected_acc_pct"`
ParaphrasePairs int `json:"paraphrase_pairs"`
ParaphraseBothCorrect int `json:"paraphrase_both_correct"`
ParaphraseConsistPct float64 `json:"paraphrase_consistency_pct"`
TemperatureScale float64 `json:"temperature_scale"`
TemperatureFit *TemperatureFit `json:"temperature_fit,omitempty"`
MultiSlotEvidence bool `json:"multi_slot_evidence,omitempty"`
FlippedOptions bool `json:"flipped_options,omitempty"`
Cascade *CascadeSummary `json:"cascade,omitempty"`
JevParity *JevParitySummary `json:"jev_parity"`
ByTier []CalibrationGroupSummary `json:"by_tier"`
ByFamily []CalibrationGroupSummary `json:"by_family"`
ByTopic []CalibrationGroupSummary `json:"by_topic"`
Cases []JevCaseResult `json:"cases"`
}
JevReport represents the full exported JevBench evaluation report.
type JevSplitLock ¶
type JevSplitLock struct {
Name string `json:"name"`
Tier string `json:"tier"`
Items int `json:"items"`
SHA256 string `json:"sha256"`
CanonicalSHA256 string `json:"canonical_sha256,omitempty"`
SourceURL string `json:"source_url"`
}
JevSplitLock records cryptographic hashes for one synced split.
type JevTask ¶
type JevTask struct {
ID string `json:"id"`
Tier string `json:"tier"`
Family string `json:"family"`
Topic string `json:"topic,omitempty"`
State interface{} `json:"state"`
Question JevQuestionSpec `json:"question"`
Labels []string `json:"labels"`
Expected interface{} `json:"expected"`
Split string `json:"split"`
Group *string `json:"group,omitempty"`
Provenance map[string]interface{} `json:"provenance,omitempty"`
}
JevTask represents a unified canonical task record from fstandhartinger/jevbench.
type JudgeItem ¶
type JudgeItem struct {
Source string `json:"source"` // calibration | receipt
CaseID string `json:"case_id"`
Perturbation string `json:"perturbation,omitempty"`
Shift float64 `json:"shift,omitempty"`
Repeat int `json:"repeat,omitempty"`
GTBox [4]float64 `json:"gt_box"`
Box [4]float64 `json:"box"`
IoU float64 `json:"iou"`
EdgeErrors [4]float64 `json:"edge_errors"` // signed, + = toward bottom/right
TruthEdges [4]string `json:"truth_edges"`
JudgeEdges [4]string `json:"judge_edges,omitempty"`
JudgeOK bool `json:"judge_acceptable"`
LatencyMs float64 `json:"latency_ms,omitempty"`
Error string `json:"error,omitempty"`
}
JudgeItem is one judged box.
type JudgeReport ¶
type JudgeReport struct {
Timestamp string `json:"timestamp"`
JudgeModel string `json:"judge_model"`
Dataset string `json:"dataset"`
Receipt string `json:"receipt,omitempty"`
ReceiptOf string `json:"receipt_target_model,omitempty"`
Tol float64 `json:"tol"`
Off float64 `json:"off"`
GitCommit string `json:"git_commit,omitempty"`
Summaries []JudgeSummary `json:"summaries"`
Items []JudgeItem `json:"items"`
}
type JudgeSummary ¶
type JudgeSummary struct {
Source string `json:"source"`
Items int `json:"items"`
Errors int `json:"errors"`
// Three-class edge verdicts (correct / too_far_in / too_far_out) against the truth at --tol.
EdgeAccuracy3 float64 `json:"edge_accuracy_3class"`
EdgeKappa3 float64 `json:"edge_kappa_3class"`
Confusion map[string]int `json:"confusion_truth_to_judge"`
// Binary: judge says not-correct vs edge more than --off points wrong (ambiguous band excluded).
EdgeBinaryN int `json:"edge_binary_n"`
EdgeRecallWrong float64 `json:"edge_recall_wrong"`
EdgeSpecificity float64 `json:"edge_specificity"`
EdgeBinaryKappa float64 `json:"edge_binary_kappa"`
DirectionCorrect float64 `json:"direction_accuracy_on_flagged_wrong"`
// Box level. The judge's "acceptable" means "tight": compare it with "all four edges within
// --tol" (primary) and, for reference, with IoU >= 0.75.
BoxAgreementTight float64 `json:"box_agreement_all_edges_within_tol"`
BoxKappaTight float64 `json:"box_kappa_all_edges_within_tol"`
ActualTightRate float64 `json:"actual_all_edges_within_tol_rate"`
BoxAgreement float64 `json:"box_agreement_iou75"`
BoxKappa float64 `json:"box_kappa_iou75"`
JudgePassRate float64 `json:"judge_pass_rate"`
ActualPassRate75 float64 `json:"actual_pass_rate_iou75"`
// FlagRateByError: share of edges the judge called not-correct, by absolute edge error (points).
// The error at which it crosses 0.5 is the judge's practical resolution.
FlagRateByError map[string]float64 `json:"flag_rate_by_abs_error"`
FlagCountByError map[string]int `json:"edges_by_abs_error"`
// Calibration only: share of shifted edges the judge called correct, by shift size.
CorrectRateByShift map[string]float64 `json:"judged_correct_rate_by_shift,omitempty"`
MeanLatencyMs float64 `json:"mean_latency_ms"`
}
JudgeSummary scores a set of judged items against ground truth.
type ListTemplatesToolInput ¶
type ListTemplatesToolInput struct {
Category string `json:"category,omitempty" jsonschema:"Optional category filter: 'core', 'calibration', 'multimodal', or 'rerank'."`
}
type ListTemplatesToolOutput ¶
type ListTemplatesToolOutput struct {
Count int `json:"count"`
Templates []TemplateCatalogEntry `json:"templates"`
}
type LocateBBoxToolInput ¶
type LocateBBoxToolInput struct {
Image string `json:"image" jsonschema:"Image URL or base64 data URI (data:image/png;base64,...) to analyze with Gemma 4 SigLIP vision."`
Target string `` /* 156-byte string literal not displayed */
Backend string `` /* 178-byte string literal not displayed */
VertexURL string `json:"vertex_url,omitempty" jsonschema:"Optional Vertex AI Endpoint ID or /invoke/* URL override."`
}
type LocateBBoxToolOutput ¶
type LocateBBoxToolOutput struct {
Target string `json:"target"`
Presence bool `json:"presence"`
PresenceConfidence float64 `json:"presence_confidence"`
SoftmaxExpectation BBoxCoords `json:"softmax_expectation_box_1000"`
DiscreteArgmax BBoxCoords `json:"discrete_argmax_box_1000"`
CoordinateEntropy map[string]float64 `json:"coordinate_entropy_nats"`
MaxEntropy float64 `json:"max_entropy"`
WallTimeMs int64 `json:"wall_time_ms"`
BackendTarget string `json:"backend_target"`
UpstreamURL string `json:"upstream_url"`
}
type LocateDgem ¶
type LocateGemini ¶
type LocateMask ¶
type LocateMask struct {
PNGBase64 string `json:"png_base64,omitempty"`
PolygonPct [][2]float64 `json:"polygon_pct,omitempty"`
Score float64 `json:"score,omitempty"`
}
LocateMask is what the SAM service returns.
type LocateRequest ¶
type LocateRequest struct {
Image string `json:"image" jsonschema:"Image URL or base64 data URI (the CLI and stdio MCP also accept a local path)."`
Target string `json:"target" jsonschema:"Description of the object or element to locate (e.g. 'the checkout button', 'the table')."`
Mask bool `json:"mask,omitempty" jsonschema:"Also return a mask from the SAM service at DGEM_SAM_URL (prompted with the box)."`
GeminiModel string `` /* 137-byte string literal not displayed */
Thinking string `json:"thinking,omitempty" jsonschema:"Gemini thinking level: low (default), medium, high or default."`
SkipH float64 `` /* 210-byte string literal not displayed */
Hint bool `json:"hint,omitempty" jsonschema:"Opt-in: pass dgem's 3x3 cell to Gemini as a 'may be wrong' hint (neutral on average)."`
Backend string `json:"backend,omitempty" jsonschema:"dgem backend: vertex_first (default), vertex or cloudrun."`
VertexURL string `json:"vertex_url,omitempty" jsonschema:"Optional Vertex AI endpoint ID or /invoke/* URL override."`
}
LocateRequest is the input shared by every surface.
type LocateResult ¶
type LocateResult struct {
Target string `json:"target"`
Present bool `json:"present"`
Path string `json:"path"` // skipped_absent | gemini | gemini_absent
Box *BBoxCoords `json:"box_1000,omitempty"`
BoxPct *[4]float64 `json:"box_pct,omitempty"` // [ymin, xmin, ymax, xmax] percent
Mask *LocateMask `json:"mask,omitempty"`
MaskNote string `json:"mask_note,omitempty"`
Dgem LocateDgem `json:"dgem"`
Gemini *LocateGemini `json:"gemini,omitempty"`
SamMs float64 `json:"sam_ms,omitempty"`
TotalMs float64 `json:"total_ms"`
BackendTarget string `json:"backend_target,omitempty"`
}
LocateResult reports which path ran and the time spent in each stage.
type ReliabilityBin ¶
type ReliabilityBin struct {
BinIndex int `json:"bin_index"`
RangeLabel string `json:"range_label"`
Lower float64 `json:"lower"`
Upper float64 `json:"upper"`
Count int `json:"count"`
AvgConf float64 `json:"avg_confidence"`
EmpiricalAcc float64 `json:"empirical_accuracy"`
AbsGap float64 `json:"abs_gap"`
}
ReliabilityBin represents one of the 10 equal-width confidence bins [0.0..1.0] for ECE and Reliability Diagrams.
type StatusToolInput ¶
type StatusToolInput struct {
Backend string `` /* 225-byte string literal not displayed */
}
type TemperatureFit ¶
type TemperatureFit struct {
Method string `json:"method"`
Folds int `json:"folds,omitempty"`
FoldTemperatures []float64 `json:"fold_temperatures,omitempty"`
InSampleTemperature float64 `json:"in_sample_temperature"`
ECERaw float64 `json:"ece_raw"`
ECEApplied float64 `json:"ece_applied"`
BrierRaw float64 `json:"brier_raw"`
}
TemperatureFit records how the temperature behind a report's calibration figures was chosen.
kfold (--auto-temperature, default): each case is scaled by the T fitted on the other folds, so the
reported ECE/Brier are out of sample. Per-case T is in each case's temperature_applied.
in_sample (--auto-temperature-in-sample): one T fitted on every case and applied to every case (optimistic,
the behaviour before 2026-10-04).
fixed (--temperature-scale): the given T.
type TemplateCatalogEntry ¶
type TemplateCatalogEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Category string `json:"category"`
Description string `json:"description"`
Path string `json:"path"`
Variables []string `json:"variables"`
SampleVars map[string]string `json:"sample_vars"`
Multimodal bool `json:"multimodal"`
RawTemplate string `json:"raw_template"`
RawSource string `json:"raw_source"`
}
TemplateCatalogEntry describes a discovered .json.tmpl policy.
type TraceSpanRecord ¶
type TraceSpanRecord struct {
TraceID string `json:"trace_id"`
SpanID string `json:"span_id"`
ParentSpanID string `json:"parent_span_id,omitempty"`
Name string `json:"name"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
OffsetMs float64 `json:"offset_ms"`
DurationMs float64 `json:"duration_ms"`
Depth int `json:"depth"`
Status string `json:"status"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
}
TraceSpanRecord represents a serialized OpenTelemetry span for API responses & /api/traces.
type VisionAnswer ¶
type VisionAnswer struct {
Aspect string `json:"aspect"`
Expected string `json:"expected"`
Predicted string `json:"predicted"`
Correct bool `json:"correct"`
// Live cascade (--cascade-threshold): dgem's own answer and whether Gemini replaced it.
Stage1 string `json:"stage1,omitempty"`
Stage1OK *bool `json:"stage1_correct,omitempty"`
Escalated bool `json:"escalated,omitempty"`
Confidence float64 `json:"confidence,omitempty"`
HNorm float64 `json:"h_norm,omitempty"`
HasDist bool `json:"has_distribution,omitempty"`
// Probabilities over the aspect's labels (dgem only), for Brier/ECE in the regression matrix.
Probabilities map[string]float64 `json:"probabilities,omitempty"`
}
VisionAnswer is one scored aspect of one run.
type VisionAspectSummary ¶
type VisionAspectSummary struct {
Aspect string `json:"aspect"`
Items int `json:"items"`
Options int `json:"options"`
Accuracy BboxStat `json:"accuracy"`
MajorityLabel string `json:"majority_label"`
MajorityAccuracy float64 `json:"majority_accuracy"`
Lift BboxStat `json:"lift_over_majority"`
PredictedDist map[string]float64 `json:"predicted_label_share"`
HesitationAUROC float64 `json:"hesitation_error_auroc"` // -1 when undefined
Wrong int `json:"wrong_answers"`
// BySet: accuracy per value of the "set" tag.
BySet map[string]float64 `json:"accuracy_by_set,omitempty"`
}
type VisionCaseResult ¶
type VisionCaseResult struct {
ID string `json:"id"`
Repeat int `json:"repeat"`
Tags map[string]string `json:"tags,omitempty"`
Answers []VisionAnswer `json:"answers"`
Error string `json:"error,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
// Live cascade timing: dgem's part, Gemini's part (0 when nothing escalated) and slots escalated.
Stage1Ms float64 `json:"stage1_ms,omitempty"`
CascadeMs float64 `json:"cascade_ms,omitempty"`
EscalatedSlots int `json:"escalated_slots,omitempty"`
TotalSlots int `json:"total_slots,omitempty"`
CascadeError string `json:"cascade_error,omitempty"`
}
type VisionItemRow ¶
type VisionItemRow struct {
ID string `json:"id"`
Expected string `json:"expected"`
Actual string `json:"actual"`
Accurate bool `json:"accurate"`
Confidence float64 `json:"confidence"`
TopProbabilities map[string]float64 `json:"top_probabilities,omitempty"`
WallTimeMs float64 `json:"wall_time_ms"`
}
VisionItemRow is one (case, aspect, repeat) answer in the flat shape the regression matrix reads (scripts/matrix/metrics.py rows()).
type VisionReport ¶
type VisionReport struct {
Timestamp string `json:"timestamp"`
Engine string `json:"engine"`
TargetModel string `json:"target_model"`
ServerVersion string `json:"server_version,omitempty"`
Dataset string `json:"dataset"`
Template string `json:"template"`
Variant string `json:"variant"`
Repeats int `json:"repeats"`
GitCommit string `json:"git_commit,omitempty"`
Aspects []VisionAspectSummary `json:"aspects"`
Cases []VisionCaseResult `json:"cases"`
// ReceiptKind and Items let generic tooling (the regression matrix) score the receipt per answer.
ReceiptKind string `json:"receipt_kind"`
Items []VisionItemRow `json:"items"`
}
type WarmupGPUInput ¶
type WarmupGPUInput struct {
WaitForReady bool `` /* 234-byte string literal not displayed */
}
WarmupGPUInput defines arguments for the warmup_gpu MCP tool and POST /api/warmup.
type WarmupGPUOutput ¶
type WarmupGPUOutput struct {
Status string `json:"status"` // "warm_and_ready", "warming_up_started", or "warming_up_in_progress"
GPUAvailable bool `json:"gpu_available"`
Coalesced bool `json:"coalesced"`
WarmupElapsedSeconds int `json:"warmup_elapsed_seconds,omitempty"`
EWMAWakeSeconds int `json:"ewma_wake_seconds,omitempty"`
WarmupAttempts int `json:"warmup_attempts,omitempty"`
ElapsedMs int64 `json:"elapsed_ms"`
UpstreamURL string `json:"upstream_url"`
Message string `json:"message"`
}
WarmupGPUOutput is returned by warmup_gpu and POST /api/warmup.
func TriggerGPUWarmup ¶
func TriggerGPUWarmup(ctx context.Context, waitForReady bool) (WarmupGPUOutput, error)
TriggerGPUWarmup delegates to TriggerGPUWarmupWithSource with default source.
func TriggerGPUWarmupWithSource ¶
func TriggerGPUWarmupWithSource(ctx context.Context, waitForReady bool, triggerSource string) (WarmupGPUOutput, error)
TriggerGPUWarmupWithSource is a strictly idempotent, single-flight coalesced GPU warmup coordinator shared across MCP (warmup_gpu), Web Studio (Wake GPU button), and REST (POST /api/warmup).
type WarmupStageBreakdown ¶
type WarmupStageBreakdown struct {
Timestamp string `json:"timestamp"`
TriggerSource string `json:"trigger_source"`
Phase1ActivatorMs int64 `json:"phase_1_activator_ms"`
Phase2TmpfsStageMs int64 `json:"phase_2_tmpfs_stage_ms"`
Phase3VLLMSiglipMs int64 `json:"phase_3_vllm_siglip_ms"`
Phase4TritonJITMs int64 `json:"phase_4_triton_jit_ms"`
TotalWarmupMs int64 `json:"total_warmup_ms"`
Attempts int `json:"attempts"`
}
WarmupStageBreakdown records the 4 cold-start sub-stages for right-sizing and Cloud Monitoring.
type WarmupTelemetryStats ¶
type WarmupTelemetryStats struct {
EWMAWakeSeconds int `json:"ewma_wake_seconds"`
EWMAStage1ActivatorMs int64 `json:"ewma_stage_1_activator_ms"`
EWMAStage2TmpfsStageMs int64 `json:"ewma_stage_2_tmpfs_stage_ms"`
EWMAStage3VLLMSiglipMs int64 `json:"ewma_stage_3_vllm_siglip_ms"`
EWMAStage4TritonJITMs int64 `json:"ewma_stage_4_triton_jit_ms"`
SampleCount int `json:"sample_count"`
History []WarmupStageBreakdown `json:"history"`
}
WarmupTelemetryStats is returned by GET /api/warmup/stats for operational dashboards & right-sizing.
func GetWarmupTelemetryStats ¶
func GetWarmupTelemetryStats() WarmupTelemetryStats
GetWarmupTelemetryStats returns the current EWMA right-sized cold-start estimate and stage history.
Source Files
¶
- ask.go
- backend_policy.go
- batch_presets.go
- bench.go
- bench_bbox.go
- bench_bbox_analysis.go
- bench_bbox_gemini.go
- bench_bbox_judge.go
- bench_bbox_variants.go
- bench_calibration.go
- bench_decision_index.go
- bench_guided.go
- bench_intents.go
- bench_jev.go
- bench_permutation.go
- bench_vision.go
- body_log.go
- calibration_jev_metrics.go
- caller_auth.go
- caller_log.go
- cascade_gemini.go
- decide.go
- decide_summary.go
- expand_taxonomy.go
- http_security.go
- image_inline.go
- layout.go
- locate.go
- locate_cmd.go
- mcp.go
- mcp_schema.go
- otel.go
- policy_temperature.go
- request_images.go
- root.go
- serve.go
- strutil.go
- systemone_logattrs.go
- systemone_serve.go
- temperature_fit.go
- template.go
- version.go
- vertex_identity.go