[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 71d1c7ec8f: gptel-gemini: Add support for reasoning
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 71d1c7ec8f: gptel-gemini: Add support for reasoning blocks (#882) |
Date: |
Thu, 29 May 2025 19:01:08 -0400 (EDT) |
branch: elpa/gptel
commit 71d1c7ec8f9ac1d991267e4576d89b6adb093584
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
gptel-gemini: Add support for reasoning blocks (#882)
* gptel-gemini.el (gptel--parse-response, gptel--request-data):
Add support for thinking/reasoning blocks in responses from the
Gemini API. This is controlled by the existing
`gptel-include-reasoning' option, same as for all the other APIs.
---
gptel-gemini.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gptel-gemini.el b/gptel-gemini.el
index 5a76002161..26991f93ff 100644
--- a/gptel-gemini.el
+++ b/gptel-gemini.el
@@ -80,7 +80,15 @@ list."
(cl-loop
for part across parts
for tx = (plist-get part :text)
- if (and tx (not (eq tx :null))) collect tx into content-strs
+ if (and tx (not (eq tx :null)))
+ if (plist-get part :thought)
+ do (unless (plist-get info :reasoning-block)
+ (plist-put info :reasoning-block 'in))
+ (plist-put info :reasoning (concat (plist-get info :reasoning) tx))
+ else do
+ (if (eq (plist-get info :reasoning-block) 'in)
+ (plist-put info :reasoning-block t))
+ and collect tx into content-strs end
else if (plist-get part :functionCall)
collect (copy-sequence it) into tool-use
finally do ;Add text and tool-calls to prompts
list
@@ -134,6 +142,9 @@ list."
(setq params
(plist-put params
:maxOutputTokens gptel-max-tokens)))
+ (when gptel-include-reasoning
+ (setq params
+ (plist-put params :thinkingConfig '(:includeThoughts t))))
(when params
(plist-put prompts-plist
:generationConfig params))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/gptel 71d1c7ec8f: gptel-gemini: Add support for reasoning blocks (#882),
ELPA Syncer <=