Skip to content

Commit 3f88504

Browse files
committed
Implement RAG-based recommenders
1 parent b9086da commit 3f88504

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

config/config.go

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Config struct {
6262
Tracing TracingConfig `mapstructure:"tracing"`
6363
Experimental ExperimentalConfig `mapstructure:"experimental"`
6464
OIDC OIDCConfig `mapstructure:"oidc"`
65+
OpenAI OpenAIConfig `mapstructure:"openai"`
6566
}
6667

6768
// DatabaseConfig is the configuration for the database.
@@ -213,6 +214,13 @@ type OIDCConfig struct {
213214
RedirectURL string `mapstructure:"redirect_url" validate:"omitempty,endswith=/callback/oauth2"`
214215
}
215216

217+
type OpenAIConfig struct {
218+
BaseURL string `mapstructure:"base_url"`
219+
AuthToken string `mapstructure:"auth_token"`
220+
ChatCompletionModel string `mapstructure:"chat_completion_model"`
221+
EmbeddingsModel string `mapstructure:"embeddings_model"`
222+
}
223+
216224
func GetDefaultConfig() *Config {
217225
return &Config{
218226
Database: DatabaseConfig{

config/config.toml

+14
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,17 @@ client_secret = ""
309309
# Gorse dashboard URL and "/callback/oauth2". For example, if the Gorse dashboard URL is
310310
# http://localhost:8088, the redirect URL should be: http://localhost:8088/callback/oauth2
311311
redirect_url = ""
312+
313+
[openai]
314+
315+
# Base URL of OpenAI API.
316+
base_url = "http://localhost:11434/v1"
317+
318+
# API key of OpenAI API.
319+
auth_token = "ollama"
320+
321+
# Name of chat completion model.
322+
chat_completion_model = "qwen2.5"
323+
324+
# Name of embeddings model.
325+
embeddings_model = "mxbai-embed-large"

config/config_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ func TestUnmarshal(t *testing.T) {
156156
assert.Equal(t, "client_id", config.OIDC.ClientID)
157157
assert.Equal(t, "client_secret", config.OIDC.ClientSecret)
158158
assert.Equal(t, "http://localhost:8088/callback/oauth2", config.OIDC.RedirectURL)
159+
// [openai]
160+
assert.Equal(t, "http://localhost:11434/v1", config.OpenAI.BaseURL)
161+
assert.Equal(t, "ollama", config.OpenAI.AuthToken)
162+
assert.Equal(t, "qwen2.5", config.OpenAI.ChatCompletionModel)
163+
assert.Equal(t, "mxbai-embed-large", config.OpenAI.EmbeddingsModel)
159164
})
160165
}
161166
}

0 commit comments

Comments
 (0)