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.0.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.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for switchport-0.4.0.tar.gz
Algorithm Hash digest
SHA256 eb375b19a8ffb7deb1a10cf031f695be68fc432c91def4321502c80d1e6b676c
MD5 0461cbf6e1f7c416e5d96ebecdcdf7c4
BLAKE2b-256 883b9eaaab3f37bde846cd5c373abf251504664135e10c021bfc5300fa09db4a

See more details on using hashes here.

File details

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

File metadata

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

Hashes for switchport-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1266c6381809b09cd048e77b8016a35a4644fe0c74ffa56955e7f9c703e691ce
MD5 0bdd5f116d8bbb3fa5e5a87d0369367a
BLAKE2b-256 be5070fcf24c1d7f4be15278ff1e0350d413fb47f5701441ca6b6186c912e605

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