Skip to main content

Python SDK for the AMPA API

Project description

AMPA SDK

The AMPA SDK is a Python library that provides a convenient, high-level interface for interacting with the AMPA API. It is designed to simplify prompt management, versioning, and execution from any Python application, script, or notebook.

Overview

  • Easy integration: Manage prompts and their versions with simple Python calls
  • Handles authentication: Securely connect to the AMPA API with username/password or environment variables
  • Request/response abstraction: No need to manually format HTTP requests
  • Extensible: Add custom methods or extend for new API endpoints

Features

  • Create, update, delete, and run prompts from Python
  • List and manage prompt versions
  • Automatic handling of API authentication and errors
  • Works with both local and remote AMPA API deployments

Installation

To install the AMPA SDK, use pip:

pip install the37lab_ampa_sdk

Configuration

You can configure the SDK via parameters or environment variables:

Environment variables:

  • AMPA_API_URL
  • AMPA_API_USERNAME
  • AMPA_API_PASSWORD

Usage Example

from the37lab_ampa_sdk import PromptAPI

# Initialize the client (parameters or env vars)
client = PromptAPI(
    ampa_url="http://localhost:8000",
    username="your_username",
    password="your_password",
)

# Create an prompt
data = {
    "prompt_name": "My Prompt",
    "description": "A helpful assistant",
    "purpose": "You are a helpful assistant",
    "instruction": "Tell a story about Sweden"
}
prompt = client.create_prompt(data)

# Run the prompt
response = client.call_prompt(
    "My Prompt",
    variables={"name": "John"},
    prompt="Tell me a story"
)

# List prompt versions
versions = client.list_prompt_versions(prompt["id"])

Use Cases

  • Integrate prompt management into Python apps, scripts, or notebooks
  • Automate prompt creation and execution in pipelines
  • Rapid prototyping and experimentation with LLM prompts

Extensibility

  • Add new methods for custom API endpoints
  • Subclass PromptAPI to add custom logic or error handling

Troubleshooting

  • Ensure the AMPA API is running and accessible
  • Check credentials and API URL
  • Review exception messages for error details

License

This project is proprietary software. All rights reserved.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

the37lab_ampa_sdk-0.1.1750676499.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

the37lab_ampa_sdk-0.1.1750676499-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file the37lab_ampa_sdk-0.1.1750676499.tar.gz.

File metadata

File hashes

Hashes for the37lab_ampa_sdk-0.1.1750676499.tar.gz
Algorithm Hash digest
SHA256 3ba1247c3552237b29bb4b55373e13ad54a3d9c6a2a56dc79f796086b2f5b18e
MD5 9451355baa3baa896d8ff9bf952931df
BLAKE2b-256 4c32e44ad4d2c06aa75bafe15154a4e10d71ffd0a0e1ed7a6682ecac605d7206

See more details on using hashes here.

File details

Details for the file the37lab_ampa_sdk-0.1.1750676499-py3-none-any.whl.

File metadata

File hashes

Hashes for the37lab_ampa_sdk-0.1.1750676499-py3-none-any.whl
Algorithm Hash digest
SHA256 0211cab05611e99b5c5572d597a3d81828d56e5cd19cbf3f9c1bc5c8c5ca0c48
MD5 030dd71baa0b9e0e887ca6fe3be01f9c
BLAKE2b-256 7c174910bb87580e04c4390457a8ceb0e1af283a1f559ba5707f25e5c7a5a387

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