|
242 | 242 | (on-message-received {:type :finish})) |
243 | 243 | :call-tool-mock |
244 | 244 | (constantly {:error false |
245 | | - :contents [{:type :text :content "Allowed directories: /foo/bar"}]})})] |
| 245 | + :contents [{:type :text :text "Allowed directories: /foo/bar"}]})})] |
246 | 246 | (is (match? |
247 | 247 | {chat-id {:id chat-id |
248 | 248 | :messages [{:role "user" :content [{:type :text :text "List the files you are allowed to see"}]} |
249 | 249 | {:role "assistant" :content [{:type :text :text "Ok, working on it"}]} |
250 | 250 | {:role "tool_call" :content {:id "call-1" :name "list_allowed_directories" :arguments {}}} |
251 | 251 | {:role "tool_call_output" :content {:id "call-1" :name "list_allowed_directories" :arguments {} |
252 | 252 | :output {:error false |
253 | | - :contents [{:content "Allowed directories: /foo/bar" |
| 253 | + :contents [{:text "Allowed directories: /foo/bar" |
254 | 254 | :type :text}]}}} |
255 | 255 | {:role "assistant" :content [{:type :text :text "I can see: \n/foo/bar"}]}]}} |
256 | 256 | (:chats (h/db)))) |
|
265 | 265 | {:role :assistant :content {:type :toolCallRun :id "call-1" :name "list_allowed_directories" :arguments {} :manual-approval false}} |
266 | 266 | {:role :assistant :content {:type :toolCallRunning :id "call-1" :name "list_allowed_directories" :arguments {}}} |
267 | 267 | {:role :system :content {:type :progress :state :running :text "Calling tool"}} |
268 | | - {:role :assistant :content {:type :toolCalled :id "call-1" :name "list_allowed_directories" :arguments {} :total-time-ms number? :outputs [{:content "Allowed directories: /foo/bar" :type :text}]}} |
| 268 | + {:role :assistant :content {:type :toolCalled :id "call-1" :name "list_allowed_directories" :arguments {} :total-time-ms number? :outputs [{:text "Allowed directories: /foo/bar" :type :text}]}} |
269 | 269 | {:role :system :content {:type :progress :state :running :text "Generating"}} |
270 | 270 | {:role :assistant :content {:type :text :text "I can see: \n"}} |
271 | 271 | {:role :assistant :content {:type :text :text "/foo/bar"}} |
|
304 | 304 | "ro_tool_1" |
305 | 305 | (do (deep-sleep 900) |
306 | 306 | {:error false |
307 | | - :contents [{:type :text :content "RO tool call 1 result"}]}) |
| 307 | + :contents [{:type :text :text "RO tool call 1 result"}]}) |
308 | 308 |
|
309 | 309 | "ro_tool_2" |
310 | 310 | (do (deep-sleep 600) |
311 | 311 | {:error false |
312 | | - :contents [{:type :text :content "RO tool call 2 result"}]}) |
| 312 | + :contents [{:type :text :text "RO tool call 2 result"}]}) |
313 | 313 |
|
314 | 314 | "ro_tool_3" |
315 | 315 | (do (deep-sleep 100) |
316 | 316 | {:error false |
317 | | - :contents [{:type :text :content "RO tool call 3 result"}]})))})] |
| 317 | + :contents [{:type :text :text "RO tool call 3 result"}]})))})] |
318 | 318 |
|
319 | 319 | (is (match? |
320 | 320 | {chat-id {:id chat-id |
|
323 | 323 | {:role "tool_call" :content {:id "call-3" :name "ro_tool_3" :arguments {}}} |
324 | 324 | {:role "tool_call_output" :content {:id "call-3" :name "ro_tool_3" :arguments {} |
325 | 325 | :output {:error false |
326 | | - :contents [{:type :text, :content "RO tool call 3 result"}]}}} |
| 326 | + :contents [{:type :text, :text "RO tool call 3 result"}]}}} |
327 | 327 | {:role "tool_call" :content {:id "call-2" :name "ro_tool_2" :arguments {}}} |
328 | 328 | {:role "tool_call_output" :content {:id "call-2" :name "ro_tool_2" :arguments {} |
329 | 329 | :output {:error false |
330 | | - :contents [{:type :text, :content "RO tool call 2 result"}]}}} |
| 330 | + :contents [{:type :text, :text "RO tool call 2 result"}]}}} |
331 | 331 | {:role "tool_call" :content {:id "call-1" :name "ro_tool_1" :arguments {}}} |
332 | 332 | {:role "tool_call_output" :content {:id "call-1" :name "ro_tool_1" :arguments {} |
333 | 333 | :output {:error false |
334 | | - :contents [{:type :text, :content "RO tool call 1 result"}]}}} |
| 334 | + :contents [{:type :text, :text "RO tool call 1 result"}]}}} |
335 | 335 | {:role "assistant" :content [{:type :text, :text "The tool calls returned: \nsomething"}]}]}} |
336 | 336 | (:chats (h/db)))) |
337 | 337 | (is (match? |
|
354 | 354 | {:role :assistant :content {:type :toolCallRunning :id "call-3" :name "ro_tool_3" :arguments {}}} |
355 | 355 | {:role :system :content {:type :progress :state :running, :text "Calling tool"}} |
356 | 356 | {:role :assistant :content {:type :toolCalled :id "call-3" :name "ro_tool_3" :arguments {} |
357 | | - :outputs [{:type :text :content "RO tool call 3 result"}] |
| 357 | + :outputs [{:type :text :text "RO tool call 3 result"}] |
358 | 358 | :error false}} |
359 | 359 | {:role :system :content {:type :progress :state :running, :text "Generating"}} |
360 | 360 | {:role :assistant :content {:type :toolCalled :id "call-2" :name "ro_tool_2" :arguments {} |
361 | | - :outputs [{:type :text :content "RO tool call 2 result"}] |
| 361 | + :outputs [{:type :text :text "RO tool call 2 result"}] |
362 | 362 | :error false}} |
363 | 363 | {:role :system :content {:type :progress :state :running, :text "Generating"}} |
364 | 364 | {:role :assistant :content {:type :toolCalled :id "call-1" :name "ro_tool_1" :arguments {} |
365 | | - :outputs [{:type :text :content "RO tool call 1 result"}] |
| 365 | + :outputs [{:type :text :text "RO tool call 1 result"}] |
366 | 366 | :error false}} |
367 | 367 | {:role :system :content {:type :progress :state :running, :text "Generating"}} |
368 | 368 | {:role :assistant :content {:type :text :text "The tool calls returned: \n"}} |
|
407 | 407 | (when (= :timeout (deref wait-for-tool2 10000 :timeout)) |
408 | 408 | (println "tool-calls-with-prompt-stop-test: deref in tool 1 timed out")) |
409 | 409 | {:error false |
410 | | - :contents [{:type :text :content "RO tool call 1 result"}]}) |
| 410 | + :contents [{:type :text :text "RO tool call 1 result"}]}) |
411 | 411 |
|
412 | 412 | "ro_tool_2" |
413 | 413 | (do (deep-sleep 800) |
414 | 414 | (when (= :timeout (deref wait-for-stop 10000 :timeout)) |
415 | 415 | (println "tool-calls-with-prompt-stop-test: deref in tool 2 timed out")) |
416 | 416 | (deliver wait-for-tool2 true) |
417 | 417 | {:error false |
418 | | - :contents [{:type :text :content "RO tool call 2 result"}]}) |
| 418 | + :contents [{:type :text :text "RO tool call 2 result"}]}) |
419 | 419 |
|
420 | 420 | "ro_tool_3" |
421 | 421 | (do (deep-sleep 200) |
422 | 422 | (deliver wait-for-tool3 true) |
423 | 423 | {:error false |
424 | | - :contents [{:type :text :content "RO tool call 3 result"}]})))})] |
| 424 | + :contents [{:type :text :text "RO tool call 3 result"}]})))})] |
425 | 425 | (is (match? {chat-id |
426 | 426 | {:id chat-id |
427 | 427 | :messages [{:role "user" :content [{:type :text :text "Run 3 read-only tool calls simultaneously."}]} |
428 | 428 | {:role "tool_call" :content {:id "call-3" :name "ro_tool_3" :arguments {}}} |
429 | 429 | {:role "tool_call_output" :content {:id "call-3" :name "ro_tool_3" :arguments {} |
430 | 430 | :output {:error false |
431 | | - :contents [{:type :text, :content "RO tool call 3 result"}]}}} |
| 431 | + :contents [{:type :text, :text "RO tool call 3 result"}]}}} |
432 | 432 | {:role "tool_call" :content {:id "call-2" :name "ro_tool_2" :arguments {}}} |
433 | 433 | {:role "tool_call_output" :content {:id "call-2" :name "ro_tool_2" :arguments {} |
434 | 434 | :output {:error false |
435 | | - :contents [{:type :text, :content "RO tool call 2 result"}]}}} |
| 435 | + :contents [{:type :text, :text "RO tool call 2 result"}]}}} |
436 | 436 | {:role "tool_call" :content {:id "call-1" :name "ro_tool_1" :arguments {}}} |
437 | 437 | {:role "tool_call_output" :content {:id "call-1" :name "ro_tool_1" :arguments {} |
438 | 438 | :output {:error false |
439 | | - :contents [{:type :text, :content "RO tool call 1 result"}]}}}]}} |
| 439 | + :contents [{:type :text, :text "RO tool call 1 result"}]}}}]}} |
440 | 440 | (:chats (h/db)))) |
441 | 441 | (is (match? {:chat-content-received |
442 | 442 | [{:role :user :content {:type :text :text "Run 3 read-only tool calls simultaneously.\n"}} |
|
455 | 455 | {:role :assistant :content {:type :toolCallRunning :id "call-3" :name "ro_tool_3" :arguments {}}} |
456 | 456 | {:role :system :content {:type :progress :state :running :text "Calling tool"}} |
457 | 457 | {:role :assistant :content {:type :toolCalled :id "call-3" :name "ro_tool_3" :arguments {} |
458 | | - :outputs [{:type :text :content "RO tool call 3 result"}]}} |
| 458 | + :outputs [{:type :text :text "RO tool call 3 result"}]}} |
459 | 459 | {:role :system :content {:type :progress :state :running :text "Generating"}} |
460 | 460 | {:role :system :content {:type :text :text "\nPrompt stopped"}} |
461 | 461 | {:role :system :content {:type :progress :state :finished}} |
|
0 commit comments