branch: elpa/gptel commit 350087c6df997bfca794d781362c79dfe7407638 Author: Tim Felgentreff <timfelgentr...@gmail.com> Commit: GitHub <nore...@github.com>
gptel-openai: Don't parse tools named "null" (#935) (#951) * gptel-openai.el (gptel-curl--parse-stream): Temporarily ignore tools named "null" (the string, not the JSON type) when parsing tools during streaming. This is for compatibility with the litellm API, but this problem is on their side. NOTE: This change will be reverted without warning at the time of the next gptel release. (If litellm hasn't fixed it by then, your usage might break.) Co-authored-by: karthink <karthikchikmaga...@gmail.com> --- gptel-openai.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gptel-openai.el b/gptel-openai.el index 0a7554a0a0..f406040690 100644 --- a/gptel-openai.el +++ b/gptel-openai.el @@ -219,7 +219,9 @@ information if the stream contains it." ;; No text content, so look for tool calls (when-let* ((tool-call (map-nested-elt delta '(:tool_calls 0))) (func (plist-get tool-call :function))) - (if (plist-get func :name) ;new tool block begins + (if (and (plist-get func :name) + ;; TEMP: This check is for litellm compatibility, should be removed + (not (equal (plist-get func :name) "null"))) ; new tool block begins (progn (when-let* ((partial (plist-get info :partial_json))) (let* ((prev-tool-call (car (plist-get info :tool-use)))