Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Conversation

@ristomcgehee
Copy link
Contributor

@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants