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

781 prompt governance detect pii phi #61

Open
wants to merge 4 commits into
base: daxa_3.1
Choose a base branch
from

Conversation

gr8nishan
Copy link
Collaborator

This PR introduces functionality to call the /promptgov API from Langchain whenever a prompt is sent. This integration ensures enhanced entity extraction and validation against a deny list to improve prompt governance. Initially, this feature is implemented for Pebblo, with plans to extend it to Daxa in future updates.

Changes:-

In PebbloRetrievalQa, we have introduced a new parameter called _enable_prompt_gov, which defaults to True. When _enable_prompt_gov is True and there are values in the semantic_context.pebblo_semantic_entities.deny list, we invoke the _check_prompt_validity function. This function communicates with the /pebblogov API from Pebblo, retrieves entities from the prompt, and compares them against the deny list. If any entity from the prompt is found in the deny list, the function returns False; otherwise, it returns True. If the function returns True, the prompt is blocked.

Output

When we have a deny list

Screenshot 2024-07-04 at 11 41 16 AM

When we don't have a deny list
Screenshot 2024-07-04 at 6 58 14 PM

When we don't have any deny list but we have any entity in the prompt
Screenshot 2024-07-04 at 7 31 36 PM

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.

1 participant