localmodels

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOmniVoiceCommand = "omnivoice-llamacpp"

	OmniVoiceAudioContentType = "audio/wav"
)

Variables

This section is empty.

Functions

func BuildCatalog

func BuildCatalog(runtimeCfg *factoryconfig.LoadedFactoryConfig) map[string]CatalogEntry

BuildCatalog projects configured model workers into API catalog entries.

func CanonicalBackendName

func CanonicalBackendName(value string) string

func CanonicalModelName

func CanonicalModelName(model string) string

CanonicalModelName normalizes model identifiers for catalog lookup.

func GetModel

func GetModel(runtimeCfg *factoryconfig.LoadedFactoryConfig, modelName string) (factoryapi.ModelDetail, error)

GetModel returns model detail for a catalog model name.

func ListModels

ListModels builds the list-models API response from runtime config.

func PullModel

func PullModel(
	puller AssetPuller,
	ctx context.Context,
	runtimeCfg *factoryconfig.LoadedFactoryConfig,
	modelName string,
) (apisurface.ModelPullResult, error)

PullModel validates catalog locality and delegates asset pull to the injected puller.

func ResourceSummary

func ResourceSummary(resource interfaces.ResourceConfig) factoryapi.ModelResourceSummary

ResourceSummary maps a factory resource config to the API model-resource summary shape.

func RuntimeResource

func RuntimeResource(factoryCfg *interfaces.FactoryConfig, workerDef *interfaces.WorkerConfig) (interfaces.ResourceConfig, string, bool)

func SelectInvocationWorker

func SelectInvocationWorker(
	runtimeCfg *factoryconfig.LoadedFactoryConfig,
	modelName, operationName string,
) (*interfaces.WorkerConfig, interfaces.ModelOperation, error)

SelectInvocationWorker resolves the model worker and operation for direct invocation.

Types

type AssetPuller

type AssetPuller interface {
	PullModel(ctx context.Context, runtimeCfg *factoryconfig.LoadedFactoryConfig, modelName string) (apisurface.ModelPullResult, error)
	EnsureModelAvailable(ctx context.Context, runtimeCfg *factoryconfig.LoadedFactoryConfig, worker *interfaces.WorkerConfig) error
	ResolveModelCache(ctx context.Context, runtimeCfg *factoryconfig.LoadedFactoryConfig, worker *interfaces.WorkerConfig) (CacheLayout, error)
}

AssetPuller resolves managed local model assets and pull outcomes.

func NewAssetPuller

func NewAssetPuller(cacheDir string) AssetPuller

NewAssetPuller constructs a managed local-model asset puller for the given cache directory.

type CacheLayout

type CacheLayout struct {
	ModelName string
	CachePath string
	Revision  string
	Files     []string
}

type CatalogEntry

type CatalogEntry struct {
	Summary factoryapi.ModelSummary
	Detail  factoryapi.ModelDetail
}

CatalogEntry holds API summary and detail for one discovered model.

type Handle

type Handle interface {
	Invoke(context.Context, InvocationRequest) (interfaces.InferenceResponse, error)
}

type Hooks

type Hooks struct {
	MarkResourceWaitStarted  func(context.Context, time.Time)
	MarkResourceWaitFinished func(context.Context, time.Time, bool)
	MarkLoadRequested        func(context.Context, time.Time)
	MarkLoadFinished         func(context.Context, time.Time)
	MarkLoadReused           func(context.Context)
}

type InvocationRequest

type InvocationRequest struct {
	Resource interfaces.ResourceConfig
	Worker   *interfaces.WorkerConfig
	Request  interfaces.RunnerExecutionRequest
}

type LoadRequest

type LoadRequest struct {
	Resource  interfaces.ResourceConfig
	Worker    *interfaces.WorkerConfig
	ModelName string
	CachePath string
	Revision  string
	Files     []string
}

type Manager

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

func NewManager

func NewManager(assetPuller AssetPuller, runtime Runtime, hooks Hooks) *Manager

func (*Manager) WrapRunner

func (m *Manager) WrapRunner(
	inner workers.Runner,
	runtimeCfg interfaces.RuntimeConfigLookup,
	factoryCfg *interfaces.FactoryConfig,
	workerDef *interfaces.WorkerConfig,
) workers.Runner

type OmniVoiceInvocationPayload

type OmniVoiceInvocationPayload struct {
	Operation  string                                     `json:"operation"`
	ModelName  string                                     `json:"modelName"`
	Revision   string                                     `json:"revision,omitempty"`
	OutputFile string                                     `json:"outputFile"`
	Text       string                                     `json:"text"`
	Bindings   []interfaces.ResolvedModelOperationBinding `json:"bindings,omitempty"`
}

type ResourceLimiter

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

func NewResourceLimiter

func NewResourceLimiter(hooks Hooks) *ResourceLimiter

func (*ResourceLimiter) WrapRunner

func (l *ResourceLimiter) WrapRunner(
	inner workers.Runner,
	factoryCfg *interfaces.FactoryConfig,
	workerDef *interfaces.WorkerConfig,
) workers.Runner

type ResourceLimiterEntry

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

type Runtime

type Runtime interface {
	Supports(resource interfaces.ResourceConfig, worker *interfaces.WorkerConfig) bool
	Load(context.Context, LoadRequest) (Handle, error)
}

func NewOmniVoiceRuntime

func NewOmniVoiceRuntime(runner workers.CommandRunner) Runtime

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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