summaryrefslogtreecommitdiff
path: root/internal/llm/ollama_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-18 09:28:48 +0300
committerPaul Buetow <paul@buetow.org>2025-08-18 09:28:48 +0300
commit96ace6c7019a914e21b25fa94ddfc4ee9239c2fb (patch)
tree30550bcab30c91e917a4d8b3feccda829a364437 /internal/llm/ollama_test.go
parent6d29ac7e4b2604b5c7df50f33f8ef2357709faf2 (diff)
refactor(lsp,llm,hexailsp,appconfig): split long funcs; add tests
- Extract helpers to keep funcs <=50 lines; no behavior changes - Add tests for prompt removal, code actions, and LLM request builders - Table-drive TestInParamList; run gofmt
Diffstat (limited to 'internal/llm/ollama_test.go')
-rw-r--r--internal/llm/ollama_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/llm/ollama_test.go b/internal/llm/ollama_test.go
new file mode 100644
index 0000000..4ad6fdf
--- /dev/null
+++ b/internal/llm/ollama_test.go
@@ -0,0 +1,18 @@
+package llm
+
+import "testing"
+
+func TestBuildOllamaRequest_OptionsAndStream(t *testing.T) {
+ o := Options{Model: "codemodel", Temperature: 0, MaxTokens: 256, Stop: []string{"STOP"}}
+ msgs := []Message{{Role: "user", Content: "hello"}}
+ req := buildOllamaRequest(o, msgs, f64p(0.2), false)
+ if req.Model != "codemodel" || req.Stream { t.Fatalf("model/stream mismatch: %+v", req) }
+ if req.Options == nil { t.Fatalf("expected options map") }
+ if req.Options.(map[string]any)["temperature"].(float64) != 0.2 { t.Fatalf("default temp not applied") }
+ if req.Options.(map[string]any)["num_predict"].(int) != 256 { t.Fatalf("num_predict not applied") }
+ if req.Options.(map[string]any)["stop"].([]string)[0] != "STOP" { t.Fatalf("stop not applied") }
+
+ req2 := buildOllamaRequest(o, msgs, f64p(0.2), true)
+ if !req2.Stream { t.Fatalf("expected stream=true") }
+}
+