branch: elpa/gptel
commit 850c20689fe00e18b13047c784c77f0df8ab6ca9
Author: Savva Surenkov <[email protected]>
Commit: GitHub <[email protected]>
gptel-gemini: Update model response parts structure
gptel-gemini.el (gptel--parse-buffer, gptel--inject-prompt):
Format the `:parts` field for model responses wrapped in
a vector, as required by the Gemini API.
---
gptel-gemini.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gptel-gemini.el b/gptel-gemini.el
index 7c6dbb11f39..1408ca022db 100644
--- a/gptel-gemini.el
+++ b/gptel-gemini.el
@@ -272,7 +272,7 @@ See generic implementation for full documentation."
if text
if role
collect (list :role "user" :parts `[(:text ,text)]) into prompts
- else collect (list :role "model" :parts `(:text ,text)) into
prompts
+ else collect (list :role "model" :parts `[(:text ,text)]) into
prompts
finally return prompts)))
(cl-defmethod gptel--parse-buffer ((backend gptel-gemini) &optional
max-entries)
@@ -286,7 +286,7 @@ See generic implementation for full documentation."
('response
(when-let* ((content (gptel--trim-prefixes
(buffer-substring-no-properties (point)
prev-pt))))
- (push (list :role "model" :parts (list :text content))
prompts)))
+ (push (list :role "model" :parts `[(:text ,content)]) prompts)))
(`(tool . ,_id)
(save-excursion
(condition-case nil