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

Modularize detection checks #90

Merged
merged 3 commits into from
Jan 14, 2024

Conversation

ristomcgehee
Copy link
Collaborator

@ristomcgehee ristomcgehee commented Dec 23, 2023

This PR refactors the JS SDK to perform the detection checks in a modular manner. This will make it easier to add new checks in the future as well as to customize which checks run by default.

I want to highlight that this is a BREAKING change for the SDK and will be a breaking change to the API once the same changes are made to it. I believe this is an acceptable change because at least in open source GitHub, no one is using the parameters that I am removing. For this code search, the only result of note is a demo notebook in LangChain, and it's only the output that includes the fields I'm removing.

#91 updates files in server along with a few others.

Once #88 is merged, I'd be willing to update the Python SDK to use the modular check logic.

A few notes about the changes in this PR:

  • Our code currently uses the term "check" which I've changed to "tactic". In programming in general, the term "check" is widely used, so it wouldn't be the best term to surface to external users of this project. I think "tactic" fits well since in the future we will be allowing users to define a collection of "tactics" to make up a "strategy".
  • Our code currently allows the user at detection time to disable certain checks (tactics) or to provide a different threshold score to determine if prompt injection is detected. With my PR, users retain the ability to do the same via the tacticOverrides parameter.

Part of #13

Copy link
Member

@seanpmorgan seanpmorgan left a comment

Choose a reason for hiding this comment

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

LGTM thanks Risto!

@seanpmorgan seanpmorgan merged commit b54c827 into protectai:main Jan 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants