llmfactory

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLLM

func NewLLM(cfg *ProviderConfig) (llms.Model, error)

Types

type Config

type Config struct {
	Providers []*ProviderConfig `json:"providers" yaml:"providers"`
}

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig from file

type Factory

type Factory interface {
	DefaultModel() (llms.Model, error)
	ModelByType(typ string) (llms.Model, error)
	ModelByName(name string) (llms.Model, error)
}

func Load

func Load(location string) (Factory, error)

Load returns OpenAI factory

func New

func New(cfg *Config) Factory

New creates a new LLM factory

type OpenAIConfig

type OpenAIConfig struct {
	BaseURL    string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
	APIVersion string `json:"api_version,omitempty" yaml:"api_version,omitempty"`
	// APIType specifies the type of API to use:
	// OPEN_AI|AZURE|AZURE_AD|CLOUDFLARE_AZURE
	APIType string `json:"api_type,omitempty" yaml:"api_type,omitempty"`
	// OrgID specifies which organization's quota and billing should be used when making API requests.
	OrgID            string `json:"org_id,omitempty" yaml:"org_id,omitempty"`
	AssistantVersion string `json:"assistant_version,omitempty" yaml:"assistant_version,omitempty"`
}

OpenAIConfig specifies options config

type ProviderConfig

type ProviderConfig struct {
	Name            string       `json:"name" yaml:"name"`
	Token           string       `json:"token,omitempty" yaml:"token,omitempty"`
	DefaultModel    string       `json:"default_model,omitempty" yaml:"default_model,omitempty"`
	AvailableModels []string     `json:"available_models,omitempty" yaml:"available_models,omitempty"`
	OpenAI          OpenAIConfig `json:"open_ai" yaml:"open_ai"`
}

ProviderConfig for the OpenAI provider

Jump to

Keyboard shortcuts

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