protectai / rebuff

LLM Prompt Injection Detector
https://playground.rebuff.ai
Apache License 2.0
1.01k stars 67 forks source link

Create function to init sdk #93

Closed ristomcgehee closed 5 months ago

ristomcgehee commented 6 months ago

Since in allowing custom strategies there are now more ways to misconfigure the SDK, I figured it would be good to create a dedicated function to initialize the SDK. This also improves the code by not having properties that don't get initialized in the constructor.

Setting "target": "es2017" to support top-level awaits.

Since I had issues when I made other PRs non-backwards compatible, I made this change backwards compatible. If you want to see how the code would look when we remove the public constructor, see 84a65e87801fff16464fda5a3314387b204b5b45. When I update server/ to use init() instead of the constructor, I will also remove the changes in 23f664a070a195e16048cb2ae2778a1e970f77d0.