factory

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FactoryConfig

type FactoryConfig struct {
	// Default provider to use
	DefaultProvider string
	DefaultModel    string

	// Anthropic configuration
	AnthropicAPIKey string
	AnthropicModel  string

	// Bedrock configuration
	BedrockRegion          string
	BedrockAccessKeyID     string
	BedrockSecretAccessKey string
	BedrockSessionToken    string
	BedrockProfile         string
	BedrockModelID         string

	// Ollama configuration
	OllamaEndpoint string
	OllamaModel    string

	// OpenAI configuration
	OpenAIAPIKey string
	OpenAIModel  string

	// Azure OpenAI configuration
	AzureOpenAIEndpoint     string
	AzureOpenAIDeploymentID string
	AzureOpenAIAPIKey       string
	AzureOpenAIEntraToken   string

	// Mistral configuration
	MistralAPIKey string
	MistralModel  string

	// Gemini configuration
	GeminiAPIKey string
	GeminiModel  string

	// HuggingFace configuration
	HuggingFaceToken string
	HuggingFaceModel string

	// Common settings
	MaxTokens   int
	Temperature float64
	Timeout     int // seconds
}

FactoryConfig holds configuration for creating LLM providers.

type ModelRegistry

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

ModelRegistry holds information about all supported models across providers.

func NewModelRegistry

func NewModelRegistry() *ModelRegistry

NewModelRegistry creates a new model registry with all supported models.

func (*ModelRegistry) GetAllModels

func (r *ModelRegistry) GetAllModels() []*loomv1.ModelInfo

GetAllModels returns all models from all providers.

func (*ModelRegistry) GetAvailableModels

func (r *ModelRegistry) GetAvailableModels(factory *ProviderFactory) []*loomv1.ModelInfo

GetAvailableModels returns models from available providers only. Uses the factory to check which providers are actually configured.

func (*ModelRegistry) GetModelsForProvider

func (r *ModelRegistry) GetModelsForProvider(provider string) []*loomv1.ModelInfo

GetModelsForProvider returns all models for a specific provider.

type ProviderFactory

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

ProviderFactory creates LLM providers dynamically based on configuration.

func NewProviderFactory

func NewProviderFactory(config FactoryConfig) *ProviderFactory

NewProviderFactory creates a new provider factory.

func (*ProviderFactory) CreateProvider

func (f *ProviderFactory) CreateProvider(provider, model string) (interface{}, error)

CreateProvider creates an LLM provider for the specified provider type and model. Returns interface{} to avoid import cycles (caller should type assert to agent.LLMProvider).

func (*ProviderFactory) IsProviderAvailable

func (f *ProviderFactory) IsProviderAvailable(provider string) bool

IsProviderAvailable checks if a provider is available (credentials/config present).

Jump to

Keyboard shortcuts

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