Refactor LLM provider configuration to support custom server URL

This commit is contained in:
Dominik Schröter 2024-09-24 09:18:33 +02:00
parent 26a160209f
commit 12e6acd5a9

View file

@ -123,8 +123,13 @@ func createLLM() (llms.Model, error) {
openai.WithToken(openaiAPIKey),
)
case "ollama":
host := os.Getenv("OLLAMA_HOST")
if host == "" {
host = "http://127.0.0.1:11434"
}
return ollama.New(
ollama.WithModel(llmModel),
ollama.WithServerURL(host),
)
default:
return nil, fmt.Errorf("unsupported LLM provider: %s", llmProvider)