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

Uploaded Python 3

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

Hashes for switchport-0.1.0.tar.gz
Algorithm Hash digest
SHA256 05447a926104d7dcb67f8d1786f0cecfaadd99c2a8df65bff851c31c903ebe70
MD5 691a2016a572bca207fc153b9747496b
BLAKE2b-256 3ff6e6ccb7905eb828fcfd51931849bc959e745a2977d3171967b2de9c6a78b5

See more details on using hashes here.

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

Hashes for switchport-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb2653c390885264f5a062f5628a9eead0899849a8f25770a12587127c0e0fe8
MD5 5d4365af168dc5e1e39d5f87b19a1851
BLAKE2b-256 aab52665e2c89934008020df3da72c231f063f28e66da9da63662a184efc0f50

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