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.

@sxjeru
Copy link
Contributor Author

sxjeru commented Feb 16, 2025

@arvinxx ่€ๅ“ฅๆœ‰็ฉบๅฏไปฅๅˆไธ€ไธ‹่ฟ™ไธช๏ผŒ่ฟ˜ๆ˜ฏๆŒบๆœ‰็”จ็š„ใ€‚

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@arvinxx Brother can combine this when he has time, it is quite useful.

@arvinxx
Copy link
Contributor

arvinxx commented Feb 17, 2025

@sxjeru ่ฟ™ไธชๅŠŸ่ƒฝๆˆ‘ๆœ‰็‚นไธๅคชๆƒณๅšๆˆๅ˜้‡๏ผŒ็›ฎๅ‰้’ˆๅฏนๆœ็ดข็š„้œ€ๆฑ‚้žๅธธๆ™ฎ้๏ผŒๆˆ‘ๆ˜ฏ่ฎกๅˆ’ๅšๆˆไธ€ไธชๅบ”็”จ็บง็š„่ƒฝๅŠ›็š„ใ€‚ๅŒ…ๅซไธค้ƒจๅˆ†๏ผš

  1. ๅบ”็”จ็บง็š„ๆœ็ดข๏ผ›
  2. ๆจกๅž‹็บง็š„ๆœ็ดข่ƒฝๅŠ›ใ€‚
image

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