Skip to main content

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:

  1. Set the SECURELINE_API_KEY environment variable:

    export SECURELINE_API_KEY="your-api-key"
    
  2. 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:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. 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

framewise_secureline-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

framewise_secureline-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file framewise_secureline-0.1.1.tar.gz.

File metadata

  • Download URL: framewise_secureline-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 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

Hashes for framewise_secureline-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c7a6ccc5e5e768a41276933d997e1dec81d29e53e6d0f646716b91f6f076dc13
MD5 6e4ef529e822b274177d5ea45bbebf66
BLAKE2b-256 4175bae964944e15b549d9b7229f6bbc228955bfa8058ac56078e210a1d2ab0f

See more details on using hashes here.

File details

Details for the file framewise_secureline-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for framewise_secureline-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1de191eb1303d94f3a56bc4f4d0be65f33c6999d158572a1c0a3faad79a4313e
MD5 94df2b458112f2fd277294d5f834b530
BLAKE2b-256 7930f14e671248b6ef8f026c070a654c1bbfff412f16bc887335567e439b035e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page