|
258 | 258 | :call-tool-mock |
259 | 259 | ;; Ensure that the tools complete in the 3-2-1 order by adjusting sleep times |
260 | 260 | (fn [name & _others] |
| 261 | + ;; When this is called, we are already in a future. |
261 | 262 | (case name |
262 | 263 |
|
263 | 264 | "ro_tool_1" |
264 | | - (do (deep-sleep 300) |
| 265 | + (do (deep-sleep 900) |
265 | 266 | {:error false |
266 | 267 | :contents [{:type :text :content "RO tool call 1 result"}]}) |
267 | 268 |
|
268 | 269 | "ro_tool_2" |
269 | | - (do (deep-sleep 200) |
| 270 | + (do (deep-sleep 600) |
270 | 271 | {:error false |
271 | 272 | :contents [{:type :text :content "RO tool call 2 result"}]}) |
272 | 273 |
|
|
347 | 348 | (on-prepare-tool-call {:id "call-1" :name "ro_tool_1" :arguments-text ""}) |
348 | 349 | (on-prepare-tool-call {:id "call-2" :name "ro_tool_2" :arguments-text ""}) |
349 | 350 | (on-prepare-tool-call {:id "call-3" :name "ro_tool_3" :arguments-text ""}) |
350 | | - (future (Thread/sleep 200) |
351 | | - (deref wait-for-tool3) |
| 351 | + (future (Thread/sleep 400) |
| 352 | + (when (= :timeout (deref wait-for-tool3 10000 :timeout)) |
| 353 | + (println "tool-calls-with-prompt-stop-test: deref in prompt stop future timed out")) |
352 | 354 | (Thread/sleep 50) |
353 | 355 | (f.chat/prompt-stop {:chat-id chat-id} (h/db*) (h/messenger) (h/metrics)) |
354 | 356 | (deliver wait-for-stop true)) |
|
357 | 359 | {:id "call-3" :name "ro_tool_3" :arguments {}}]))) |
358 | 360 | :call-tool-mock |
359 | 361 | (fn [name & _others] |
| 362 | + ;; When this is called, we are already in a future |
360 | 363 | (case name |
361 | 364 |
|
362 | 365 | "ro_tool_1" |
363 | | - (do (deep-sleep 350) |
364 | | - (deref wait-for-tool2) |
| 366 | + (do (deep-sleep 1000) |
| 367 | + (when (= :timeout (deref wait-for-tool2 10000 :timeout)) |
| 368 | + (println "tool-calls-with-prompt-stop-test: deref in tool 1 timed out")) |
365 | 369 | {:error false |
366 | 370 | :contents [{:type :text :content "RO tool call 1 result"}]}) |
367 | 371 |
|
368 | 372 | "ro_tool_2" |
369 | | - (do (deep-sleep 300) |
370 | | - (deref wait-for-stop) |
| 373 | + (do (deep-sleep 800) |
| 374 | + (when (= :timeout (deref wait-for-stop 10000 :timeout)) |
| 375 | + (println "tool-calls-with-prompt-stop-test: deref in tool 2 timed out")) |
371 | 376 | (deliver wait-for-tool2 true) |
372 | 377 | {:error false |
373 | 378 | :contents [{:type :text :content "RO tool call 2 result"}]}) |
374 | 379 |
|
375 | 380 | "ro_tool_3" |
376 | | - (do (deep-sleep 100) |
| 381 | + (do (deep-sleep 200) |
377 | 382 | (deliver wait-for-tool3 true) |
378 | 383 | {:error false |
379 | 384 | :contents [{:type :text :content "RO tool call 3 result"}]})))})] |
|
0 commit comments