Skip to main content

Pied Piper Python SDK

Pied Piper is a lightweight Python SDK for the Pied Piper multimodal compression service.

Install

python -m pip install -e app/packaging

Configure

Set your API key:

export PIED_PIPER_API_KEY="your-shared-api-key"

The SDK defaults to the production Pied Piper service URL. PIED_PIPER_BASE_URL is only needed if you want to override that for local development or a non-production deployment.

Quickstart

import pied_piper

result = pied_piper.compress("Long inline text to compress")
print(result.status)
print(result.text)

Default fidelity behavior:

  • if you do not pass fidelity, the SDK uses 0.9
  • higher fidelity preserves more content
  • for text, fidelity maps to LLMLingua rate
  • fidelity=0.9 therefore means "keep roughly 90% of the original tokens", not "drop 90%"
  • for video, fidelity maps directly to the target kept-duration budget before padding and merge
  • the returned compression_rate is the observed output ratio compressed_tokens / origin_tokens, so it may differ from the requested fidelity

Mixed inputs

from pathlib import Path

from pied_piper import Client

client = Client()
result = client.compress(
    [
        "inline text",
        Path("paper.pdf"),
        Path("diagram.png"),
        Path("demo.mp4"),
    ],
    fidelity=0.55,
)

Current behavior:

  • text is extracted and compressed remotely
  • images are accepted as passthrough items
  • video inputs return an inline MP4 artifact on item.output_file
video_item = next(item for item in result.items if item.modality == "video")
video_bytes = video_item.output_file.as_bytes()

Release files for piedpiper-sdk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piedpiper-sdk 0.2.1
File Size Uploaded
piedpiper_sdk-0.2.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piedpiper-sdk 0.2.1
File Interpreter ABI Platform
piedpiper_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / piedpiper_sdk-0.2.1.tar.gz

Download URL piedpiper_sdk-0.2.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
feedc203b0c43f32c05c4741ced27a447d35e1db6305949663761f896271a3d8
BLAKE2b-256 checksum
How to use checksums
fbda77ddac2c9e4b8e962f1bf41827054ce3d6f7f0ac2730d3d256954cd07cb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / piedpiper_sdk-0.2.1-py3-none-any.whl

Download URL piedpiper_sdk-0.2.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30c1813bf835fd4ea1822be37250f1b0de556398bf83772e067da0f465de7b12
BLAKE2b-256 checksum
How to use checksums
a86dd5274822baed687bc62a7268b1b8d937fcb8b50db372032d51a33250f0f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page