guardrails icon indicating copy to clipboard operation
guardrails copied to clipboard

[bug] DetectPromptInjection validator asking for pinecone_environment

Open msintaha opened this issue 9 months ago • 5 comments

Describe the bug The DetectPromptInjection library is currently unusable because the underlying library (Rebuff) has not released the change for their API initialization. It seems you have reached out to them on their github repo, but I was wondering if the dependency on Rebuff can be changed to an alternative option as they dont seem to be responsive. Perhaps a pre-trained huggingface model?

To Reproduce Adding pinecone_api_key following the steps defined in DetectPromptInjection validator throws RebuffSdk.__init__() missing 1 required positional argument: 'pinecone_environment' error

Expected behavior Works without defining the pinecone_environment or using a different underlying library to detect prompt injections

Library version: Latest

msintaha avatar May 08 '24 22:05 msintaha

We're looking at this, and we think that we can get rebuff to work in one of the following ways

  1. add the github release to the pyproject
  2. add a pip installation from github to the post_install script

As far as the idea of using a diff prompt injection model from huggingface goes, I think this is something we should pursue regardless. If you would like to help create that validator, I can show you how and you can share it on the hub. Otherwise, we might take a bit to get to it

zsimjee avatar May 13 '24 17:05 zsimjee

We're looking at this, and we think that we can get rebuff to work in one of the following ways

  1. add the github release to the pyproject
  2. add a pip installation from github to the post_install script

As far as the idea of using a diff prompt injection model from huggingface goes, I think this is something we should pursue regardless. If you would like to help create that validator, I can show you how and you can share it on the hub. Otherwise, we might take a bit to get to it

@zsimjee thanks for getting back on this. For integrating the huggingface models, if there's some guideline on getting it integrated with a validator, I can take a look when I have some time, but for the rebuff workaround, I hope that's something coming up soon! Can you share timelines for this change?

msintaha avatar May 14 '24 19:05 msintaha

@msintaha sweet yes the rebuff validator fix is merged, but I haven't validated it yet. Should be able to try again, otherwise I'll validate it later tonight.

For huggingface models, you can follow the pattern here -

validator code - https://github.com/guardrails-ai/sensitive_topics/blob/67adbe4f47716b61a61486ad7fc7f87766f86d89/validator/main.py#L111

post-install script - https://github.com/guardrails-ai/sensitive_topics/blob/main/validator/post-install.py

validator - https://hub.guardrailsai.com/validator/guardrails/sensitive_topics

zsimjee avatar May 14 '24 23:05 zsimjee

@zsimjee I just tested by pulling the DetectPromptInjection validator again, it seems the error for the positional argument being required (pinecone_environment) still exists

msintaha avatar May 15 '24 23:05 msintaha

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Aug 09 '24 01:08 github-actions[bot]

This issue was closed because it has been stalled for 14 days with no activity.

github-actions[bot] avatar Aug 23 '24 03:08 github-actions[bot]