branch: elpa/gptel
commit 7f9b063594bd00ace43cdc13ddd567129534b3b0
Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>

    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.
---
 gptel-openai.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gptel-openai.el b/gptel-openai.el
index cd3fb850f6..9347527b5f 100644
--- a/gptel-openai.el
+++ b/gptel-openai.el
@@ -210,7 +210,7 @@ information if the stream contains it."
               (when-let* ((response (gptel--json-read))
                           (delta (map-nested-elt response '(:choices 0 
:delta))))
                 (if-let* ((content (plist-get delta :content))
-                          ((not (eq content :null))))
+                          ((not (or (eq content :null) (string-empty-p 
content)))))
                     (push content content-strs)
                   ;; No text content, so look for tool calls
                   (when-let* ((tool-call (map-nested-elt delta '(:tool_calls 
0)))

Reply via email to