Skip to content
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

💄 style: Enable Grounding with Google Search for Gemini 2.0 #5778

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

sxjeru
Copy link
Contributor

@sxjeru sxjeru commented Feb 6, 2025

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

https://ai.google.dev/gemini-api/docs/grounding

Gemini 2.0 模型拥有每日免费 500 次搜索请求配额。

#5431 按钮功能实现前,只能是不太灵活的环境变量来禁用该功能。(避免收费)

GEMINI_SEARCH_ENABLED 设为 1 则启用搜索功能,由于该功能可能收费,默认禁用

参考文档,模型可以自动在合适的时机启用搜索,避免浪费配额,应当可以将 Grounding 搜索设为默认启用

Starting with Gemini 2.0, Google Search is available as a tool. This means that the model can decide when to use Google Search.
从 Gemini 2.0 开始,Google 搜索作为工具提供。这意味着模型可以决定何时使用 Google 搜索。

注意启用的是只有 Gemini 2.0 模型才可享受的 googleSearch,1.5 系列与之无关。

根据测试,Grounding 暂时无法和 functionCall 共存,启用 functionCall 时会自动关闭 Grounding 搜索。

image

📝 补充信息 | Additional Information

已确认可用。

image

Copy link

vercel bot commented Feb 6, 2025

@sxjeru is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @sxjeru

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 16 lines in your changes missing coverage. Please review.

Project coverage is 92.31%. Comparing base (7d782b1) to head (9d9c45e).
Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/agent-runtime/google/index.ts 42.85% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5778      +/-   ##
==========================================
- Coverage   92.33%   92.31%   -0.03%     
==========================================
  Files         647      647              
  Lines       58526    58553      +27     
  Branches     4293     4297       +4     
==========================================
+ Hits        54042    54054      +12     
- Misses       4484     4499      +15     
Flag Coverage Δ
app 92.31% <42.85%> (-0.03%) ⬇️
server 98.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sxjeru sxjeru marked this pull request as ready for review February 6, 2025 06:44
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Gemini labels Feb 6, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 6, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 6, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gemini size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] Gemini API Integration with Grounding
2 participants