Skip to content

Commit 6d0adc9

Browse files
committed
Improve debug log for openai
1 parent 5667ca2 commit 6d0adc9

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/eca/config.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{:openaiApiKey nil
1919
:anthropicApiKey nil
2020
:rules []
21-
:mcpTimeoutSeconds 10
21+
:mcpTimeoutSeconds 30
2222
:mcpServers []
2323
:ollama {:host "http://localhost"
2424
:port 11434

src/eca/llm_api.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
(apply on-first-message-received args))
3232
(apply on-message-received args))
3333
tools (when (:mcp-tools model-config)
34-
(map mcp-tool->llm-tool mcp-tools))
34+
(mapv mcp-tool->llm-tool mcp-tools))
3535
web-search (:web-search model-config)]
3636
(cond
3737
(contains? #{"o4-mini"

src/eca/llm_providers/openai.clj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
(defn ^:private base-completion-request! [{:keys [body api-key on-error on-response]}]
2323
(let [api-key (or api-key
2424
(System/getenv "OPENAI_API_KEY"))]
25+
(logger/debug logger-tag (format "Sending input: '%s' instructions: '%s' tools: '%s'"
26+
(:input body)
27+
(:instructions body)
28+
(:tools body)))
2529
(http/post
2630
(url responses-path)
2731
{:headers {"Authorization" (str "Bearer " api-key)
@@ -48,14 +52,14 @@
4852
:or {temperature 1.0}}
4953
{:keys [on-message-received on-error on-tool-called]}]
5054
(let [input (conj past-messages {:role "user" :content user-prompt})
51-
_ (logger/debug logger-tag (format "Sending input: '%s' instructions: '%s'" input context))
55+
tools (cond-> tools
56+
web-search (conj {:type "web_search_preview"}))
5257
body {:model model
5358
:input input
5459
:user (str (System/getProperty "user.name") "@ECA")
5560
:instructions context
5661
:temperature temperature
57-
:tools (cond-> tools
58-
web-search (conj {:type "web_search_preview"}))
62+
:tools tools
5963
:stream true}
6064
on-response-fn (fn handle-response [event data]
6165
(llm-util/log-response logger-tag event data)

0 commit comments

Comments
 (0)