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

local

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package local performs Pando's AI functions with a model served on your own hardware, by any server that speaks the OpenAI Chat Completions API: Ollama, LM Studio, llama.cpp's server, vLLM.

The prompts, tools, budgeted reader and answer shapes are aikit's, shared with every AI adapter. What is here is how a conversation is held with a server that may be small, slow, and uneven at calling tools: a longer timeout, and an answer written as JSON in the reply accepted where a tool call was asked for. Core validates every answer regardless (R-027), so a weaker model can be wrong but cannot be trusted further than any other.

Nothing leaves the network it is on, which is the reason to choose it. The audit event still records what was read (R-337): the server is somebody's machine, and what was sent to it is still worth knowing.

Index

Constants

View Source
const (
	DefaultMaxFiles       = 30
	DefaultMaxBytes       = 192 << 10
	DefaultTimeoutSeconds = 300
)

Defaults for a model on local hardware.

View Source
const DefaultBaseURL = "http://host.docker.internal:11434/v1"

DefaultBaseURL is Ollama on the machine Pando's container runs on. [P] Pando usually runs in Docker, where localhost is the container itself, and Docker Desktop names the host host.docker.internal; on Linux the Compose file maps that name to the host gateway.

View Source
const Kind = "local"

Kind is what adapter_configs stores.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one (api.KindInfo, R-261).

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is the local model adapter.

func New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) AnswerQuestions

func (a *Adapter) AnswerQuestions(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)

AnswerQuestions answers detection's outstanding questions (R-338).

func (*Adapter) AnswerReference

func (a *Adapter) AnswerReference(ctx context.Context, req api.ReferenceRequest) (api.ReferenceAnswer, error)

AnswerReference answers from the generated reference (R-346).

func (*Adapter) Capabilities

func (a *Adapter) Capabilities(_ context.Context) (api.AICapabilities, error)

Capabilities reports what this adapter does, as data (R-254, R-259).

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

Configure reads the adapter's configuration.

func (*Adapter) DraftAccess

func (a *Adapter) DraftAccess(ctx context.Context, req api.AccessRequest) (api.AccessDraft, error)

DraftAccess drafts a role and, optionally, a group (R-343).

func (*Adapter) DraftPolicy

func (a *Adapter) DraftPolicy(ctx context.Context, req api.PolicyRequest) (api.PolicyDraft, error)

DraftPolicy proposes changes to host policy (R-344).

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(ctx context.Context) error

HealthCheck asks the server for its models and checks the configured one is among them, so "the server is down" and "the model was never pulled" each say which.

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) RepairPlan

func (a *Adapter) RepairPlan(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)

RepairPlan reads a failed proposal and proposes amendments (R-106, R-336).

func (*Adapter) RevisePlan

func (a *Adapter) RevisePlan(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)

RevisePlan acts on what a person reviewing the plan asked for (R-336).

func (*Adapter) SearchAudit

func (a *Adapter) SearchAudit(ctx context.Context, req api.AuditSearchRequest) (api.AuditSearch, error)

SearchAudit turns a question into one audit filter (R-345).

func (*Adapter) SummarizeAudit

func (a *Adapter) SummarizeAudit(ctx context.Context, req api.AuditSummaryRequest) (api.AuditSummary, error)

SummarizeAudit summarizes the records core found (R-345).

type Config

type Config struct {
	// Credentials are supplied by core, decrypted at startup (O-20). Most local
	// servers take no key; vLLM and a proxy in front of one may.
	Credentials Credentials `json:"credentials,omitzero"`
	APIKeyEnv   string      `json:"api_key_env,omitempty"`

	// BaseURL is the server's OpenAI-compatible root, ending in /v1.
	BaseURL string `json:"base_url,omitempty"`

	// Model is required: there is no model every local server has.
	Model string `json:"model,omitempty"`

	// ScreenPlans defaults to true (R-336). False turns off repairing plans,
	// answering questions and revising plans.
	ScreenPlans *bool `json:"screen_plans,omitempty"`

	MaxFiles int   `json:"max_files,omitempty"`
	MaxBytes int64 `json:"max_bytes,omitempty"`

	TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}

Config is the adapter's own configuration.

type Credentials

type Credentials struct {
	APIKey secret.Value `json:"api_key,omitzero"`
}

Credentials is what this adapter needs kept secret (R-194).

Jump to

Keyboard shortcuts

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