SonnyLabs API
Project description
SonnyLabs
Usage:
import sonnylabs
# Use SonnyLabs to score likelihood of prompt injection, toxicity etc.
result = sonnylabs.score_prompt(
prompt = prompt,
analysis_id = 10,
tag = "comment::1",
api_key = sonnylabs_api_key,
)
# Check prompt passes all security checks
if not result:
# There was a security issue, don't send the response to the LLM,
# and return an error message to the user
return "I'm sorry, I cannot fulfill the request"
# Security checks on user prompt are ok!
# Send prompt to LLM
llm_response = llm.query(prompt=prompt)
# Check security of LLM response
result = sonnylabs.score_prompt(
prompt = prompt + '\n' + llm_response,
analysis_id = 10,
tag = "comment::1",
api_key = sonnylabs_api_key,
)
# Check response passes security checks
if not result:
return "I'm sorry, I cannot fulfill the request"
# All security checks passed! Return response from LLM
return llm_response
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sonnylabs-0.0.1.tar.gz
(2.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonnylabs-0.0.1.tar.gz.
File metadata
- Download URL: sonnylabs-0.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca9dd1ded26ea6d6a14c7e0fec3026607fad71143de19fc8e351f6fecd52b6d4
|
|
| MD5 |
53d31c46cd9ea65fc143fde45afd7abb
|
|
| BLAKE2b-256 |
d771bb0e6a218872d3f83385d4a524d79905631ec821e9483559f4772137f348
|
File details
Details for the file sonnylabs-0.0.1-py3-none-any.whl.
File metadata
- Download URL: sonnylabs-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6970ef013a679113b57ecb1eb1118bd735135856c03d14dbcbe6df6b5d2aa9c6
|
|
| MD5 |
8bf71aaca5590f9d6f21046487f84512
|
|
| BLAKE2b-256 |
e47440631d378e2a2a531680497b062f37659c1d80d1fc90b2220636186fbaea
|