Skip to content

Commit 08e46ed

Browse files
committed
Fix laat word going after tool call for openai-chat API.
1 parent deebb46 commit 08e46ed

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix laat word going after tool call for openai-chat API.
6+
57
## 0.63.2
68

79
- Fix retrocompatibility with some models not working with openai-chat like deepseek.

src/eca/llm_providers/openai_chat.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
(defn ^:private base-request! [{:keys [rid extra-headers body api-url api-key on-error on-response]}]
6161
(let [url (str api-url chat-completions-path)]
6262
(llm-util/log-request logger-tag rid url body)
63-
(logger/info "--------> " (json/generate-string body))
6463
(http/post
6564
url
6665
{:headers (merge {"Authorization" (str "Bearer " api-key)
@@ -368,6 +367,13 @@
368367

369368
;; Process tool calls if present
370369
(when (:tool_calls delta)
370+
;; Flush any leftover buffered content before finishing
371+
(let [buf @content-buffer*]
372+
(when (pos? (count buf))
373+
(if (= @reasoning-type* :tag)
374+
(on-reason {:status :thinking :id @current-reason-id* :text buf})
375+
(on-message-received {:type :text :text buf}))
376+
(reset! content-buffer* "")))
371377
(doseq [tool-call (:tool_calls delta)]
372378
(let [{:keys [index id function]} tool-call
373379
{name :name args :arguments} function

0 commit comments

Comments
 (0)