|
57 | 57 | :function (select-keys tool [:name :description :parameters])}) |
58 | 58 | tools)) |
59 | 59 |
|
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))] |
62 | 62 | (llm-util/log-request logger-tag rid url body) |
63 | 63 | (http/post |
64 | 64 | url |
|
162 | 162 | (filter valid-message?))) |
163 | 163 |
|
164 | 164 | (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 |
166 | 166 | on-tools-called on-error handle-response supports-image? |
167 | 167 | thinking-start-block thinking-end-block]}] |
168 | 168 | (let [all-accumulated (vals @tool-calls-atom) |
|
192 | 192 | :extra-headers extra-headers |
193 | 193 | :api-url api-url |
194 | 194 | :api-key api-key |
| 195 | + :url-relative-path url-relative-path |
195 | 196 | :on-error on-error |
196 | 197 | :on-response (fn [event data] (handle-response event data tool-calls-atom new-rid))})))) |
197 | 198 | ;; No completed tools at all - let the streaming response provide the actual finish_reason |
|
266 | 267 | Handles the full conversation flow including tool calls, streaming responses, |
267 | 268 | and message normalization. Supports both single and parallel tool execution. |
268 | 269 | 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 |
270 | 271 | past-messages tools extra-payload extra-headers supports-image? parallel-tool-calls? |
271 | 272 | thinking-tag] |
272 | 273 | :or {temperature 1.0 |
|
327 | 328 | :body body |
328 | 329 | :api-url api-url |
329 | 330 | :api-key api-key |
| 331 | + :url-relative-path url-relative-path |
330 | 332 | :on-tools-called on-tools-called |
331 | 333 | :on-error on-error |
332 | 334 | :thinking-start-block thinking-start-tag |
|
426 | 428 | :extra-headers extra-headers |
427 | 429 | :api-url api-url |
428 | 430 | :api-key api-key |
| 431 | + :url-relative-path url-relative-path |
429 | 432 | :tool-calls* tool-calls* |
430 | 433 | :on-error on-error |
431 | 434 | :on-response (fn [event data] (handle-response event data tool-calls* rid))}))) |
0 commit comments