Skip to main content

Official Python SDK for Brizz platform

Project description

Brizz SDK

Python Version License

Brizz observability SDK for AI applications.

Installation

pip install brizz
# or
uv add brizz
# or
poetry add brizz

Quick Start

from brizz import Brizz

# Initialize
Brizz.initialize(
    api_key='your-brizzai-api-key',
    app_name='my-app',
)

Important: Initialize Brizz before importing any libraries you want to instrument (e.g., OpenAI). If using dotenv, use from dotenv import load_dotenv; load_dotenv() before importing brizz.

PII Masking

Automatically protects sensitive data in traces:

# Option 1: Enable default masking (simple)
Brizz.initialize(
    api_key='your-api-key',
    masking=True,  # Enables all built-in PII patterns
)

# Option 2: Custom masking configuration
from brizz import Brizz, MaskingConfig, SpanMaskingConfig, AttributesMaskingRule

Brizz.initialize(
    api_key='your-api-key',
    masking=MaskingConfig(
        span_masking=SpanMaskingConfig(
            rules=[
                AttributesMaskingRule(
                    attribute_pattern=r'gen_ai\.(prompt|completion)',
                    mode='partial',  # 'partial' or 'full'
                    patterns=[r'sk-[a-zA-Z0-9]{32}'],  # Custom regex patterns
                ),
            ],
        ),
    ),
)

Built-in patterns: emails, phone numbers, SSNs, credit cards, API keys, crypto addresses, and more. Use masking=True for defaults or MaskingConfig for custom rules.

Session Tracking

Group related operations and traces under a session context. All telemetry within the wrapped function will include the session ID:

from brizz import with_session_id, awith_session_id


async def process_user_workflow(chat_id):
    # All traces, events, and spans within this function
    # will be tagged with session-123
    response = await awith_session_id(chat_id, openai.chat.completions.create,
        model='gpt-4',
        messages=[{'role': 'user', 'content': 'Hello'}],
    )

    return response


# For synchronous functions
def sync_workflow(chat_id: str, data: dict):
    # Process data with session context
    return with_session_id(chat_id, processed_data, data)

Event Examples

from brizz import emit_event

emit_event('user.signup', {'user_id': '123', 'plan': 'pro'})
emit_event('user.payment', {'amount': 99, 'currency': 'USD'})

Deployment Environment

Optionally specify the deployment environment for better filtering and organization:

Brizz.initialize(
    api_key='your-api-key',
    app_name='my-app',
    environment='production',  # Optional: 'dev', 'staging', 'production', etc.
)

Environment Variables

BRIZZ_API_KEY=your-api-key                  # Required
BRIZZ_BASE_URL=https://telemetry.brizz.dev  # Optional
BRIZZ_APP_NAME=my-app                       # Optional
BRIZZ_ENVIRONMENT=production                # Optional: deployment environment (dev, staging, production)

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

brizz-0.1.3.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

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

brizz-0.1.3-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file brizz-0.1.3.tar.gz.

File metadata

  • Download URL: brizz-0.1.3.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for brizz-0.1.3.tar.gz
Algorithm Hash digest
SHA256 75a4673ca76602d8ec5a64e5aef7cbbd6f6d1d577eca24129b29e994c04fe254
MD5 c1a2eb157210d5ead7f195e914a1f10a
BLAKE2b-256 59a181d158715f9104b6e255a0af402e07418bbc847c25b2ee379275fcfb6392

See more details on using hashes here.

File details

Details for the file brizz-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: brizz-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for brizz-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9c35aded441f322ba208c79dd6f5166050b407682141fb341bf5c6c17dc00d2a
MD5 3123f8345662e937532e75d000e55fe2
BLAKE2b-256 2c9df6cfa046f6a4d5d92c133e41978d49938f7f73c856f37243dc33d1ff604b

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