Documentation
¶
Index ¶
- Variables
- func StringToFeedbackTypeHookFunc() mapstructure.DecodeHookFunc
- type CollaborativeConfig
- type Config
- type DataSourceConfig
- type DatabaseConfig
- type EarlyStoppingConfig
- type ExternalConfig
- type FallbackConfig
- type GCSConfig
- type ItemToItemConfig
- type MasterConfig
- type MySQLConfig
- type NonPersonalizedConfig
- type OIDCConfig
- type OpenAIConfig
- type RankerConfig
- type RecommendConfig
- type ReplacementConfig
- type S3Config
- type ServerConfig
- type TracingConfig
- type UserToUserConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigTOML string
Functions ¶
func StringToFeedbackTypeHookFunc ¶
func StringToFeedbackTypeHookFunc() mapstructure.DecodeHookFunc
Types ¶
type CollaborativeConfig ¶
type CollaborativeConfig struct {
FitPeriod time.Duration `mapstructure:"fit_period" validate:"gt=0"`
FitEpoch int `mapstructure:"fit_epoch" validate:"gt=0"`
OptimizePeriod time.Duration `mapstructure:"optimize_period" validate:"gt=0"`
OptimizeTrials int `mapstructure:"optimize_trials" validate:"gt=0"`
EarlyStopping EarlyStoppingConfig `mapstructure:"early_stopping"`
}
func (*CollaborativeConfig) FullName ¶
func (config *CollaborativeConfig) FullName() string
func (*CollaborativeConfig) Hash ¶
func (config *CollaborativeConfig) Hash(cfg *RecommendConfig) string
type Config ¶
type Config struct {
Database DatabaseConfig `mapstructure:"database"`
Master MasterConfig `mapstructure:"master"`
Server ServerConfig `mapstructure:"server"`
Recommend RecommendConfig `mapstructure:"recommend"`
Tracing TracingConfig `mapstructure:"tracing"`
OIDC OIDCConfig `mapstructure:"oidc"`
OpenAI OpenAIConfig `mapstructure:"openai"`
S3 S3Config `mapstructure:"s3"`
GCS GCSConfig `mapstructure:"gcs"`
}
Config is the configuration for the engine.
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
func LoadConfig ¶
LoadConfig loads configuration from toml file.
type DataSourceConfig ¶
type DataSourceConfig struct {
PositiveFeedbackTypes []expression.FeedbackTypeExpression `mapstructure:"positive_feedback_types"` // positive feedback type
ReadFeedbackTypes []expression.FeedbackTypeExpression `mapstructure:"read_feedback_types"` // feedback type for read event
PositiveFeedbackTTL uint `mapstructure:"positive_feedback_ttl" validate:"gte=0"` // time-to-live of positive feedbacks
ItemTTL uint `mapstructure:"item_ttl" validate:"gte=0"` // item-to-live of items
}
type DatabaseConfig ¶
type DatabaseConfig struct {
DataStore string `mapstructure:"data_store" validate:"required,data_store"` // database for data store
CacheStore string `mapstructure:"cache_store" validate:"required,cache_store"` // database for cache store
TablePrefix string `mapstructure:"table_prefix"`
DataTablePrefix string `mapstructure:"data_table_prefix"`
CacheTablePrefix string `mapstructure:"cache_table_prefix"`
MySQL MySQLConfig `mapstructure:"mysql"`
}
DatabaseConfig is the configuration for the database.
type EarlyStoppingConfig ¶
type EarlyStoppingConfig struct {
Patience int `mapstructure:"patience"`
}
type ExternalConfig ¶
type ExternalConfig struct {
Name string `mapstructure:"name" json:"name"`
Script string `mapstructure:"script" json:"script"`
}
func (*ExternalConfig) FullName ¶
func (config *ExternalConfig) FullName() string
func (*ExternalConfig) Hash ¶
func (config *ExternalConfig) Hash() string
type FallbackConfig ¶
type FallbackConfig struct {
Recommenders []string `mapstructure:"recommenders"`
}
type GCSConfig ¶
type ItemToItemConfig ¶
type ItemToItemConfig struct {
Name string `mapstructure:"name" json:"name"`
Type string `mapstructure:"type" json:"type" validate:"oneof=embedding tags users chat auto"`
Column string `mapstructure:"column" json:"column" validate:"item_expr"`
Prompt string `mapstructure:"prompt" json:"prompt"`
}
func (*ItemToItemConfig) FullName ¶
func (config *ItemToItemConfig) FullName() string
func (*ItemToItemConfig) Hash ¶
func (config *ItemToItemConfig) Hash(cfg *RecommendConfig) string
type MasterConfig ¶
type MasterConfig struct {
Port int `mapstructure:"port" validate:"gte=0"` // master port
Host string `mapstructure:"host"` // master host
SSLMode bool `mapstructure:"ssl_mode"` // enable SSL mode
SSLCA string `mapstructure:"ssl_ca"` // SSL CA file
SSLCert string `mapstructure:"ssl_cert"` // SSL certificate file
SSLKey string `mapstructure:"ssl_key"` // SSL key file
HttpPort int `mapstructure:"http_port" validate:"gte=0"` // HTTP port
HttpHost string `mapstructure:"http_host"` // HTTP host
HttpCorsDomains []string `mapstructure:"http_cors_domains"` // add allowed cors domains
HttpCorsMethods []string `mapstructure:"http_cors_methods"` // add allowed cors methods
NumJobs int `mapstructure:"n_jobs" validate:"gt=0"` // number of working jobs
MetaTimeout time.Duration `mapstructure:"meta_timeout" validate:"gt=0"` // cluster meta timeout (second)
DashboardUserName string `mapstructure:"dashboard_user_name"` // dashboard user name
DashboardPassword string `mapstructure:"dashboard_password"` // dashboard password
DashboardRedacted bool `mapstructure:"dashboard_redacted"`
AdminAPIKey string `mapstructure:"admin_api_key"`
}
MasterConfig is the configuration for the master.
type MySQLConfig ¶
type MySQLConfig struct {
IsolationLevel string `mapstructure:"isolation_level" validate:"oneof=READ-UNCOMMITTED READ-COMMITTED REPEATABLE-READ SERIALIZABLE"`
}
type NonPersonalizedConfig ¶
type NonPersonalizedConfig struct {
Name string `mapstructure:"name" json:"name"`
Score string `mapstructure:"score" json:"score" validate:"required,item_expr"`
Filter string `mapstructure:"filter" json:"filter" validate:"item_expr"`
}
func (*NonPersonalizedConfig) FullName ¶
func (config *NonPersonalizedConfig) FullName() string
func (*NonPersonalizedConfig) Hash ¶
func (config *NonPersonalizedConfig) Hash() string
type OIDCConfig ¶
type OpenAIConfig ¶
type OpenAIConfig struct {
BaseURL string `mapstructure:"base_url"`
AuthToken string `mapstructure:"auth_token"`
ChatCompletionModel string `mapstructure:"chat_completion_model"`
ChatCompletionRPM int `mapstructure:"chat_completion_rpm"`
ChatCompletionTPM int `mapstructure:"chat_completion_tpm"`
EmbeddingModel string `mapstructure:"embedding_model"`
EmbeddingDimensions int `mapstructure:"embedding_dimensions"`
EmbeddingRPM int `mapstructure:"embedding_rpm"`
EmbeddingTPM int `mapstructure:"embedding_tpm"`
LogFile string `mapstructure:"log_file"`
}
type RankerConfig ¶
type RankerConfig struct {
Type string `mapstructure:"type" validate:"oneof=none fm llm"`
Recommenders []string `mapstructure:"recommenders"`
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"`
FitPeriod time.Duration `mapstructure:"fit_period" validate:"gt=0"`
FitEpoch int `mapstructure:"fit_epoch" validate:"gt=0"`
OptimizePeriod time.Duration `mapstructure:"optimize_period" validate:"gt=0"`
OptimizeTrials int `mapstructure:"optimize_trials" validate:"gt=0"`
Prompt string `mapstructure:"prompt"`
EarlyStopping EarlyStoppingConfig `mapstructure:"early_stopping"`
}
type RecommendConfig ¶
type RecommendConfig struct {
CacheSize int `mapstructure:"cache_size" validate:"gt=0"`
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"`
ContextSize int `mapstructure:"context_size" validate:"gt=0"`
ActiveUserTTL int `mapstructure:"active_user_ttl" validate:"gte=0"`
DataSource DataSourceConfig `mapstructure:"data_source"`
NonPersonalized []NonPersonalizedConfig `mapstructure:"non-personalized" validate:"dive"`
ItemToItem []ItemToItemConfig `mapstructure:"item-to-item" validate:"dive"`
UserToUser []UserToUserConfig `mapstructure:"user-to-user" validate:"dive"`
Collaborative CollaborativeConfig `mapstructure:"collaborative"`
External []ExternalConfig `mapstructure:"external" validate:"dive"`
Replacement ReplacementConfig `mapstructure:"replacement"`
Ranker RankerConfig `mapstructure:"ranker"`
Fallback FallbackConfig `mapstructure:"fallback"`
}
RecommendConfig is the configuration of recommendation setup.
func (*RecommendConfig) Hash ¶
func (r *RecommendConfig) Hash() string
func (*RecommendConfig) ListRecommenders ¶
func (r *RecommendConfig) ListRecommenders() []string
type ReplacementConfig ¶
type S3Config ¶
type ServerConfig ¶
type ServerConfig struct {
APIKey string `mapstructure:"api_key"` // default number of returned items
DefaultN int `mapstructure:"default_n" validate:"gt=0"` // secret key for RESTful APIs (SSL required)
ClockError time.Duration `mapstructure:"clock_error" validate:"gte=0"` // clock error in the cluster in seconds
AutoInsertUser bool `mapstructure:"auto_insert_user"` // insert new users while inserting feedback
AutoInsertItem bool `mapstructure:"auto_insert_item"` // insert new items while inserting feedback
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"` // server-side cache expire time
}
ServerConfig is the configuration for the server.
type TracingConfig ¶
type TracingConfig struct {
EnableTracing bool `mapstructure:"enable_tracing"`
Exporter string `mapstructure:"exporter" validate:"oneof=jaeger zipkin otlp otlphttp"`
CollectorEndpoint string `mapstructure:"collector_endpoint"`
Sampler string `mapstructure:"sampler"`
Ratio float64 `mapstructure:"ratio"`
}
func (*TracingConfig) Equal ¶
func (config *TracingConfig) Equal(other TracingConfig) bool
func (*TracingConfig) NewTracerProvider ¶
func (config *TracingConfig) NewTracerProvider() (trace.TracerProvider, error)
type UserToUserConfig ¶
type UserToUserConfig struct {
Name string `mapstructure:"name" json:"name"`
Type string `mapstructure:"type" json:"type" validate:"oneof=embedding tags items auto"`
Column string `mapstructure:"column" json:"column" validate:"item_expr"`
}
func (*UserToUserConfig) FullName ¶
func (config *UserToUserConfig) FullName() string
func (*UserToUserConfig) Hash ¶
func (config *UserToUserConfig) Hash(cfg *RecommendConfig) string
Click to show internal directories.
Click to hide internal directories.