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
- func Info() api.KindInfo
- type Adapter
- func (a *Adapter) AnswerQuestions(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)
- func (a *Adapter) AnswerReference(ctx context.Context, req api.ReferenceRequest) (api.ReferenceAnswer, error)
- func (a *Adapter) Capabilities(_ context.Context) (api.AICapabilities, error)
- func (a *Adapter) Category() api.Category
- func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error
- func (a *Adapter) DraftAccess(ctx context.Context, req api.AccessRequest) (api.AccessDraft, error)
- func (a *Adapter) DraftPolicy(ctx context.Context, req api.PolicyRequest) (api.PolicyDraft, error)
- func (a *Adapter) HealthCheck(ctx context.Context) error
- func (a *Adapter) Kind() string
- func (a *Adapter) RepairPlan(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)
- func (a *Adapter) RevisePlan(ctx context.Context, req api.ScreenRequest) (api.ScreenResult, error)
- func (a *Adapter) SearchAudit(ctx context.Context, req api.AuditSearchRequest) (api.AuditSearch, error)
- func (a *Adapter) SummarizeAudit(ctx context.Context, req api.AuditSummaryRequest) (api.AuditSummary, error)
- type Config
- type Credentials
Constants ¶
const ( DefaultMaxFiles = 30 DefaultMaxBytes = 192 << 10 DefaultTimeoutSeconds = 300 )
Defaults for a model on local hardware.
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.
const Kind = "local"
Kind is what adapter_configs stores.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the local model 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 ¶
Capabilities reports what this adapter does, as data (R-254, R-259).
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 ¶
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) 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 ¶
Credentials is what this adapter needs kept secret (R-194).