Help us shape the future of Go! Take the 2026 Go Developer Survey

systemone

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package systemone offers an advisory typed choice using the official TypeSafe adapter and explicitly selected local Ollama weights. It never runs an action.

Index

Constants

View Source
const (
	Schema          = "questlock.system-one.choice.v1"
	AdapterVersion  = "0.2.1"
	AdapterCommit   = "e1d4cc938204b22fc5a3c3aca7044072fe3f712d"
	OllamaURL       = "http://127.0.0.1:11434"
	MaxRequestBytes = 16384
	MaxContextBytes = 4096
	MaxOutputTokens = 256
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

type Policy

type Policy struct {
	MinScore  float64 `json:"min_score"`
	MinMargin float64 `json:"min_margin"`
}

Policy thresholds operate on uncalibrated model scores. They are caller heuristics, not a probability of correctness or authorization to perform work.

type Request

type Request struct {
	Schema   string   `json:"schema"`
	Model    string   `json:"model"`
	State    string   `json:"state"`
	Question string   `json:"question"`
	Choices  []Choice `json:"choices"`
	Policy   *Policy  `json:"policy"`
}

func Load

func Load(reader io.Reader) (Request, error)

Load rejects ambiguous duplicate keys, unknown fields, trailing values, and oversized inputs before any native dependency or model is contacted.

func (Request) Validate

func (r Request) Validate() error

type Result

type Result struct {
	Schema         string             `json:"schema"`
	Status         string             `json:"status"`
	Reason         string             `json:"reason"`
	ChoiceID       string             `json:"choice_id,omitempty"`
	Scores         map[string]float64 `json:"uncalibrated_scores,omitempty"`
	AdvisoryOnly   bool               `json:"advisory_only"`
	RequestSHA256  string             `json:"request_sha256"`
	Model          string             `json:"model"`
	ModelDigest    string             `json:"model_digest,omitempty"`
	AdapterVersion string             `json:"adapter_version,omitempty"`
	Usage          Usage              `json:"usage"`
}

type Runner

type Runner struct {
	Python  string        // Absolute interpreter from an explicitly prepared pinned venv.
	Timeout time.Duration // Default 60s; hard maximum 120s including discovery.
	// contains filtered or unexported fields
}

func (Runner) Choose

func (runner Runner) Choose(ctx context.Context, request Request) (result Result, err error)

Choose makes at most one local model request. No action, write authorization, provider credential, retry, paid fallback, or automatic model pull is offered. Valid requests can return abstained with nil error; callers must check Status.

type Usage

type Usage struct {
	InputTokens                  *int64  `json:"input_tokens"`
	OutputTokens                 *int64  `json:"output_tokens"`
	LocalModelCalls              *int    `json:"local_model_calls"`
	Retries                      int     `json:"retries"`
	AdapterLatencyMS             float64 `json:"adapter_latency_ms"`
	ElapsedMS                    float64 `json:"elapsed_ms"`
	ProviderCostUSD              float64 `json:"provider_cost_usd"`
	CostBasis                    string  `json:"cost_basis"`
	HostedAssistantUsageIncluded bool    `json:"hosted_assistant_usage_included"`
}

Jump to

Keyboard shortcuts

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