diff --git a/core/backend/embeddings.go b/core/backend/embeddings.go index 264d947b9913..5bf8eff90781 100644 --- a/core/backend/embeddings.go +++ b/core/backend/embeddings.go @@ -14,7 +14,7 @@ func ModelEmbedding(s string, tokens []int, loader *model.ModelLoader, backendCo var inferenceModel interface{} var err error - opts := ModelOptions(backendConfig, appConfig, []model.Option{}) + opts := ModelOptions(backendConfig, appConfig) if backendConfig.Backend == "" { inferenceModel, err = loader.GreedyLoader(opts...) diff --git a/core/backend/image.go b/core/backend/image.go index 72c0007c5842..d21feb39eac0 100644 --- a/core/backend/image.go +++ b/core/backend/image.go @@ -9,7 +9,7 @@ import ( func ImageGeneration(height, width, mode, step, seed int, positive_prompt, negative_prompt, src, dst string, loader *model.ModelLoader, backendConfig config.BackendConfig, appConfig *config.ApplicationConfig) (func() error, error) { - opts := ModelOptions(backendConfig, appConfig, []model.Option{}) + opts := ModelOptions(backendConfig, appConfig) inferenceModel, err := loader.BackendLoader( opts..., diff --git a/core/backend/llm.go b/core/backend/llm.go index 3f44878bd93a..3e4f3d2b27ea 100644 --- a/core/backend/llm.go +++ b/core/backend/llm.go @@ -39,7 +39,7 @@ func ModelInference(ctx context.Context, s string, messages []schema.Message, im var inferenceModel grpc.Backend var err error - opts := ModelOptions(c, o, []model.Option{}) + opts := ModelOptions(c, o) if c.Backend != "" { opts = append(opts, model.WithBackendString(c.Backend)) diff --git a/core/backend/options.go b/core/backend/options.go index 6586eccf13fd..c65912222a58 100644 --- a/core/backend/options.go +++ b/core/backend/options.go @@ -11,7 +11,7 @@ import ( "github.com/rs/zerolog/log" ) -func ModelOptions(c config.BackendConfig, so *config.ApplicationConfig, opts []model.Option) []model.Option { +func ModelOptions(c config.BackendConfig, so *config.ApplicationConfig, opts ...model.Option) []model.Option { name := c.Name if name == "" { name = c.Model diff --git a/core/backend/rerank.go b/core/backend/rerank.go index f600e2e6eaff..fae97a81dbf6 100644 --- a/core/backend/rerank.go +++ b/core/backend/rerank.go @@ -11,7 +11,7 @@ import ( func Rerank(modelFile string, request *proto.RerankRequest, loader *model.ModelLoader, appConfig *config.ApplicationConfig, backendConfig config.BackendConfig) (*proto.RerankResult, error) { - opts := ModelOptions(backendConfig, appConfig, []model.Option{model.WithModel(modelFile)}) + opts := ModelOptions(backendConfig, appConfig, model.WithModel(modelFile)) rerankModel, err := loader.BackendLoader(opts...) if err != nil { return nil, err diff --git a/core/backend/soundgeneration.go b/core/backend/soundgeneration.go index b1b458b447ab..f79d271581ed 100644 --- a/core/backend/soundgeneration.go +++ b/core/backend/soundgeneration.go @@ -25,7 +25,7 @@ func SoundGeneration( backendConfig config.BackendConfig, ) (string, *proto.Result, error) { - opts := ModelOptions(backendConfig, appConfig, []model.Option{model.WithModel(modelFile)}) + opts := ModelOptions(backendConfig, appConfig, model.WithModel(modelFile)) soundGenModel, err := loader.BackendLoader(opts...) if err != nil { diff --git a/core/backend/token_metrics.go b/core/backend/token_metrics.go index acd256634a0a..19c30e29b9b0 100644 --- a/core/backend/token_metrics.go +++ b/core/backend/token_metrics.go @@ -15,9 +15,7 @@ func TokenMetrics( appConfig *config.ApplicationConfig, backendConfig config.BackendConfig) (*proto.MetricsResponse, error) { - opts := ModelOptions(backendConfig, appConfig, []model.Option{ - model.WithModel(modelFile), - }) + opts := ModelOptions(backendConfig, appConfig, model.WithModel(modelFile)) model, err := loader.BackendLoader(opts...) if err != nil { return nil, err diff --git a/core/backend/tokenize.go b/core/backend/tokenize.go index c8ec8d1cb260..ac63d85a55c4 100644 --- a/core/backend/tokenize.go +++ b/core/backend/tokenize.go @@ -14,9 +14,7 @@ func ModelTokenize(s string, loader *model.ModelLoader, backendConfig config.Bac var inferenceModel grpc.Backend var err error - opts := ModelOptions(backendConfig, appConfig, []model.Option{ - model.WithModel(modelFile), - }) + opts := ModelOptions(backendConfig, appConfig, model.WithModel(modelFile)) if backendConfig.Backend == "" { inferenceModel, err = loader.GreedyLoader(opts...) diff --git a/core/backend/transcript.go b/core/backend/transcript.go index c6ad9b597795..8406d2ef7a1b 100644 --- a/core/backend/transcript.go +++ b/core/backend/transcript.go @@ -18,7 +18,7 @@ func ModelTranscription(audio, language string, translate bool, ml *model.ModelL backendConfig.Backend = model.WhisperBackend } - opts := ModelOptions(backendConfig, appConfig, []model.Option{}) + opts := ModelOptions(backendConfig, appConfig) transcriptionModel, err := ml.BackendLoader(opts...) if err != nil { diff --git a/core/backend/tts.go b/core/backend/tts.go index bac2e9008836..83528a37a5da 100644 --- a/core/backend/tts.go +++ b/core/backend/tts.go @@ -28,10 +28,7 @@ func ModelTTS( bb = model.PiperBackend } - opts := ModelOptions(config.BackendConfig{}, appConfig, []model.Option{ - model.WithBackendString(bb), - model.WithModel(modelFile), - }) + opts := ModelOptions(config.BackendConfig{}, appConfig, model.WithBackendString(bb), model.WithModel(modelFile)) ttsModel, err := loader.BackendLoader(opts...) if err != nil { return "", nil, err diff --git a/core/http/endpoints/openai/realtime.go b/core/http/endpoints/openai/realtime.go index ec1ff682111e..71d064ddc980 100644 --- a/core/http/endpoints/openai/realtime.go +++ b/core/http/endpoints/openai/realtime.go @@ -129,10 +129,8 @@ func newModel(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig * if cfg.Pipeline.LLM == "" || cfg.Pipeline.TTS == "" || cfg.Pipeline.Transcription == "" { // If we don't have Wrapped model definitions, just return a standard model - opts := backend.ModelOptions(*cfg, appConfig, []model.Option{ - model.WithBackendString(cfg.Backend), - model.WithModel(cfg.Model), - }) + opts := backend.ModelOptions(*cfg, appConfig, model.WithBackendString(cfg.Backend), + model.WithModel(cfg.Model)) return ml.BackendLoader(opts...) } diff --git a/core/startup/startup.go b/core/startup/startup.go index 17e54bc0603b..941b73c3e9d5 100644 --- a/core/startup/startup.go +++ b/core/startup/startup.go @@ -160,7 +160,7 @@ func Startup(opts ...config.AppOption) (*config.BackendConfigLoader, *model.Mode log.Debug().Msgf("Auto loading model %s into memory from file: %s", m, cfg.Model) - o := backend.ModelOptions(*cfg, options, []model.Option{}) + o := backend.ModelOptions(*cfg, options) var backendErr error if cfg.Backend != "" {