Skip to content

Commit 7f9b063

Browse files
committed
gptel-openai: Tool call check with empty response chunk (#799)
* gptel-openai.el (gptel-curl--parse-stream): Look for tool calls when a streaming chunk has empty (as opposed to :null) content. This is to accommodate OpenAI-compatible APIs (#799) that behave differently from OpenAI in this respect.
1 parent 0c5a95d commit 7f9b063

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gptel-openai.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ information if the stream contains it."
210210
(when-let* ((response (gptel--json-read))
211211
(delta (map-nested-elt response '(:choices 0 :delta))))
212212
(if-let* ((content (plist-get delta :content))
213-
((not (eq content :null))))
213+
((not (or (eq content :null) (string-empty-p content)))))
214214
(push content content-strs)
215215
;; No text content, so look for tool calls
216216
(when-let* ((tool-call (map-nested-elt delta '(:tool_calls 0)))

0 commit comments

Comments
 (0)