From 12e6acd5a9cb1f11b99d8d07c8402f811ad374b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Schr=C3=B6ter?= Date: Tue, 24 Sep 2024 09:18:33 +0200 Subject: [PATCH] Refactor LLM provider configuration to support custom server URL --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index cf89d10..fd57ef1 100644 --- a/main.go +++ b/main.go @@ -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)