Documentation
¶
Index ¶
- func StringToFeedbackTypeHookFunc() mapstructure.DecodeHookFunc
- type CollaborativeConfig
- type Config
- type DataSourceConfig
- type DatabaseConfig
- type DigestOption
- type ExperimentalConfig
- type ItemToItemConfig
- type MasterConfig
- type MySQLConfig
- type NonPersonalizedConfig
- type OIDCConfig
- type OfflineConfig
- type OnlineConfig
- type OpenAIConfig
- type PopularConfig
- type RecommendConfig
- type ReplacementConfig
- type S3Config
- type ServerConfig
- type Settings
- type TracingConfig
- type UserToUserConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringToFeedbackTypeHookFunc ¶
func StringToFeedbackTypeHookFunc() mapstructure.DecodeHookFunc
Types ¶
type CollaborativeConfig ¶
type CollaborativeConfig struct {
ModelFitPeriod time.Duration `mapstructure:"model_fit_period" validate:"gt=0"`
ModelSearchPeriod time.Duration `mapstructure:"model_search_period" validate:"gt=0"`
ModelSearchEpoch int `mapstructure:"model_search_epoch" validate:"gt=0"`
ModelSearchTrials int `mapstructure:"model_search_trials" validate:"gt=0"`
EnableModelSizeSearch bool `mapstructure:"enable_model_size_search"`
}
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"`
Experimental ExperimentalConfig `mapstructure:"experimental"`
OIDC OIDCConfig `mapstructure:"oidc"`
OpenAI OpenAIConfig `mapstructure:"openai"`
S3 S3Config `mapstructure:"s3"`
}
Config is the configuration for the engine.
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
func LoadConfig ¶
LoadConfig loads configuration from toml file.
func (*Config) OfflineRecommendDigest ¶
func (config *Config) OfflineRecommendDigest(option ...DigestOption) string
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 DigestOption ¶
type DigestOption func(option *digestOptions)
func WithCollaborative ¶
func WithCollaborative(v bool) DigestOption
func WithRanking ¶
func WithRanking(v bool) DigestOption
type ExperimentalConfig ¶
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) Hash ¶
func (config *ItemToItemConfig) Hash() 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 OIDCConfig ¶
type OfflineConfig ¶
type OfflineConfig struct {
CheckRecommendPeriod time.Duration `mapstructure:"check_recommend_period" validate:"gt=0"`
RefreshRecommendPeriod time.Duration `mapstructure:"refresh_recommend_period" validate:"gt=0"`
ExploreRecommend map[string]float64 `mapstructure:"explore_recommend"`
EnableLatestRecommend bool `mapstructure:"enable_latest_recommend"`
EnablePopularRecommend bool `mapstructure:"enable_popular_recommend"`
EnableUserBasedRecommend bool `mapstructure:"enable_user_based_recommend"`
EnableItemBasedRecommend bool `mapstructure:"enable_item_based_recommend"`
EnableColRecommend bool `mapstructure:"enable_collaborative_recommend"`
EnableClickThroughPrediction bool `mapstructure:"enable_click_through_prediction"`
// contains filtered or unexported fields
}
func (*OfflineConfig) GetExploreRecommend ¶
func (config *OfflineConfig) GetExploreRecommend(key string) (value float64, exist bool)
func (*OfflineConfig) Lock ¶
func (config *OfflineConfig) Lock()
func (*OfflineConfig) UnLock ¶
func (config *OfflineConfig) UnLock()
type OnlineConfig ¶
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 PopularConfig ¶
type RecommendConfig ¶
type RecommendConfig struct {
CacheSize int `mapstructure:"cache_size" validate:"gt=0"`
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"`
ActiveUserTTL int `mapstructure:"active_user_ttl" validate:"gte=0"`
DataSource DataSourceConfig `mapstructure:"data_source"`
NonPersonalized []NonPersonalizedConfig `mapstructure:"non-personalized" validate:"dive"`
Popular PopularConfig `mapstructure:"popular"`
ItemToItem []ItemToItemConfig `mapstructure:"item-to-item" validate:"dive"`
UserToUser []UserToUserConfig `mapstructure:"user-to-user" validate:"dive"`
Collaborative CollaborativeConfig `mapstructure:"collaborative"`
Replacement ReplacementConfig `mapstructure:"replacement"`
Offline OfflineConfig `mapstructure:"offline"`
Online OnlineConfig `mapstructure:"online"`
}
RecommendConfig is the configuration of recommendation setup.
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 Settings ¶
type Settings struct {
Config *Config
// database clients
CacheClient cache.Database
DataClient data.Database
// recommendation models
CollaborativeFilteringModel cf.MatrixFactorization
CollaborativeFilteringModelId int64
ClickModel ctr.FactorizationMachines
ClickThroughRateModelId int64
}
func NewSettings ¶
func NewSettings() *Settings
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) Hash ¶
func (config *UserToUserConfig) Hash() string
Click to show internal directories.
Click to hide internal directories.