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

Uploaded Python 3

File details

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

File metadata

  • Download URL: switchport-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 ac8eb31c1880a0cb1e267fa54469844f30d55870b68d68681b16d20a6cca5c61
MD5 98f9606f34a2eac4aa40f86db5411a75
BLAKE2b-256 9173fd8213a682c2d4c3316ea3ce8690d84bf8a2695bfa19babb809569b1d87d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: switchport-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80eaad5e37a9cec5359c7afa3939fcff3355ee99b94f667759f2e31c65d0ed1c
MD5 9b6704bd336faec051745ba634765b0b
BLAKE2b-256 eb57ede093905d69c3d087be1ead41049f71d666951e67dd2b646c6695bcf384

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