Lenzy AI Python SDK
Official Python SDK for the Lenzy AI analytics platform.
Installation
pip install lenzyai
Quick Start
from lenzyai import Lenzy
# Initialize the client
client = Lenzy(api_key="your-api-key")
# Record messages
client.record_messages(
project_id="proj_123",
external_conversation_id="conv_456",
messages=[
{
"role": "USER",
"content": "Hello!",
"external_id": "msg_1", # optional
"sent_at": "2025-11-27T10:30:00.000Z", # optional
},
{"role": "ASSISTANT", "content": "Hi there! How can I help you?"},
],
external_user_id="user_789", # optional
)
Configuration
The SDK can be configured in three ways (in order of precedence):
1. Constructor Parameters
from lenzyai import Lenzy
client = Lenzy(
api_key="your-api-key",
enabled=True, # Optional, defaults to True
)
2. Environment Variables
export LENZY_API_KEY="your-api-key"
export LENZY_ENABLED="true" # Optional, set to "false" or "0" to disable
from lenzyai import Lenzy
# Will use environment variables
client = Lenzy()
3. Defaults
enabled:True
Disabling the SDK
You can disable the SDK in non-production environment without removing code:
# Method 1: Constructor
client = Lenzy(api_key="your-api-key", enabled=False)
# Method 2: Environment variable
# export LENZY_ENABLED="false"
client = Lenzy(api_key="your-api-key")
# All record_messages() calls will be no-ops
client.record_messages(...) # Does nothing
Error Handling
The SDK uses a fail-safe design:
- Errors during initialization raise exceptions
- Errors during
record_messages()are logged but never raise exceptions - All errors are logged with the prefix "Lenzy Error:"
import logging
# Configure logging to see errors
logging.basicConfig(level=logging.ERROR)
client = Lenzy(api_key="your-api-key")
client.record_messages(...) # Logs errors, never crashes
Requirements
- Python 3.8+
requests>=2.25.0typing-extensions>=4.0.0
License
MIT License - see LICENSE file for details.
Metadata
Release files for lenzyai 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lenzyai-0.0.5.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lenzyai-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / lenzyai-0.0.5.tar.gz
| Download URL | lenzyai-0.0.5.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59b9e0dcd9e48c0342aeca54841613634cdd14d3237b1d51f177489fc5d27897
|
|
BLAKE2b-256 checksum How to use checksums |
6c9e45554844605d7633f1e375552a880462714a939c485a20ef46f224f44acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / lenzyai-0.0.5-py3-none-any.whl
| Download URL | lenzyai-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d02883610b29e6bc8743b8f955661f4854c1750239b185fd46a9c1725651861
|
|
BLAKE2b-256 checksum How to use checksums |
375d3f564724fedb0d150c664fc15d0140f3d4c0bbaf4a7d500ef38ef56c62f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|