Python SDK for Switchport - Prompt management and A/B testing platform
Project description
Switchport Python SDK
Official Python SDK for Switchport - Prompt management and A/B testing platform.
Features
- 🚀 Easy Integration: Simple, intuitive API
- 🎯 Prompt Execution: Call LLMs with managed prompts
- 📊 A/B Testing: Deterministic version routing based on context
- 📈 Metrics Recording: Track performance and user feedback
- 🔐 Secure: API key authentication
- 🎨 Flexible Context: Support for dict or string context
Installation
pip install switchport
Or install from source:
git clone https://github.com/switchport-ai/switchport-python.git
cd switchport-python
pip install -e .
Quick Start
1. Get Your API Key
- Sign up at switchport.ai
- Create an organization and project
- Get your API key from Settings (starts with
sp_)
2. Set Environment Variable
export SWITCHPORT_API_KEY=sp_your_key_here
3. Use the SDK
from switchport import Switchport
# Initialize client
client = Switchport() # Reads API key from environment
# Execute a prompt
response = client.prompts.execute(
prompt_key="welcome-message",
variables={"customer_name": "Alice"}
)
print(response.text) # Generated text from LLM
For complete examples and documentation, see the examples directory.
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
switchport-0.1.0.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file switchport-0.1.0.tar.gz.
File metadata
- Download URL: switchport-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05447a926104d7dcb67f8d1786f0cecfaadd99c2a8df65bff851c31c903ebe70
|
|
| MD5 |
691a2016a572bca207fc153b9747496b
|
|
| BLAKE2b-256 |
3ff6e6ccb7905eb828fcfd51931849bc959e745a2977d3171967b2de9c6a78b5
|
File details
Details for the file switchport-0.1.0-py3-none-any.whl.
File metadata
- Download URL: switchport-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb2653c390885264f5a062f5628a9eead0899849a8f25770a12587127c0e0fe8
|
|
| MD5 |
5d4365af168dc5e1e39d5f87b19a1851
|
|
| BLAKE2b-256 |
aab52665e2c89934008020df3da72c231f063f28e66da9da63662a184efc0f50
|