provider

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package provider is the dormant extension seam for natural-language actions. The base ships NO model. When a provider URL is configured (Settings → AI / settings.json), the base POSTs the user's text plus the available tools and live entities to that URL, and the provider (a separate process — rules, embeddings, or an LLM) returns a tool call. The returned call is always re-validated through the tool Registry before it executes, so a provider can never invoke an unknown tool or entity.

Index

Constants

View Source
const EnvURL = "ORIEL_PROVIDER_URL"

EnvURL is the legacy environment variable that used to configure the provider endpoint. It is no longer read at runtime; the one-time config migration uses this name to import a pre-0.2 value into settings.json.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider is an HTTP client for a configured resolver. The URL is set by the server from settings.json at startup and can be swapped at runtime (Settings → AI), so the mutex guards it against concurrent request and config goroutines.

func New

func New() *Provider

New returns a dormant provider; the server sets the URL from settings.json. Resolve fails until configured.

func (*Provider) Enabled

func (p *Provider) Enabled() bool

Enabled reports whether a provider URL is configured.

func (*Provider) Resolve

func (p *Provider) Resolve(ctx context.Context, req Request) (ToolCall, error)

Resolve asks the provider to map req.Text to a tool call.

func (*Provider) SetURL

func (p *Provider) SetURL(u string)

SetURL swaps the endpoint at runtime; an empty string returns to dormant.

func (*Provider) URL

func (p *Provider) URL() string

URL returns the configured endpoint, empty when dormant.

type Request

type Request struct {
	Text     string              `json:"text"`
	Tools    any                 `json:"tools"`
	Entities map[string][]string `json:"entities"`
}

Request is the body POSTed to <url>/resolve.

type ToolCall

type ToolCall struct {
	Tool       string         `json:"tool"`
	Args       map[string]any `json:"args"`
	Confidence float64        `json:"confidence"`
}

ToolCall is what a provider must return: which tool to run with what args.

Jump to

Keyboard shortcuts

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