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

Vector similarity score comparison #109

Open
jsarneja opened this issue Feb 2, 2024 · 1 comment
Open

Vector similarity score comparison #109

jsarneja opened this issue Feb 2, 2024 · 1 comment

Comments

@jsarneja
Copy link

jsarneja commented Feb 2, 2024

According to the script detect_pi_vectorbase.py in python-sdk/rebuff/, the below code snippet assumes higher similarity score implies prompt injection, whereas it seems it should be the opposite i.e. a lower similarity score should mean prompt injection? The same logic is then used in detect_injection method in sdk.py to declare if injection exists.

Also the first if condition equates score and top_score and therefore second if condition would never run?

Am I missing something here?

snipped from detect_pi_vectorbase.py
image

snipped from sdk.py
image

@Osherz5
Copy link

Osherz5 commented Jan 22, 2025

I have noticed the same thing, it really looks like the vector db search will always return count_over_max_vector_score=0 rendering it ineffective

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

No branches or pull requests

2 participants