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

Grounding vertex AI Gemini #11545

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

Conversation

jmugicagonz
Copy link

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested functionalities for chat, passing datastore as string parameter.

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added new unit/integration tests
  • Added new notebook (that tests end-to-end)
  • I stared at the code and made sure it makes sense

Suggested Checklist:

  • [X ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • [X ] My changes generate no new warnings
  • [X ] I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran make format; make lint to appease the lint gods

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 1, 2024
if datastore:
from vertexai.preview.generative_models import Tool, grounding
tool = Tool.from_retrieval(
grounding.Retrieval(grounding.VertexAISearch(datastore=datastore))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Do you mind giving me a quick rundown of what this does to API calls? Does it force the LLM to act as an agent with this single retrieval tool?

Does vertexai support tools for any LLM? This would be really nice for agents for example, similar to openais tools api

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Logan,

Thanks for your answer. What this does is, in case you have a Verte datastore defined (see this link) you can ground your model in the data store. This is incredibly convenient for RAG applications, as creating a datastore is very easy.

And it doesn't force the LLM to act as an agent. You are just giving the LLM your datastore as a resource. You can tell in the prompt to give an answer strictly using the datastore, to reduce hallucinations.

@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 Mar 12, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 12, 2024
@logan-markewich logan-markewich enabled auto-merge (squash) March 12, 2024 16:16
@sandangel
Copy link
Contributor

hmm, linting for 3.9 is failing so auto merge not happen yet. :(

auto-merge was automatically disabled June 18, 2024 11:01

Head branch was pushed to by a user without write access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants