Skip to main content

RedenLab Extract SDK

Python SDK for RedenLab's ML inference service. Run machine learning models on audio files using RedenLab's proprietary endpoints.

Features

  • JWT-based authentication — browser login for humans, env vars for machines
  • Simple session + client pattern: upload once, run any model
  • Async job management with polling and progress callbacks
  • Automatic chunking for long audio files
  • Built-in retry logic and error handling

Installation

pip install redenlab-extract

Authentication

The SDK uses JWT tokens issued by AWS Cognito. Two modes are auto-detected:

Human / Interactive (PKCE)

Run once from the terminal:

redenlab login

This opens a browser, authenticates you, and stores tokens in ~/.redenlab-ml/credentials.yaml. The SDK refreshes tokens silently — you only need to run redenlab login again if your session expires.

Machine / Headless (Client Credentials)

Set environment variables before running your script:

export REDENLAB_CLIENT_ID=your-client-id
export REDENLAB_CLIENT_SECRET=your-client-secret

The SDK detects these and fetches a token automatically. No browser, no disk tokens.

Priority: if both env vars are set, Client Credentials is used regardless of any stored PKCE tokens.

Quick Start

from redenlab_extract import RedenLabSession, intelligibility_client, run_inference

session = RedenLabSession()
client = intelligibility_client(session, model_name="als-intelligibility-v1")

result = run_inference(session, client, "audio.wav")
print(result["result"]["intelligibility_score"])
from redenlab_extract import RedenLabSession, TranscribeClient, run_inference

session = RedenLabSession()
client = TranscribeClient(session, language_code="en-US")

result = run_inference(session, client, "audio.wav")
print(result["transcript"])

Available Models

Intelligibility

from redenlab_extract import intelligibility_client

client = intelligibility_client(session, model_name="als-intelligibility-v1")
# model_name options: "als-intelligibility-v1", "als-intelligibility-v2",
#                     "ataxia-intelligibility"

Naturalness

from redenlab_extract import naturalness_client

client = naturalness_client(session, model_name="als-naturalness-v1")
# model_name options: "als-naturalness-v1", "als-naturalness-v2",
#                     "ataxia-naturalness"

Transcription (AWS Transcribe)

from redenlab_extract import TranscribeClient

client = TranscribeClient(
    session,
    language_code="en-US",   # optional, defaults to "en-US"
    max_speaker_count=4,      # optional, defaults to 10
)

WhisperX

from redenlab_extract import whisperX_client

client = whisperX_client(session, diarize=True, batch_size=16)

Speaker Counter

from redenlab_extract import speaker_counter_client

client = speaker_counter_client(session)

Speaker Diarization

from redenlab_extract import speaker_diarization_client

client = speaker_diarization_client(session)

Sylber Time

from redenlab_extract import sylber_time_client

client = sylber_time_client(session)

Usage Patterns

Handles upload, chunking, and inference in one call:

from redenlab_extract import RedenLabSession, intelligibility_client, run_inference

session = RedenLabSession()
client = intelligibility_client(session, model_name="als-intelligibility-v1")

result = run_inference(session, client, "audio.wav")

Long files are chunked automatically and results are aggregated.

Level 2 — Upload → Submit → Poll

Useful for batch processing or when you want to decouple upload from inference:

# Upload
asset = session.upload("audio.wav")

# Submit (with retry for async S3 processing)
job_id = client._submit_with_upload_wait(asset)

# Poll
result = client.poll(job_id, timeout=600)

Level 3 — Batch processing

Submit all jobs first, then poll concurrently:

# Upload and submit all files
assets = [session.upload(f) for f in audio_files]
job_ids = [client._submit_with_upload_wait(asset) for asset in assets]

# Poll each
results = [client.poll(job_id) for job_id in job_ids]

Progress callbacks

def on_progress(status):
    print(f"Status: {status['status']}")

result = run_inference(session, client, "audio.wav", progress_callback=on_progress)

Chunked inference (long files)

run_inference() chunks automatically. For manual control:

from redenlab_extract import run_chunked_inference, aggregate_results

chunks = run_chunked_inference(session, client, "long_audio.wav", chunk_duration=50)
result = aggregate_results(chunks, score_key="intelligibility_score")

Backend warmup

SageMaker-backed models (intelligibility, naturalness) may be cold after inactivity:

health = client.health()
if not health["ready"]:
    client.warmup()  # submits a dummy job to wake the endpoint

Configuration

Base URL

Resolved in priority order:

Source How
Constructor RedenLabSession(base_url="https://...")
Environment variable REDENLAB_ML_BASE_URL=https://...
Config file ~/.redenlab-ml/config.yaml → base_url: ...
Service discovery Automatic fallback

Config file (~/.redenlab-ml/config.yaml)

base_url: https://your-api-gateway-url.amazonaws.com/prod  # optional

Credentials file (~/.redenlab-ml/credentials.yaml)

Written automatically by redenlab login. Do not edit manually.

Supported File Types

  • WAV (.wav)
  • FLAC (.flac)
  • MP3 (.mp3)
  • OGG (.ogg)
  • M4A (.m4a)

Requirements

  • Python 3.10+
  • requests
  • tenacity
  • pyyaml

Optional (for audio chunking):

  • soundfile
  • numpy

Support

License

MIT License — see LICENSE for details.

Changelog

See CHANGELOG.md for version history.

Metadata

Release files for redenlab-extract 1.4.0

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

Source distribution (sdist)

Source distribution for redenlab-extract 1.4.0
File Size Uploaded Provenance Actions
redenlab_extract-1.4.0.tar.gz 90.4 kB Without provenance Details for redenlab_extract-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redenlab-extract 1.4.0
File Interpreter ABI Platform Actions
redenlab_extract-1.4.0-py3-none-any.whl Python 3 none any Details for redenlab_extract-1.4.0-py3-none-any.whl

Total release size: 133.0 kB

Release files / redenlab_extract-1.4.0.tar.gz

Download URL redenlab_extract-1.4.0.tar.gz
Size 90.4 kB
Tags Source
SHA-256 checksum
How to use checksums
28bcc1f3d9f61c540f39c99d0f0709d6523c20b5a724e8ebf11420a6c7be0393
BLAKE2b-256 checksum
How to use checksums
33669dbab170a184c8c1e7a49cd124b14a6bff5c0913a322f31399d237cce46c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / redenlab_extract-1.4.0-py3-none-any.whl

Download URL redenlab_extract-1.4.0-py3-none-any.whl
Size 42.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
141ab18bf598dca0c6fad25a03202ae7d0f84de62c0141a00bf02be5f3d92a9b
BLAKE2b-256 checksum
How to use checksums
9022304006ea3c0f10d03224eb4c2a42bec5ce1b4489943269b9f5491c705fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for redenlab-extract 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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