Skip to content

Commit 999e3a7

Browse files
committed
Add grounding search feature to gemini
1 parent 2d10caf commit 999e3a7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

chatgpt-shell-google.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ If you use Gemini through a proxy service, change the URL base."
4848
:safe #'stringp
4949
:group 'chatgpt-shell)
5050

51+
(defcustom chatgpt-shell-google-enable-grounding-search nil
52+
"Enable the grounding google search tool for gemini models."
53+
:type 'boolean
54+
:group 'chatgpt-shell)
55+
5156
;; https://ai.google.dev/gemini-api/docs/tokens
5257
;; A token is equivalent to _about_ 4 characters.
5358
(cl-defun chatgpt-shell-google-make-model (&key version short-version path token-width context-window)
@@ -184,8 +189,10 @@ or
184189
(chatgpt-shell-google--gemini-user-model-messages
185190
(append context
186191
(when prompt
187-
(list (cons prompt nil)))))))
188-
(generation_config . ((temperature . ,(or temperature 1))
192+
(list (cons prompt nil))))))))
193+
(when chatgpt-shell-google-enable-grounding-search
194+
'((tools . ((google_search . ())))))
195+
`((generation_config . ((temperature . ,(or temperature 1))
189196
;; 1 is most diverse output.
190197
(topP . 1))))))
191198

0 commit comments

Comments
 (0)