Skip to main content

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

  1. Sign up at switchport.ai
  2. Create an organization and project
  3. 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.4.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

switchport-0.4.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file switchport-0.4.1.tar.gz.

File metadata

  • Download URL: switchport-0.4.1.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

Hashes for switchport-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e89d145eb904ff0c2f87ef7abf1433234718b155d5f6154a9662569e49000b24
MD5 82d44a4c0194740f90b3e20ed3f85e96
BLAKE2b-256 c048ca007a49a0e1b37cb448df178ab6676406fc9f4d4ea6988dc49c4b749c83

See more details on using hashes here.

File details

Details for the file switchport-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: switchport-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for switchport-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55c0ca396d97a4871591a18dc03d6db290a86003a697f992eb11e7e03622dc25
MD5 c19aa27603a00cd64422b4ff3e61bd46
BLAKE2b-256 c2ad88b232f5f235c24456a6e673cde1a443a381f7425fbff6a70940e4c702e3

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