catalog

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Overview

Package catalog owns the read-only provider/model catalog and the per-provider capability matrix the Settings UI renders.

Every method gates through authz against TenantCatalogView (currently auth.RoleUser — any authenticated user). The catalog data itself doesn't vary per caller, but routing through authz keeps the gating story uniform across services and lets the policy bump to a tighter role (manager+) without touching this code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModelMeetsCapability

func ModelMeetsCapability(m Model, capability string) (ok bool, reason string)

ModelMeetsCapability reports whether m can serve the given capability and, if not, a human-readable reason. capability uses the agentsdk vocabulary (text / vision / embedding / image / speech / transcription) plus "search" (a tool-driven web-search model). It's the single source of truth for the capability gate behind both the system-default and per-agent model pickers; the predicates mirror the frontend (useModelCapabilities). An unknown capability imposes no requirement.

Types

type ListModelsOptions

type ListModelsOptions struct {
	ProviderFilter string
	ConfiguredOnly bool
}

ListModelsOptions narrows ListModels' result set. ProviderFilter keeps only models from one provider id; ConfiguredOnly restricts to models from providers the operator has enabled in the DB.

type Model

type Model struct {
	ID                string
	Name              string
	ProviderID        string
	ProviderConfigID  string
	Kind              string
	ToolCall          bool
	Reasoning         bool
	Caps              []string
	CostInput         float64
	CostOutput        float64
	ContextLimit      int32
	OutputLimit       int32
	StructuredOutputs bool
}

Model is one model from the active catalog. Picker dropdowns and the capability matrix consume the same model list.

type Provider

type Provider struct {
	ID   string
	Name string
}

Provider is one entry in the configurable provider catalog.

type ProviderCapability

type ProviderCapability struct {
	ProviderID   string
	DisplayName  string
	Capabilities []string
	Configured   bool
	CatalogOnly  bool
}

ProviderCapability is one row in the capability matrix Settings renders. Configured = the user has an enabled providers row for it; CatalogOnly = the provider is a Sol-owned search-only entry, so it isn't a candidate for normal "add provider" flows.

type Service

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

func New

func New(d *db.DB, logger *zap.Logger) *Service

func (*Service) ListCapabilities

func (s *Service) ListCapabilities(ctx context.Context, p authz.Principal) ([]ProviderCapability, error)

ListCapabilities returns one ProviderCapability per known provider (merged catalog), with the per-row Configured + CatalogOnly flags the Settings matrix uses. Sort order: configured providers first, then alphabetical by display name — so "what you have" lands on top.

func (*Service) ListModels

func (s *Service) ListModels(ctx context.Context, p authz.Principal, opts ListModelsOptions) ([]Model, error)

ListModels returns the enriched catalog sorted by (provider, model). Use ConfiguredOnly to mask out catalog entries the operator hasn't enabled — the only filter that touches the DB.

func (*Service) ListProviders

func (s *Service) ListProviders(ctx context.Context, p authz.Principal) ([]Provider, error)

ListProviders returns hosted source providers plus the configurable OpenAI-compatible provider, sorted by ID.

Jump to

Keyboard shortcuts

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