Skip to content

Commit 16d4100

Browse files
committed
Fix completion error handling
1 parent 38c8e9d commit 16d4100

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Improve chat title generation.
6+
- Fix completion error handling.
67

78
## 0.73.0
89

src/eca/handlers.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
(defn chat-query-commands [{:keys [db* config metrics]} params]
110110
(metrics/task metrics :eca/chat-query-commands
111-
(f.chat/query-commands params db* config)))
111+
(f.chat/query-commands params db* config)))
112112

113113
(defn chat-tool-call-approve [{:keys [messenger db* metrics]} params]
114114
(metrics/task metrics :eca/chat-tool-call-approve

src/eca/llm_api.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
(defn ^:private prompt!
7373
[{:keys [provider model model-capabilities instructions user-messages config
7474
on-message-received on-error on-prepare-tool-call on-tools-called on-reason on-usage-updated
75-
past-messages tools provider-auth sync?]}]
75+
past-messages tools provider-auth sync?]
76+
:or {on-error identity}}]
7677
(let [real-model (real-model-name model model-capabilities)
7778
tools (when (:tools model-capabilities)
7879
(mapv tool->llm-tool tools))
@@ -274,5 +275,4 @@
274275
:past-messages past-messages
275276
:user-messages (or user-messages
276277
[{:role "user" :content [{:type :text :text prompt}]}])
277-
:config config
278-
:on-error identity}))
278+
:config config}))

src/eca/llm_providers/openai.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
on-error
3737
(fn [error-data]
3838
(llm-util/log-response logger-tag rid "response-error" body)
39-
(reset! response* error-data)))]
39+
(reset! response* {:error error-data})))]
4040
(llm-util/log-request logger-tag rid url body)
4141
@(http/post
4242
url

0 commit comments

Comments
 (0)