|
37 | 37 | (match-content chat-id req-id "assistant" {:type "text" :text "Knock"}) |
38 | 38 | (match-content chat-id req-id "assistant" {:type "text" :text " knock!"}) |
39 | 39 | (match-content chat-id req-id "system" {:type "usage" |
40 | | - :messageInputTokens 10 |
41 | | - :messageOutputTokens 20 |
42 | 40 | :sessionTokens 30 |
43 | | - :messageCost (m/pred string?) |
| 41 | + :lastMessageCost (m/pred string?) |
44 | 42 | :sessionCost (m/pred string?)}) |
45 | 43 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
46 | 44 | (is (match? |
|
69 | 67 | (match-content chat-id req-id "system" {:type "progress" :state "running" :text "Generating"}) |
70 | 68 | (match-content chat-id req-id "assistant" {:type "text" :text "Foo"}) |
71 | 69 | (match-content chat-id req-id "system" {:type "usage" |
72 | | - :messageInputTokens 10 |
73 | | - :messageOutputTokens 5 |
74 | | - :sessionTokens 45 |
75 | | - :messageCost (m/pred string?) |
| 70 | + :sessionTokens 15 |
| 71 | + :lastMessageCost (m/pred string?) |
76 | 72 | :sessionCost (m/pred string?)}) |
77 | 73 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
78 | 74 | (is (match? |
79 | 75 | {:messages [{:role "user" :content [{:type "text" :text "Tell me a joke!"}]} |
80 | | - {:role "assistant" :content [{:type "text" :text "Knock knock!"}]} |
81 | | - {:role "user" :content [{:type "text" :text "Who's there?"}]}]} |
| 76 | + {:role "assistant" :content [{:type "text" :text "Knock knock!"}]} |
| 77 | + {:role "user" :content [{:type "text" :text "Who's there?"}]}]} |
82 | 78 | llm.mocks/*last-req-body*)))) |
83 | 79 |
|
84 | 80 | (testing "model reply again keeping context" |
|
105 | 101 | (match-content chat-id req-id "assistant" {:type "text" :text "\n\n"}) |
106 | 102 | (match-content chat-id req-id "assistant" {:type "text" :text "Ha!"}) |
107 | 103 | (match-content chat-id req-id "system" {:type "usage" |
108 | | - :messageInputTokens 5 |
109 | | - :messageOutputTokens 15 |
110 | | - :sessionTokens 65 |
111 | | - :messageCost (m/pred string?) |
| 104 | + :sessionTokens 20 |
| 105 | + :lastMessageCost (m/pred string?) |
112 | 106 | :sessionCost (m/pred string?)}) |
113 | 107 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
114 | 108 | (is (match? |
115 | 109 | {:messages [{:role "user" :content [{:type "text" :text "Tell me a joke!"}]} |
116 | | - {:role "assistant" :content [{:type "text" :text "Knock knock!"}]} |
117 | | - {:role "user" :content [{:type "text" :text "Who's there?"}]} |
118 | | - {:role "assistant" :content [{:type "text" :text "Foo"}]} |
119 | | - {:role "user" :content [{:type "text" :text "What foo?"}]}]} |
| 110 | + {:role "assistant" :content [{:type "text" :text "Knock knock!"}]} |
| 111 | + {:role "user" :content [{:type "text" :text "Who's there?"}]} |
| 112 | + {:role "assistant" :content [{:type "text" :text "Foo"}]} |
| 113 | + {:role "user" :content [{:type "text" :text "What foo?"}]}]} |
120 | 114 | llm.mocks/*last-req-body*)))))) |
121 | 115 |
|
122 | 116 | (deftest reasoning-text |
|
150 | 144 | (match-content chat-id req-id "assistant" {:type "text" :text "hello"}) |
151 | 145 | (match-content chat-id req-id "assistant" {:type "text" :text " there!"}) |
152 | 146 | (match-content chat-id req-id "system" {:type "usage" |
153 | | - :messageInputTokens 5 |
154 | | - :messageOutputTokens 30 |
155 | 147 | :sessionTokens 35 |
156 | | - :messageCost (m/pred string?) |
| 148 | + :lastMessageCost (m/pred string?) |
157 | 149 | :sessionCost (m/pred string?)}) |
158 | 150 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
159 | 151 | (is (match? |
|
187 | 179 | (match-content chat-id req-id "assistant" {:type "text" :text "I'm "}) |
188 | 180 | (match-content chat-id req-id "assistant" {:type "text" :text " fine"}) |
189 | 181 | (match-content chat-id req-id "system" {:type "usage" |
190 | | - :messageInputTokens 10 |
191 | | - :messageOutputTokens 20 |
192 | | - :sessionTokens 65 |
193 | | - :messageCost (m/pred string?) |
| 182 | + :sessionTokens 30 |
| 183 | + :lastMessageCost (m/pred string?) |
194 | 184 | :sessionCost (m/pred string?)}) |
195 | 185 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
196 | 186 | (is (match? |
197 | 187 | {:messages [{:role "user" :content [{:type "text" :text "hello!"}]} |
198 | | - {:role "assistant" |
199 | | - :content [{:type "thinking" |
200 | | - :signature "enc-123" |
201 | | - :thinking "I should say hello"}]} |
202 | | - {:role "assistant" :content [{:type "text" :text "hello there!"}]} |
203 | | - {:role "user" :content [{:type "text" :text "how are you?"}]}] |
| 188 | + {:role "assistant" |
| 189 | + :content [{:type "thinking" |
| 190 | + :signature "enc-123" |
| 191 | + :thinking "I should say hello"}]} |
| 192 | + {:role "assistant" :content [{:type "text" :text "hello there!"}]} |
| 193 | + {:role "user" :content [{:type "text" :text "how are you?"}]}] |
204 | 194 | :system (m/pred vector?)} |
205 | 195 | llm.mocks/*last-req-body*)))))) |
206 | 196 |
|
|
255 | 245 | :manualApproval false |
256 | 246 | :summary "Listing file tree"}) |
257 | 247 | (match-content chat-id req-id "system" {:type "usage" |
258 | | - :messageInputTokens 5 |
259 | | - :messageOutputTokens 30 |
260 | 248 | :sessionTokens 35 |
261 | | - :messageCost (m/pred string?) |
| 249 | + :lastMessageCost (m/pred string?) |
262 | 250 | :sessionCost (m/pred string?)}) |
263 | 251 | (match-content chat-id req-id "assistant" {:type "toolCallRun" |
264 | 252 | :origin "native" |
|
279 | 267 | "0 directories, 2 files")}]}) |
280 | 268 | (match-content chat-id req-id "assistant" {:type "text" :text "The files I see:\n"}) |
281 | 269 | (match-content chat-id req-id "assistant" {:type "text" :text "file1\nfile2\n"}) |
282 | | - (match-content chat-id req-id "system" {:type "usage" |
283 | | - :messageInputTokens 5 |
284 | | - :messageOutputTokens 30 |
285 | | - :sessionTokens 70 |
286 | | - :messageCost (m/pred string?) |
287 | | - :sessionCost (m/pred string?)}) |
288 | 270 | (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
289 | 271 | (is (match? |
290 | 272 | {:messages [{:role "user" :content [{:type "text" :text "What files you see?"}]} |
291 | | - {:role "assistant" |
292 | | - :content [{:type "thinking" |
293 | | - :signature "enc-123" |
294 | | - :thinking "I should call tool eca_directory_tree"}]} |
295 | | - {:role "assistant" :content [{:type "text" :text "I will list files"}]} |
296 | | - {:role "assistant" |
297 | | - :content [{:type "tool_use" |
298 | | - :id "tool-1" |
299 | | - :name "eca_directory_tree" |
300 | | - :input {:path (h/project-path->canon-path "resources")}}]} |
301 | | - {:role "user" |
302 | | - :content [{:type "tool_result" |
303 | | - :tool_use_id "tool-1" |
304 | | - :content (str "├── file1.md\n" |
305 | | - "└── file2.md\n\n" |
306 | | - "0 directories, 2 files\n")}]}] |
| 273 | + {:role "assistant" |
| 274 | + :content [{:type "thinking" |
| 275 | + :signature "enc-123" |
| 276 | + :thinking "I should call tool eca_directory_tree"}]} |
| 277 | + {:role "assistant" :content [{:type "text" :text "I will list files"}]} |
| 278 | + {:role "assistant" |
| 279 | + :content [{:type "tool_use" |
| 280 | + :id "tool-1" |
| 281 | + :name "eca_directory_tree" |
| 282 | + :input {:path (h/project-path->canon-path "resources")}}]} |
| 283 | + {:role "user" |
| 284 | + :content [{:type "tool_result" |
| 285 | + :tool_use_id "tool-1" |
| 286 | + :content (str "├── file1.md\n" |
| 287 | + "└── file2.md\n\n" |
| 288 | + "0 directories, 2 files\n")}]}] |
307 | 289 | :tools (m/embeds |
308 | 290 | [{:name "eca_directory_tree"}]) |
309 | 291 | :system (m/pred vector?)} |
|
0 commit comments