summaryrefslogtreecommitdiff
path: root/internal/llm/ollama_test.go
diff options
context:
space:
mode:
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") }
+}
+