8000 Gemini: parse code execution and grounding result by blahgeek · Pull Request #810 · karthink/gptel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Gemini: parse code execution and grounding result #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

blahgeek
Copy link

(I'm not sure if this feature is desired or not. This is a draft version. Please let me know how you think.)

Gemini model support builtin tools including google search (grounding) and code execution. Now users can use :request-params to add support for them (#750 (comment) ). This PR extends the parsing function for Gemini to print grounding and code execution results. (We may need better ways other than custom :request-params to support these tools, but that's for future PRs)

Screenshot 2025-04-27 at 21 55 21 Screenshot 2025-04-27 at 21 55 56

@karthink
Copy link
Owner

@blahgeek Thanks for the PR. This feature is welcome. Can the codeExecution parsing be folded into the main cl-loop? Otherwise this looks fine.

@karthink
Copy link
Owner

(We may need better ways other than custom :request-params to support these tools, but that's for future PRs)

It's best to expose these features as backend-specific tools, I think. There's no way in gptel or its UI to have tools that only work with one backend, so yeah, :request-params will do for now.

@blahgeek
Copy link
Author

Thanks. I've updated the code according to your suggestion.

@eslgastal
Copy link

@blahgeek Nice! I think it would be interesting to have an option to extract the target redirected URL from the obfuscated "vertexaisearch.cloud.google.com" URLs. In Linux I've been doing this with curl -s -o /dev/null -w '%header{location}' --head <URL>.

Also, a couple of weeks ago I hacked together the insertion of grounding URLs with the associated citations throughout the LLM response (which shows where each grounding applies in the response). Unfortunately gptel's markdown->org conversion makes the :startIndex and :endIndex returned by Gemini incorrect for inserting the citations.

Here's the code, which may help in this PR:

https://gist.github.com/eslgastal/6700418bbad6ff9e49a4d6e28fe3dd83

And a screenshot:

gemini_grounding

Sign up for free to join this conversation on GitHub. 5917 Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0