models

package
v0.142.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlacementSourceAuto   = "auto"
	PlacementSourceManual = "manual"
)

Placement source values attached to accepted placement instances.

View Source
const (
	RunStatusCompleted       = "completed"
	RunStatusPartial         = "partial"
	RunStatusBudgetExhausted = "budget_exhausted"
	RunStatusTimedOut        = "timed_out"
	RunStatusFailed          = "failed"
)
View Source
const (
	RunReasonResolvedAll       = "resolved_all"
	RunReasonUnresolvedFields  = "unresolved_fields"
	RunReasonBudgetExhausted   = "budget_exhausted"
	RunReasonTimedOut          = "timed_out"
	RunReasonResolverError     = "resolver_error"
	RunReasonResolverShortStop = "resolver_short_circuit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Estimate

type Estimate struct {
	ResolverID string  `json:"resolver_id"`
	Accuracy   float64 `json:"accuracy"`
	Cost       float64 `json:"cost"`
	Latency    float64 `json:"latency"`
	Supported  bool    `json:"supported"`
	Reason     string  `json:"reason"`
}

Estimate captures pre-execution resolver quality/cost/latency estimates.

type ExecutionLimits

type ExecutionLimits struct {
	MaxBudget float64       `json:"max_budget"`
	MaxTime   time.Duration `json:"max_time"`
}

ExecutionLimits controls max budget/time constraints for a run.

type ExistingPlacement

type ExistingPlacement struct {
	FieldDefinitionID string   `json:"field_definition_id"`
	Geometry          Geometry `json:"geometry"`
}

ExistingPlacement represents already-authored field placements.

type FieldDefinition

type FieldDefinition struct {
	ID            string `json:"id"`
	ParticipantID string `json:"participant_id"`
	FieldType     string `json:"field_type"`
	Label         string `json:"label"`
	Required      bool   `json:"required"`
}

FieldDefinition is a logical definition input for placement suggestions.

type Geometry

type Geometry struct {
	PageNumber int     `json:"page_number"`
	X          float64 `json:"x"`
	Y          float64 `json:"y"`
	Width      float64 `json:"width"`
	Height     float64 `json:"height"`
}

Geometry captures canonical page-space placement coordinates.

type NativeFormField

type NativeFormField struct {
	Name          string   `json:"name"`
	FieldTypeHint string   `json:"field_type_hint"`
	Geometry      Geometry `json:"geometry"`
}

NativeFormField represents an extracted native form field from a PDF source.

type Policy

type Policy struct {
	EnabledResolvers []string        `json:"enabled_resolvers"`
	HardOrder        []string        `json:"hard_order"`
	Weights          ScoringWeights  `json:"weights"`
	Limits           ExecutionLimits `json:"limits"`
}

Policy is the effective placement policy applied to a run.

type ResolveResult

type ResolveResult struct {
	Suggestions             []Suggestion `json:"suggestions"`
	UnresolvedDefinitionIDs []string     `json:"unresolved_definition_i_ds"`
	Terminate               bool         `json:"terminate"`
	TerminationReason       string       `json:"termination_reason"`
}

ResolveResult captures resolver output and optional short-circuit directives.

type ResolverScore

type ResolverScore struct {
	ResolverID string  `json:"resolver_id"`
	Accuracy   float64 `json:"accuracy"`
	Cost       float64 `json:"cost"`
	Latency    float64 `json:"latency"`
	Score      float64 `json:"score"`
	Supported  bool    `json:"supported"`
	Reason     string  `json:"reason"`
}

ResolverScore captures final weighted ranking score metadata.

type Run

type Run struct {
	ID                      string          `json:"id"`
	AgreementID             string          `json:"agreement_id"`
	Status                  string          `json:"status"`
	ReasonCode              string          `json:"reason_code"`
	Policy                  Policy          `json:"policy"`
	ResolverOrder           []string        `json:"resolver_order"`
	ExecutedResolvers       []string        `json:"executed_resolvers"`
	Estimates               []Estimate      `json:"estimates"`
	Scores                  []ResolverScore `json:"scores"`
	Suggestions             []Suggestion    `json:"suggestions"`
	UnresolvedDefinitionIDs []string        `json:"unresolved_definition_i_ds"`
	SelectedSource          string          `json:"selected_source"`
	BudgetUsed              float64         `json:"budget_used"`
	Elapsed                 time.Duration   `json:"elapsed"`
	CreatedByUserID         string          `json:"created_by_user_id"`
	CreatedAt               time.Time       `json:"created_at"`
	CompletedAt             time.Time       `json:"completed_at"`
}

Run captures full run telemetry and merged suggestions.

type ScoringWeights

type ScoringWeights struct {
	Accuracy float64 `json:"accuracy"`
	Cost     float64 `json:"cost"`
	Latency  float64 `json:"latency"`
}

ScoringWeights controls weighted utility ranking.

type Suggestion

type Suggestion struct {
	ID                string         `json:"id"`
	FieldDefinitionID string         `json:"field_definition_id"`
	ResolverID        string         `json:"resolver_id"`
	Confidence        float64        `json:"confidence"`
	Geometry          Geometry       `json:"geometry"`
	Label             string         `json:"label"`
	Metadata          map[string]any `json:"metadata"`
}

Suggestion captures one candidate placement for a field definition.

func (Suggestion) NormalizedConfidence

func (s Suggestion) NormalizedConfidence() float64

NormalizedConfidence clamps confidence into [0,1].

Jump to

Keyboard shortcuts

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