Skip to content

Commit 250436f

Browse files
committed
Better error on llm call request
1 parent bf3e364 commit 250436f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/simulflow/utils/openai.clj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
[simulflow.schema :as schema]
1212
[simulflow.utils.core :as u]
1313
[simulflow.utils.request :as request]
14-
[taoensso.telemere :as t]))
14+
[taoensso.telemere :as t])
15+
(:import
16+
(clojure.lang ExceptionInfo)))
1517

1618
(def response-chunk-delta
1719
"Retrieve the delta part of a streaming completion response"
@@ -120,8 +122,12 @@
120122
(a/>!! interrupt-ch command))
121123

122124
nil)
123-
(catch Exception e
124-
(t/log! {:level :error :id log-id :error e} "Error processing command")))
125+
(catch ExceptionInfo e
126+
(t/log! {:level :error :id log-id :error e} "Error processing command")
127+
(when (= (:command/kind command) :command/sse-request)
128+
(let [data (ex-data e)
129+
body (slurp (:body data))]
130+
(t/log! {:level :error :id log-id :data {:body body}} "Error details")))))
125131
(recur)))
126132

127133
(merge parsed-config

0 commit comments

Comments
 (0)