Skip to main content

Python SDK for the Pinpout Prompt Injection Detection API

Project description

Pinpout Python SDK

Python SDK for the Pinpout Prompt Injection Detection API.

Installation

pip install pinpout

Quick Start

import pinpout

# Uses PINPOUT_API_KEY environment variable
result = pinpout.scan("What is the capital of France?")

if result.is_safe:
    print("Safe to pass to LLM")
else:
    print(f"Injection detected (confidence: {result.confidence})")

Explicit Client

from pinpout import Pinpout

client = Pinpout("pp_live_your_key_here")
result = client.scan("Hello world")

print(result.is_safe)       # True
print(result.confidence)    # 0.98
print(result.scan_id)       # "scan_abc123"

Async

from pinpout import AsyncPinpout

async with AsyncPinpout("pp_live_your_key_here") as client:
    result = await client.scan("Hello world")

Normalized Text

result = client.scan("h3ll0 w0rld", return_normalized=True)
print(result.normalized_text)  # "hello world"

Error Handling

from pinpout import Pinpout, AuthenticationError, RateLimitError

client = Pinpout("pp_live_your_key_here")

try:
    result = client.scan("test")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")

Configuration

Parameter Env Variable Default
api_key PINPOUT_API_KEY — (required)
base_url PINPOUT_BASE_URL https://api.pinpout.dev
timeout 30.0

License

MIT

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

pinpout-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinpout-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pinpout-0.1.0.tar.gz.

File metadata

  • Download URL: pinpout-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pinpout-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f5d7307af4605720093d6359cd57ff913b3db497b609eabef7009311a480480
MD5 8558c7d31d5d709a292f94c3c64d1a2e
BLAKE2b-256 ba4da4bd55e53d83fad396c263fce66deaafcb461a394d75df2a3f95fa7411f7

See more details on using hashes here.

File details

Details for the file pinpout-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pinpout-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pinpout-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb6d2d86e560200d64646fb4b89866662cfa984cb962fee8276d4ba1098fad25
MD5 b60a6a9f2a5a06c735cefa6e53a5f242
BLAKE2b-256 47323d8aa7df9f0b4c6bd2acecb64ec3a56926416185df5ffc49569d3cf785a9

See more details on using hashes here.

Supported by

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