model_runtime

package
v1.9.3-beta Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ParameterTypeInt   = "int"
	ParameterTypeStr   = "string"
	ParameterTypeFloat = "float"
	ParameterTypeBool  = "bool"
)
View Source
const (
	DirAssets = "assets"
)
View Source
const (
	ModelTypeLLM = "llm"
)

Variables

This section is empty.

Functions

func GetCustomizeLogo() string

func Load

func Load() error

func LoadProvider

func LoadProvider(name string) error

func ReadFile

func ReadFile(dir embed.FS, name string) (eosc.Untyped[string, string], error)

func Register

func Register(name string, driver IProvider)

func Remove

func Remove(name string)

Types

type Config

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

func NewConfig

func NewConfig(cfg string, validator IParamValidator) *Config

func (*Config) Check

func (c *Config) Check(cfg string) error

func (*Config) DefaultConfig

func (c *Config) DefaultConfig() string

func (*Config) GenConfig

func (c *Config) GenConfig(target string, origin string) (string, error)

type CustomizeProviderConfig

type CustomizeProviderConfig struct {
	BaseUrl string `json:"base_url"`
	ApiKey  string `json:"api_key"`
}

type IConfig

type IConfig interface {
	Check(cfg string) error
	GenConfig(target string, origin string) (string, error)
	DefaultConfig() string
}

type IModel

type IModel interface {
	ID() string
	Name() string
	Source() string
	ModelType() string
	AccessConfiguration() string
	ModelParameters() string
	IConfig
}

func NewCustomizeModel

func NewCustomizeModel(id string, name string, logo string, accessConfiguration string, modelParameters string) (IModel, error)

func NewModel

func NewModel(data string, logo string) (IModel, error)

type IParamValidator

type IParamValidator interface {
	Valid(map[string]interface{}) error
	GenConfig(target map[string]interface{}, origin map[string]interface{}) (string, error)
}

type IProvider

type IProvider interface {
	IProviderInfo
	GetModelConfig() ModelConfig
	SetModel(id string, model IModel)
	RemoveModel(id string)
	SetDefaultModel(modelType string, model IModel)
	GetModel(name string) (IModel, bool)
	Models() []IModel
	ModelsByType(modelType string) ([]IModel, bool)
	IConfig
	MaskConfig(cfg string) string
	Sort() int
	Recommend() bool
}

func GetProvider

func GetProvider(name string) (IProvider, bool)

func NewCustomizeProvider

func NewCustomizeProvider(id string, name string, models []IModel, defaultModel string, config string) (IProvider, error)

func NewProvider

func NewProvider(providerData string, modelContents map[string]eosc.Untyped[string, string]) (IProvider, error)

func Providers

func Providers() []IProvider

type IProviderInfo

type IProviderInfo interface {
	ID() string
	Name() string
	DefaultModel(modelType string) (IModel, bool)
	HelpUrl() string
	SetURI(IProviderURI)
	URI() IProviderURI
}

type IProviderURI

type IProviderURI interface {
	Scheme() string
	Host() string
	Path() string
}

func GetCustomizeProviderURI

func GetCustomizeProviderURI(config string, emptyURI bool) (IProviderURI, error)

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Del

func (m *Manager) Del(name string)

func (*Manager) Get

func (m *Manager) Get(name string) (IProvider, bool)

func (*Manager) List

func (m *Manager) List() []IProvider

func (*Manager) Set

func (m *Manager) Set(name string, driver IProvider)

type Model

type Model struct {

	//defaultConfig string
	IConfig
	// contains filtered or unexported fields
}

func (*Model) AccessConfiguration

func (m *Model) AccessConfiguration() string

func (*Model) ID

func (m *Model) ID() string
func (m *Model) Logo() string

func (*Model) ModelParameters

func (m *Model) ModelParameters() string

func (*Model) ModelType

func (m *Model) ModelType() string

func (*Model) Name

func (m *Model) Name() string
func (m *Model) SetLogo(logo string)

func (*Model) Source

func (m *Model) Source() string

type ModelConfig

type ModelConfig struct {
	AccessConfigurationStatus bool
	AccessConfigurationDemo   string
}

type ModelRegistry

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

type Param

type Param struct {
	Name     string      `json:"name" yaml:"name"`
	Default  interface{} `json:"default" yaml:"default"`
	Type     string      `json:"type" yaml:"type"`
	Min      float64     `json:"min" yaml:"min"`
	Max      float64     `json:"max" yaml:"max"`
	Required bool        `json:"required" yaml:"required"`
	Secret   bool        `json:"secret" yaml:"secret"`
}

type ParamValidator

type ParamValidator []Param

func (ParamValidator) GenConfig

func (p ParamValidator) GenConfig(target map[string]interface{}, origin map[string]interface{}) (string, error)

func (ParamValidator) Valid

func (p ParamValidator) Valid(params map[string]interface{}) error

type Provider

type Provider struct {
	IConfig
	// contains filtered or unexported fields
}

func (*Provider) DefaultModel

func (p *Provider) DefaultModel(modelType string) (IModel, bool)

func (*Provider) GetModel

func (p *Provider) GetModel(name string) (IModel, bool)

func (*Provider) GetModelConfig

func (p *Provider) GetModelConfig() ModelConfig

func (*Provider) HelpUrl

func (p *Provider) HelpUrl() string

func (*Provider) ID

func (p *Provider) ID() string
func (p *Provider) Logo() string

func (*Provider) MaskConfig

func (p *Provider) MaskConfig(cfg string) string

func (*Provider) Models

func (p *Provider) Models() []IModel

func (*Provider) ModelsByType

func (p *Provider) ModelsByType(modelType string) ([]IModel, bool)

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Recommend

func (p *Provider) Recommend() bool

func (*Provider) RemoveModel

func (p *Provider) RemoveModel(id string)

func (*Provider) SetDefaultModel

func (p *Provider) SetDefaultModel(modelType string, model IModel)

func (*Provider) SetModel

func (p *Provider) SetModel(id string, model IModel)

func (*Provider) SetURI

func (p *Provider) SetURI(uri IProviderURI)

func (*Provider) Sort

func (p *Provider) Sort() int

func (*Provider) URI

func (p *Provider) URI() IProviderURI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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