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 13 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.42%. Comparing base (6b5713a) to head (da2a380).
Report is 1 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.44%   92.42%   -0.03%     
==========================================
  Files         661      661              
  Lines       59965    59992      +27     
  Branches     2824     4402    +1578     
==========================================
+ Hits        55434    55445      +11     
- Misses       4531     4547      +16     
Flag Coverage Δ
app 92.42% <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
@Yuyuyang
Copy link

非常好的PR,我有如下疑问:如果我使用oneapi转发并重命名了我的Gemini模型,该环境变量是否仍然有效?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Very good PR, I have the following question: If I forward and rename my Gemini model using oneapi, is this environment variable still valid?

@sxjeru
Copy link
Contributor Author

sxjeru commented Feb 11, 2025

非常好的PR,我有如下疑问:如果我使用oneapi转发并重命名了我的Gemini模型,该环境变量是否仍然有效?

这样就不起作用了,只能是直接在 lobechat 配置 gemini 时有用。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Very good PR, I have the following question: If I forward and rename my Gemini model using oneapi, is this environment variable still valid?

This won't work, it can only be useful directly when configuring gemini in lobechat.

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
3 participants