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

Guard as action #810

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

zsimjee
Copy link

@zsimjee zsimjee commented Oct 17, 2024

Description

This PR contains helper functions and docs that show nemoguardrails users how to use Guardrails AI-style validation in their nemoguardrails code flow.

Related Issue(s)

N/A

Checklist

  • I've read the CONTRIBUTING guidelines.
  • I've updated the documentation if applicable.
  • (N/A) I've added tests if applicable.
  • @mentions of the person or team responsible for reviewing proposed changes.

@cparisien cparisien requested a review from Pouyanpi October 31, 2024 15:33
@cparisien
Copy link
Collaborator

@Pouyanpi, this is one half of the upcoming integration with Guardrails AI -- they've got the other half on their side.
https://www.guardrailsai.com/


def register_guardrails_guard_actions(rails: LLMRails, guard: Guard, guard_name: str):
def fix_action(text, metadata={}):
return guard.validate(llm_output=text, metadata=metadata).validated_output

This comment was marked as resolved.

@Pouyanpi
Copy link
Collaborator

Pouyanpi commented Nov 6, 2024

Hi @zsimjee, is your PR ready for review? If it is, please mark it as ready for review. Thanks 👍

Copy link
Collaborator

@Pouyanpi Pouyanpi left a comment

Choose a reason for hiding this comment

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

Hi @zsimjee, Thank you for your pull request. I’ve suggested some high-level adjustments; please review the comments. If there were specific reasons for your chosen structure, please let me know.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make necessary adjustments and move this to https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/docs/user_guides/community

And you can add a brief intro to it similar to the other community integerations at https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/docs/user_guides/guardrails-library.md

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I need to review it more closely, but this is not consistent with other community integrations. Please have a look at https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library

Copy link
Author

Choose a reason for hiding this comment

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

This was built in the model of the langchain integration, not for a single guardrail. It's a framework level integration that gives nemoguardrails users access to 60+ validators available on the hub and the features , not a singular type of guardrail.

pyproject.toml Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

pyproject.toml will only include the core dependencies. Other integerations have either instructed the user in docs on what are the requirements or have included a
requirements.txt at https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library

I can also suggest you to use a lazy import and raise an error to install the package with the desired constraint. Deffered imports delay ImportError or ModuleNotFoundError exceptions for optional dependencies until the specific functionality is invoked, and you can instruct the user to install the package, look how it is used in the package 

docs/user_guides/guardrails-ai/guard-as-action/index.rst Outdated Show resolved Hide resolved
@zsimjee zsimjee marked this pull request as ready for review December 2, 2024 18:39
@Pouyanpi Pouyanpi requested a review from drazvan December 6, 2024 10:50
@Pouyanpi Pouyanpi added this to the v0.12.0 milestone Dec 6, 2024
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.

4 participants