providerprofiles

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package providerprofiles contains the bounded, declarative provider-profile seam. It deliberately has no runtime, network, process, or provider-plugin dependencies; composition roots compile profiles into family adapters.

Index

Constants

View Source
const (
	APIVersionV1       = "lip.provider-profile/v1"
	MaxStringBytes     = 256
	MaxHeaders         = 16
	MaxModels          = 2048
	MaxCapabilities    = 32
	MaxDialects        = 32
	MaxQuirks          = 8
	MaxCatalogProfiles = 4096
	MaxCatalogBytes    = 1 << 20
	MaxProfileBytes    = 256 << 10
)

Variables

This section is empty.

Functions

func Validate

func Validate(p Profile) error

Types

type AccountingSource

type AccountingSource string
const (
	AccountingProviderReported AccountingSource = "provider_reported"
	AccountingProviderCountAPI AccountingSource = "provider_count_api"
	AccountingLocalTokenizer   AccountingSource = "local_tokenizer"
	AccountingLocalEstimator   AccountingSource = "local_estimator"
)

type Auth

type Auth struct {
	Mode   AuthMode `json:"mode" yaml:"mode"`
	EnvVar string   `json:"env_var" yaml:"env_var"`
	Secret string   `json:"secret,omitempty" yaml:"secret,omitempty"`
}

type AuthMode

type AuthMode string
const (
	AuthNone      AuthMode = "none"
	AuthBearerEnv AuthMode = "bearer_env"
	AuthAPIKeyEnv AuthMode = "api_key_env"
)

type Binding

type Binding struct {
	Family      Family
	FactoryKind string
}

Binding names the already-certified adapter family. It contains no factory or lifecycle function, so one family binding serves every profile.

func FamilyBinding

func FamilyBinding(f Family) (Binding, error)

type CapabilityOverrides

type CapabilityOverrides struct {
	Enable  []lipapi.Capability `json:"enable,omitempty" yaml:"enable,omitempty"`
	Disable []lipapi.Capability `json:"disable,omitempty" yaml:"disable,omitempty"`
}

type Catalog

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

func EmbeddedCatalog

func EmbeddedCatalog() (*Catalog, error)

EmbeddedCatalog loads the checked-in catalog without network or process work.

func NewCatalog

func NewCatalog(profiles []Profile) (*Catalog, error)

func (*Catalog) CompileAll

func (c *Catalog) CompileAll() ([]CompiledProfile, error)

func (*Catalog) Profiles

func (c *Catalog) Profiles() []Profile

type Certification

type Certification struct {
	ProfileID      string
	Family         Family
	FactoryKind    string
	EndpointURL    string
	AuthMode       AuthMode
	Headers        []SafeHeader
	ModelNamespace Namespace
	StaticModels   []Model
	Capabilities   []lipapi.Capability
	Dialects       lipapi.DialectSupport
	Quirks         []QuirkID
}

func Certify

func Certify(p Profile) (Certification, error)

func (Certification) Validate

func (c Certification) Validate() error

type Compiled

type Compiled struct {
	Profile      Profile
	FamilyMax    lipapi.BackendCaps
	Capabilities lipapi.BackendCaps
	Dialects     lipapi.DialectSupport
}

func Compile

func Compile(p Profile) (Compiled, error)

type CompiledProfile

type CompiledProfile struct {
	Profile      Profile
	Binding      Binding
	Capabilities lipapi.BackendCaps
	Dialects     lipapi.DialectSupport
}

CompiledProfile is the immutable composition input produced by validation. Static profile values are copied so catalog callers cannot mutate a compiled generation through their original slices.

func CompileProfile

func CompileProfile(p Profile) (CompiledProfile, error)

type DialectOverrides

type DialectOverrides struct {
	Item       []lipapi.DialectRequirement   `json:"items,omitempty" yaml:"items,omitempty"`
	Reasoning  []lipapi.DialectRequirement   `json:"reasoning,omitempty" yaml:"reasoning,omitempty"`
	Compaction []lipapi.DialectRequirement   `json:"compaction,omitempty" yaml:"compaction,omitempty"`
	Extensions []lipapi.ExtensionRequirement `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

type DiscoveryPolicy

type DiscoveryPolicy string
const (
	DiscoveryFamilyDefault DiscoveryPolicy = "family_default"
	DiscoveryStatic        DiscoveryPolicy = "static"
	DiscoveryDisabled      DiscoveryPolicy = "disabled"
)

type Endpoint

type Endpoint struct {
	BaseURL    string     `json:"base_url" yaml:"base_url"`
	PathPolicy PathPolicy `json:"path_policy" yaml:"path_policy"`
}

type Family

type Family string
const (
	FamilyOpenAIChat      Family = "openai-chat-compatible"
	FamilyOpenAIResponses Family = "openai-responses-compatible"
	FamilyAnthropic       Family = "anthropic-compatible"
	FamilyOpenResponses   Family = "openresponses-compatible"
)

type Model

type Model struct {
	CanonicalID string `json:"canonical_id" yaml:"canonical_id"`
	NativeID    string `json:"native_id" yaml:"native_id"`
	DisplayName string `json:"display_name,omitempty" yaml:"display_name,omitempty"`
}

type ModelDiscovery

type ModelDiscovery struct {
	Policy    DiscoveryPolicy `json:"discovery" yaml:"discovery"`
	Path      string          `json:"path,omitempty" yaml:"path,omitempty"`
	Namespace Namespace       `json:"namespace" yaml:"namespace"`
	Static    []Model         `json:"static,omitempty" yaml:"static,omitempty"`
}

type Namespace

type Namespace struct {
	Mode   NamespaceMode `json:"mode" yaml:"mode"`
	Prefix string        `json:"prefix,omitempty" yaml:"prefix,omitempty"`
}

type NamespaceMode

type NamespaceMode string
const (
	NamespacePreserve NamespaceMode = "preserve"
	NamespacePrefix   NamespaceMode = "prefix"
	NamespaceStrip    NamespaceMode = "strip_prefix"
)

type PathPolicy

type PathPolicy string
const PathPolicyFamilyDefault PathPolicy = "family_default"

type Profile

type Profile struct {
	APIVersion   string              `json:"api_version" yaml:"api_version"`
	ID           string              `json:"id" yaml:"id"`
	Family       Family              `json:"family" yaml:"family"`
	Endpoint     Endpoint            `json:"endpoint" yaml:"endpoint"`
	Auth         Auth                `json:"auth" yaml:"auth"`
	Headers      []SafeHeader        `json:"headers,omitempty" yaml:"headers,omitempty"`
	Models       ModelDiscovery      `json:"models" yaml:"models"`
	Tokenizer    TokenizerAccounting `json:"tokenizer" yaml:"tokenizer"`
	Capabilities CapabilityOverrides `json:"capabilities" yaml:"capabilities"`
	Dialects     DialectOverrides    `json:"dialects" yaml:"dialects"`
	Quirks       []QuirkID           `json:"quirks,omitempty" yaml:"quirks,omitempty"`
	// Transform is intentionally rejected. Keeping this field makes the boundary
	// explicit when decoding future data rather than silently accepting a DSL.
	Transform string `json:"transform,omitempty" yaml:"transform,omitempty"`
}

func DecodeJSON

func DecodeJSON(data []byte) (Profile, error)

DecodeJSON decodes one profile with a closed field set.

func DecodeYAML

func DecodeYAML(data []byte) (Profile, error)

DecodeYAML decodes one profile with a closed field set.

func EmbeddedProfile

func EmbeddedProfile(id string) (Profile, error)

type QuirkID

type QuirkID string

QuirkID identifies bounded family-owned behavior implemented by the corresponding adapter. Unsupported identifiers fail closed during validation.

const (
	QuirkAnthropicV1Models   QuirkID = "anthropic.v1_models"
	QuirkOpenAIResponsesPath QuirkID = "openai.responses_path"
)

type SafeHeader

type SafeHeader struct {
	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

type TokenizerAccounting

type TokenizerAccounting struct {
	TokenizerID string           `json:"id,omitempty" yaml:"id,omitempty"`
	Source      AccountingSource `json:"source,omitempty" yaml:"source,omitempty"`
}

Jump to

Keyboard shortcuts

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