Skip to content

Commit d7050f4

Browse files
committed
Fix ollama integration tests
1 parent e5a5338 commit d7050f4

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

integration-test/integration/chat/ollama_test.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
(is (match?
4545
{:model "qwen3"
4646
:messages [{:role "system" :content (m/pred string?)}
47-
{:role "user" :content [{:type "text" :text "Tell me a joke!"}]}]}
47+
{:role "user" :content "Tell me a joke!"}]}
4848
llm.mocks/*last-req-body*))))
4949

5050
(testing "We reply"
@@ -96,11 +96,11 @@
9696
(is (match?
9797
{:model "qwen3"
9898
:messages [{:role "system" :content (m/pred string?)}
99-
{:role "user" :content [{:type "text" :text "Tell me a joke!"}]}
100-
{:role "assistant" :content [{:type "text" :text "Knock knock!"}]}
101-
{:role "user" :content [{:type "text" :text "Who's there?"}]}
102-
{:role "assistant" :content [{:type "text" :text "Foo"}]}
103-
{:role "user" :content [{:type "text" :text "What foo?"}]}]}
99+
{:role "user" :content "Tell me a joke!"}
100+
{:role "assistant" :content "Knock knock!"}
101+
{:role "user" :content "Who's there?"}
102+
{:role "assistant" :content "Foo"}
103+
{:role "user" :content "What foo?"}]}
104104
llm.mocks/*last-req-body*))))))
105105

106106
(deftest reasoning-text
@@ -141,7 +141,7 @@
141141
(is (match?
142142
{:model "qwen3"
143143
:messages [{:role "system" :content (m/pred string?)}
144-
{:role "user" :content [{:type "text" :text "hello!"}]}]}
144+
{:role "user" :content "hello!"}]}
145145
llm.mocks/*last-req-body*))))
146146

147147
(testing "We reply"
@@ -173,10 +173,10 @@
173173
(is (match?
174174
{:model "qwen3"
175175
:messages [{:role "system" :content (m/pred string?)}
176-
{:role "user" :content [{:type "text" :text "hello!"}]}
176+
{:role "user" :content "hello!"}
177177
{:role "assistant" :content "I should say hello"}
178-
{:role "assistant" :content [{:type "text" :text "hello there!"}]}
179-
{:role "user" :content [{:type "text" :text "how are you?"}]}]}
178+
{:role "assistant" :content "hello there!"}
179+
{:role "user" :content "how are you?"}]}
180180
llm.mocks/*last-req-body*))))))
181181

182182
(deftest tool-calling
@@ -236,8 +236,8 @@
236236
(match-content chat-id req-id "system" {:type "progress" :state "finished"})
237237
(is (match?
238238
{:model "qwen3"
239-
:messages [{:role "user" :content [{:type "text" :text "What files you see?"}]}
240-
{:role "assistant" :content [{:type "text" :text "I will list files"}]}
239+
:messages [{:role "user" :content "What files you see?"}
240+
{:role "assistant" :content "I will list files"}
241241
{:role "assistant" :tool-calls [{:type "function"
242242
:function {:id (m/pred string?)
243243
:name "eca_directory_tree"

src/eca/llm_providers/ollama.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
"tool_call_output" {:role "tool" :content (llm-util/stringfy-tool-result content)}
9393
"reason" {:role "assistant" :content (:text content)}
9494
{:role (:role msg)
95-
:content (-> msg :content first :text)}))
95+
:content (if (string? (:content msg))
96+
(:content msg)
97+
(-> msg :content first :text))}))
9698
past-messages))
9799

98100
(defn completion! [{:keys [model user-messages reason? instructions api-url past-messages tools]}

0 commit comments

Comments
 (0)