A client library for content security detection
Project description
Here’s the updated README for your framewise_secureline
project with the requested changes:
Framewise SecureLine
framewise_secureline
is a Python client library for interacting with the SecureLine API. It provides robust content security detection, including identifying sensitive information, prohibited topics, and potential attacks within text.
Features
-
Content Analysis: Detect and classify content based on predefined filters such as:
- Benign: Safe content.
- Prompt Attacks: Attempts to manipulate the system.
- Denied Topics: Topics flagged as prohibited.
- PPI Information: Personal Identifiable Information detection.
- Word Filters: Inappropriate or flagged language detection.
-
Custom Filters: Configure your own denied topics, PPI information types, and word filters.
-
Retry Mechanism: Automatically retries failed requests with exponential backoff.
-
Timeout Handling: Gracefully handles API timeouts.
-
Logging: Comprehensive logging for debugging and monitoring.
Installation
You can install framewise_secureline
using either Poetry or pip
.
Poetry Installation
git clone https://github.com/yourusername/framewise_secureline.git
cd framewise_secureline
poetry install
pip Installation
Install directly from PyPI (once published) or from the GitHub repository:
pip install framewise-secureline
Or, for the latest version from GitHub:
pip install git+https://github.com/yourusername/framewise_secureline.git
Usage
1. Initialization
Create a SecureLine
client using your SecureLine API key:
from framewise_secureline import SecureLine
client = SecureLine(
api_key="your-api-key",
denied_topics="medical diagnoses, competitors",
ppi_information="SSN, medical records",
word_filters="profanity"
)
2. Detect Content
Detect security concerns in text:
result = client.detect("This is a test message.")
print("Detection Probabilities:", result.raw_response["probabilities"])
3. Update Filters
Update default filters dynamically:
client.update_filters(
denied_topics="custom topics",
ppi_information="custom PPI",
word_filters="custom filters"
)
Examples
Basic Detection
message = "This contains personal information like SSN: 123-45-6789."
result = client.detect(message)
print("Benign Probability:", result.raw_response["probabilities"]["Benign"])
print("Detected Issues:", result.raw_response["probabilities"])
Retry Mechanism
result = client.detect(
text="This is another test message.",
retry_count=3, # Retry up to 3 times on failure
retry_delay=2.0 # Wait 2 seconds between retries
)
Running Tests
Framewise SecureLine uses pytest
for testing. Run tests with:
poetry run pytest
Integration Tests
To test with real API requests:
-
Set the
SECURELINE_API_KEY
environment variable:export SECURELINE_API_KEY="your-api-key"
-
Run integration tests:
poetry run pytest -m integration
Logging
Framewise SecureLine provides built-in logging for debugging and monitoring:
import logging
logging.basicConfig(level=logging.INFO)
client = SecureLine(api_key="your-api-key")
result = client.detect("Log this message.")
Project Structure
framewise_secureline/
├── framewise_secureline/
│ ├── __init__.py # Package initialization
│ ├── client.py # SecureLine client implementation
│ ├── models.py # DetectionResult class
│ ├── exceptions.py # Custom exceptions
├── tests/
│ ├── test_client.py # Unit and integration tests
├── pyproject.toml # Poetry configuration
├── README.md # Project documentation
Key Concepts
- Retry Logic: Configurable retry mechanism to handle intermittent network issues.
- Timeout Handling: Avoids hanging on API calls by setting a default timeout.
- Dynamic Filters: Update filters at runtime for customized detection.
Contributions
We welcome contributions! Follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request for review.
License
Framewise SecureLine is licensed under the MIT License. See the LICENSE file for details.
Support
For questions or issues, please contact sigireddybalasai@gmail.com or open an issue on the GitHub repository.
TODOs
- Add support for batch processing.
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
Built Distribution
File details
Details for the file framewise_secureline-0.1.0.tar.gz
.
File metadata
- Download URL: framewise_secureline-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1017-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11147007e9a30f07d39900e7a746b19de25a881f43742623785a66f6c2e14315 |
|
MD5 | e1cceefefacfbbf706ea071a22f29fe3 |
|
BLAKE2b-256 | 396021ea7db9a9cb1f115843ad3a2dd25490879529df9144d302a96f2d4dadf2 |
File details
Details for the file framewise_secureline-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: framewise_secureline-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1017-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9617b60666913bdbe4d71f355d1ba1e1adb86acc7366cb7aad761727e56fe8c9 |
|
MD5 | ff928278e182a2e016db7e3b78d6bb46 |
|
BLAKE2b-256 | f1454c80c433f044c0c18e73c0b4d871afce6ffbdae58a9cc390cd11497e11bc |