profiles

package
v0.40.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package profiles provides pure model-profile selection helpers — the part of the legacy cmd/speechkit model_selection_helpers.go that depends only on config and the model catalog (no *appState, no network, no Wails surface).

Functions that orchestrate the STT router or validate against provider credentials stay in package main for now because they pull in subsystems earmarked for later C2 PRs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfiguredModeModelSelections

func ConfiguredModeModelSelections(cfg *config.Config, _ models.Catalog) map[string]ModeModelSelectionSnapshot

ConfiguredModeModelSelections returns the snapshot for every runtime mode in a stable map suitable for serialization.

func EffectiveSelectedProfile

func EffectiveSelectedProfile(cfg *config.Config, catalog models.Catalog, mode string) (models.Profile, bool)

EffectiveSelectedProfile returns the profile that should actually be used for the given mode, preferring the primary selection and falling back to the fallback if the primary is missing from the catalog.

func FindCatalogProfile

func FindCatalogProfile(catalog models.Catalog, profileID string) (models.Profile, bool)

FindCatalogProfile looks up a profile by ID in the catalog. The boolean is false for empty IDs and unknown profiles.

func ModalityForMode

func ModalityForMode(mode string) models.Modality

ModalityForMode maps a runtime mode name ("dictate", "assist", "voice_agent") to the corresponding model modality.

func ModeSelectionForMode

func ModeSelectionForMode(cfg *config.Config, mode string) config.ModeModelSelection

ModeSelectionForMode returns the normalized profile selection stored in config for the given runtime mode.

func NormalizeModeSelection

func NormalizeModeSelection(selection config.ModeModelSelection) config.ModeModelSelection

NormalizeModeSelection trims whitespace from both profile IDs and drops the fallback if it is identical to the primary.

func OrderedSelectionFromProfile

func OrderedSelectionFromProfile(cfg *config.Config, profile models.Profile) (appai.OrderedModelSelection, bool)

OrderedSelectionFromProfile maps a profile to the Genkit-flavoured (provider, model) pair the AI runtime expects. Returns false for unsupported execution modes.

func SelectedModelIDForProfile

func SelectedModelIDForProfile(cfg *config.Config, profile models.Profile) string

SelectedModelIDForProfile resolves the actual model ID to run for a profile, accounting for user-configured local-LLM model overrides when the profile is a local built-in.

func SetModeSelectionForProfile

func SetModeSelectionForProfile(cfg *config.Config, profile models.Profile)

SetModeSelectionForProfile writes the given profile as the primary selection for whichever runtime mode matches the profile's modality.

func ValidateLocalProviderActivation

func ValidateLocalProviderActivation(cfg *config.Config, modelPath string) error

ValidateLocalProviderActivation checks that the local whisper.cpp model path is valid, the binary is present, and the model file is available. Returns a specific error describing what is missing so the caller can present an actionable hint.

Types

type ModeModelSelectionSnapshot

type ModeModelSelectionSnapshot struct {
	PrimaryProfileID  string `json:"primaryProfileId"`
	FallbackProfileID string `json:"fallbackProfileId"`
}

ModeModelSelectionSnapshot is the JSON-friendly view of a mode's active profile selection (primary + optional fallback).

Jump to

Keyboard shortcuts

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