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

feat: Vertex Check Grounding API integration #186

Merged
merged 17 commits into from
May 16, 2024

Conversation

Abhishekbhagwat
Copy link
Contributor

This PR is to integrate the Vertex Standalone API for Check Grounding.
The check grounding API determines how grounded a given piece of text is in a given set of reference texts. The API can generate supporting citations from the reference text to indicate where the given text is supported by the reference texts.
This is implemented as a output parser as Check Grounding is usually done once the generation step of the RAG pipeline is done.


from google.api_core import exceptions as core_exceptions # type: ignore
from google.auth.credentials import Credentials # type: ignore
from google.cloud import discoveryengine_v1alpha # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

it should not be on the top level, otherwise the library can't be used (since it makes an attempt to import on the module level, at __init__.py)

@gmogr
Copy link
Collaborator

gmogr commented May 2, 2024

/gcbrun

},
)
for doc in documents
if doc.page_content and doc.metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we ignoring documents with empty metadata?

)


def test_integration_parse(
Copy link
Collaborator

Choose a reason for hiding this comment

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

should any additional APIs be enabled on the project where tests are running?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the only API this integration requires is google-cloud-discoveryengine, which should automatically be installed from langchain-google-community[vertexaisearch]

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, should any GCP APIs be enabled / whitelisted for the GCP project where this test is running at?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we would need to whitelist Discovery Engine API if it has not been whitelisted for this to run.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to mark it as extended then

@lkuligin lkuligin merged commit 15b0264 into langchain-ai:main May 16, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. 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