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

Integrate Vertex AI Models into GuardRails #402

Merged
merged 7 commits into from
Mar 15, 2024

Conversation

aishwaryap
Copy link
Collaborator

@aishwaryap aishwaryap commented Mar 14, 2024

Update to PR #387 (which will be closed)

This PR provides support for calling Vertex AI models in GuardRails. Topical evaluation has been done with gemini-1.0-pro and text-bison models and self check evaluation for hallucination, fact checking and content moderation has been done with gemini-1.0-pro.

Note that GoogleCloudPlatform/generative-ai#344 with Vertex AI models results in calls occasionally erroring out. This PR still contains some very general try-catch blocks in hallucination and moderation evaluations to handle this. Errors are reported as a separate category in evaluation.

…VertexAI to langchain_google_vertexai.VertexAI due to deprecation
docs/user_guides/llm/vertexai/config/README.md Outdated Show resolved Hide resolved
examples/configs/llm/vertexai/README.md Outdated Show resolved Hide resolved
docs/user_guides/llm/vertexai/README.md Outdated Show resolved Hide resolved
------
```

Now we can test Vertex AI models with GuardRails. The `config` directory includes a variation of the ABC Bot but calling the Gemini 1.0 Pro model from Vertex AI. The main difference is in the `config.yml` file. The relevant section is
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not duplicate the config in this folder. The notebook should copy the config when running and update the models part. The config folder itself should also be added to .gitignore so it doesn't get committed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@drazvan drazvan requested a review from trebedea March 14, 2024 16:11
@drazvan
Copy link
Collaborator

drazvan commented Mar 14, 2024

@trebedea : can you please review the changes to the evaluation part? Thanks!

Copy link
Collaborator

@trebedea trebedea left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor changes and a comment on Langchain usage.

nemoguardrails/eval/evaluate_moderation.py Outdated Show resolved Hide resolved
nemoguardrails/eval/evaluate_moderation.py Outdated Show resolved Hide resolved
nemoguardrails/llm/providers/providers.py Show resolved Hide resolved
@drazvan drazvan self-requested a review March 15, 2024 15:14
@drazvan
Copy link
Collaborator

drazvan commented Mar 15, 2024

Thanks @aishwaryap ! I've made a few additional changes. Looks good 👍 !
I'll merge this as is right now, for future contributions make sure the commits are signed: https://github.com/NVIDIA/NeMo-Guardrails/blob/main/CONTRIBUTING.md#submitting-your-work.

@drazvan drazvan merged commit 324fc5e into develop Mar 15, 2024
4 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