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.2.tar.gz
(2.5 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.2.tar.gz.
File metadata
- Download URL: sonnylabs-0.0.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d751adb4172cb92efdc479a0f311be53b4609a2bcb733bb415166921d81e3a64
|
|
| MD5 |
6ce7a8f067ce9a81b1ee122932ba31a6
|
|
| BLAKE2b-256 |
aa0e73736165af882fe8d3a329b9f3962f08bfbe08f640cb8ba8d73614a36176
|
File details
Details for the file sonnylabs-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sonnylabs-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f87ac0d04c05cda42841093b69b32df2d8007a02b114747a4c34c694a96b2246
|
|
| MD5 |
7eec80d7a4315754007b5a6cc12d6dde
|
|
| BLAKE2b-256 |
f6e6e30db3665fa8a1dc86f5db589d808e2813fc90f70a79364b2b3a5b0ac997
|