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

feat: Add canary word support #2

Merged
merged 5 commits into from
May 2, 2024
Merged

feat: Add canary word support #2

merged 5 commits into from
May 2, 2024

Conversation

masci
Copy link
Owner

@masci masci commented Apr 30, 2024

Usage

SYSTEM_PROMPT = Prompt("{{canary_word}}You are a helpful assistant.")

# somewhere in your app, `generate` uses SYSTEM_PROMPT
output = generate("This is a prompt injection attempt")

# check the system prompt hasn't leaked
assert not SYSTEM_PROMPT.canary_leaked(output)

@masci masci merged commit 2b1e924 into main May 2, 2024
12 checks passed
@masci masci deleted the canary branch May 2, 2024 07:23
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

Successfully merging this pull request may close these issues.

1 participant