Skip to content

Commit e4c5e0c

Browse files
committed
Fix openai-chat api not following completionUrlRelativePath.
1 parent e6e923e commit e4c5e0c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
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 `openai-chat` api not following `completionUrlRelativePath`.
6+
57
## 0.70.5
68

79
- Fix web-search not working for custom models using openai/anthropic apis.

src/eca/llm_providers/openai_chat.clj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
:function (select-keys tool [:name :description :parameters])})
5858
tools))
5959

60-
(defn ^:private base-request! [{:keys [rid extra-headers body api-url api-key on-error on-response]}]
61-
(let [url (str api-url chat-completions-path)]
60+
(defn ^:private base-request! [{:keys [rid extra-headers body url-relative-path api-url api-key on-error on-response]}]
61+
(let [url (str api-url (or url-relative-path chat-completions-path))]
6262
(llm-util/log-request logger-tag rid url body)
6363
(http/post
6464
url
@@ -162,7 +162,7 @@
162162
(filter valid-message?)))
163163

164164
(defn ^:private execute-accumulated-tools!
165-
[{:keys [tool-calls-atom instructions extra-headers body api-url api-key
165+
[{:keys [tool-calls-atom instructions extra-headers body api-url api-key url-relative-path
166166
on-tools-called on-error handle-response supports-image?
167167
thinking-start-block thinking-end-block]}]
168168
(let [all-accumulated (vals @tool-calls-atom)
@@ -192,6 +192,7 @@
192192
:extra-headers extra-headers
193193
:api-url api-url
194194
:api-key api-key
195+
:url-relative-path url-relative-path
195196
:on-error on-error
196197
:on-response (fn [event data] (handle-response event data tool-calls-atom new-rid))}))))
197198
;; No completed tools at all - let the streaming response provide the actual finish_reason
@@ -266,7 +267,7 @@
266267
Handles the full conversation flow including tool calls, streaming responses,
267268
and message normalization. Supports both single and parallel tool execution.
268269
Compatible with OpenRouter and other OpenAI-compatible providers."
269-
[{:keys [model user-messages instructions temperature api-key api-url
270+
[{:keys [model user-messages instructions temperature api-key api-url url-relative-path
270271
past-messages tools extra-payload extra-headers supports-image? parallel-tool-calls?
271272
thinking-tag]
272273
:or {temperature 1.0
@@ -327,6 +328,7 @@
327328
:body body
328329
:api-url api-url
329330
:api-key api-key
331+
:url-relative-path url-relative-path
330332
:on-tools-called on-tools-called
331333
:on-error on-error
332334
:thinking-start-block thinking-start-tag
@@ -426,6 +428,7 @@
426428
:extra-headers extra-headers
427429
:api-url api-url
428430
:api-key api-key
431+
:url-relative-path url-relative-path
429432
:tool-calls* tool-calls*
430433
:on-error on-error
431434
:on-response (fn [event data] (handle-response event data tool-calls* rid))})))

0 commit comments

Comments
 (0)