Skip to content

release: 0.5.0 — instance-based API refactor#68

Merged
nicolotognoni merged 4 commits into
mainfrom
release/v0.5.0
Apr 22, 2026
Merged

release: 0.5.0 — instance-based API refactor#68
nicolotognoni merged 4 commits into
mainfrom
release/v0.5.0

Conversation

@nicolotognoni
Copy link
Copy Markdown
Collaborator

Summary

Patter 0.5.0 ships a clean, instance-based public API for both the Python and TypeScript SDKs. Every provider — carrier, engine, STT, TTS, tunnel — is a typed class that reads its credentials from environment variables by default, so a genuine 4-line quickstart composes out of the box:

from patter import Patter, Twilio, OpenAIRealtime
phone = Patter(carrier=Twilio(), phone_number="+15550001234")
agent = phone.agent(engine=OpenAIRealtime(), system_prompt="You are helpful.")
await phone.serve(agent, tunnel=True)

TypeScript mirror:

import { Patter, Twilio, OpenAIRealtime } from "getpatter";
const phone = new Patter({ carrier: new Twilio(), phoneNumber: "+15550001234" });
const agent = phone.agent({ engine: new OpenAIRealtime(), systemPrompt: "You are helpful." });
await phone.serve({ agent, tunnel: true });

What's new

  • Carrierspatter.carriers.{twilio,telnyx} + flat Twilio / Telnyx
  • Enginespatter.engines.{openai,elevenlabs} + flat OpenAIRealtime / ElevenLabsConvAI
  • STTDeepgramSTT, WhisperSTT, CartesiaSTT, SonioxSTT, SpeechmaticsSTT (Python-only), AssemblyAISTT
  • TTSElevenLabsTTS, OpenAITTS, CartesiaTTS, RimeTTS, LMNTTTS
  • TunnelsCloudflareTunnel(), Static(hostname=...), Ngrok() instances; serve(tunnel=True) kept as dev alias
  • PrimitivesTool class + @tool decorator, Guardrail class + guardrail(...) factory
  • Env-fallback everywhere — each adapter reads <VENDOR>_API_KEY when the constructor arg is omitted
  • TypeScript carrier auto-configserve() now sets the Twilio voice_url and associates Telnyx numbers automatically (parity with Python)
  • Docs — new Setting up Patter nav group with Carrier / Engines / STT / LLM / TTS subsections; fresh engines.mdx pages for both SDKs; every code block paste-runnable

What's removed

  • Legacy Patter(twilio_sid=, twilio_token=, openai_key=, deepgram_key=, ...) kwargs
  • Legacy string selectors (stt="deepgram", tts="elevenlabs", provider="openai_realtime")
  • Factory methods Patter.deepgram(), Patter.whisper(), Patter.elevenlabs(), Patter.openai_tts(), Patter.cartesia(), Patter.rime(), Patter.lmnt(), Patter.guardrail(), Patter.tool()
  • Dict-form tool/guardrail definitions (typed instances only)
  • ~294 lines of deprecation shim from sdk-py/patter/client.py
  • ~251 lines of deprecation shim + sdk-ts/src/provider-resolver.ts from the TypeScript client

Line-count delta

247 files changed, 4,810 insertions, 9,766 deletions → net −4,956 lines.

Test plan

  • cd sdk-py && python3 -m pytest — 1327 passed, 8 skipped, 0 failures
  • cd sdk-ts && npx tsc --noEmit — clean, exit 0
  • cd sdk-ts && npx vitest run — 1013 tests across 60 files, 0 failures
  • 4-line Python quickstart runs clean under -W error::DeprecationWarning
  • 4-line TypeScript quickstart composes end-to-end via tsx
  • Twilio webhook auto-configuration covered by carrier-config.test.ts (TS) and existing Python adapter tests
  • Full soak suite (1000-turn cost precision, 20 disconnect/reconnect cycles, 100 concurrent calls RSS growth) all within thresholds

Release process (after merge)

  1. Tag v0.5.0 on main → CI publishes to PyPI (OIDC) and npm automatically
  2. Create GitHub Release with this PR body

🤖 Generated with Claude Code

Ship a clean, instance-based public API for both SDKs. Every provider is a
typed class that reads credentials from environment variables by default, so
a genuine 4-line quickstart composes out of the box:

    from patter import Patter, Twilio, OpenAIRealtime

    phone = Patter(carrier=Twilio(), phone_number="+15550001234")
    agent = phone.agent(engine=OpenAIRealtime(), system_prompt="...")
    await phone.serve(agent, tunnel=True)

## What's new

- `patter.carriers.{twilio,telnyx}` with flat `Twilio` / `Telnyx` aliases;
  env fallback on `TWILIO_ACCOUNT_SID` / `TELNYX_API_KEY` / etc.
- `patter.engines.{openai,elevenlabs}` with flat `OpenAIRealtime` /
  `ElevenLabsConvAI`; env fallback on `OPENAI_API_KEY` /
  `ELEVENLABS_API_KEY` + `ELEVENLABS_AGENT_ID`.
- `patter.stt.{deepgram,whisper,cartesia,soniox,speechmatics,assemblyai}`
  and `patter.tts.{elevenlabs,openai,cartesia,rime,lmnt}`; each reads
  `<VENDOR>_API_KEY` when omitted; flat aliases (`DeepgramSTT`, etc.)
  re-exported from the package root.
- `patter.tunnels.{CloudflareTunnel,Static,Ngrok}` instances for tunnel
  configuration; `serve(tunnel=True)` kept as a dev alias.
- `Tool` + `@tool` decorator, `Guardrail` + `guardrail(...)` factory.
- Twilio/Telnyx webhook auto-configuration in the TypeScript SDK, now at
  parity with the Python SDK (no Twilio Console clicks required).
- Docs rewritten around the new API: `Setting up Patter` nav group with
  Carrier / Engines / STT / LLM / TTS subsections; new `engines.mdx` pages
  for both SDKs; all code blocks paste-runnable given the right env vars.

## What's removed

- Legacy kwargs on `Patter()` / `new Patter()`: `twilio_sid`, `twilio_token`,
  `telnyx_key`, `openai_key`, `deepgram_key`, `elevenlabs_key`, `cartesia_key`,
  `rime_key`, `lmnt_key`, `soniox_key`, `speechmatics_key`, `assemblyai_key`.
- Legacy string selectors: `stt="deepgram"`, `tts="elevenlabs"`,
  `provider="openai_realtime"`, etc.
- Factory methods `Patter.deepgram()` / `Patter.whisper()` /
  `Patter.elevenlabs()` / `Patter.openai_tts()` / `Patter.cartesia()` /
  `Patter.rime()` / `Patter.lmnt()` / `Patter.guardrail()` / `Patter.tool()`.
- Dict-form tool and guardrail definitions (typed instances only now).
- ~294 lines of deprecation shim from `sdk-py/patter/client.py`.
- ~251 lines of deprecation shim + `sdk-ts/src/provider-resolver.ts` from
  the TypeScript client.

## Validation

- Python: 1327 pytest passing, 8 skipped, 0 failures.
- TypeScript: 1013 vitest passing across 60 files; `tsc --noEmit` clean.
- Both 4-line quickstarts smoke-tested with `-W error::DeprecationWarning`
  (Python) and no runtime errors (TypeScript).

## Line-count delta vs main

247 files changed, 4,810 insertions, 9,766 deletions — net **-4,956 lines**.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 22, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
patter-06b046ce 🟢 Ready View Preview Apr 22, 2026, 4:14 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

For parity with the TypeScript SDK (``npm install getpatter`` +
``import { ... } from "getpatter"``), rename the Python module from
``patter`` to ``getpatter`` so users now do:

    pip install getpatter
    from getpatter import Patter, Twilio, OpenAIRealtime

Instead of the historical split (``pip install getpatter`` +
``from patter import ...``). Modern Python SDKs (requests, httpx,
fastapi, pydantic, openai, anthropic) align distribution name with
module name — so does Patter starting 0.5.0.

Changes:
- ``sdk-py/patter/`` → ``sdk-py/getpatter/`` (directory move)
- Every ``from patter.X`` / ``import patter.X`` → ``from getpatter.X`` /
  ``import getpatter.X`` across 190 files (.py, .mdx, .md, .toml).
- ``pyproject.toml``: ``include = ["getpatter*"]``, package-data keys,
  ``[project.scripts] getpatter = "getpatter.cli:main"``.
- Docs and examples updated.

Full pytest suite (1327 passed, 8 skipped) and 4-line quickstart smoke
test (under ``-W error::DeprecationWarning``) both green on the unified
name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
**Core Concepts** (`docs/concepts.mdx`) rewritten as a newcomer-friendly
on-ramp: what Patter actually does, the five pluggable building blocks
(Carrier, Engine vs pipeline, Tools, Guardrails, Tunnel), and an ASCII
diagram of the call-flow so a reader who has never seen an STT/LLM/TTS
stack understands where each piece plugs in.

**Nav restructure**:
- Flatten single-page groups (Carrier, Engines, LLM) that rendered as
  "Carrier → Carrier" visual duplicates in Mintlify.
- Keep STT and TTS grouped (multiple provider pages each).
- Every top-level page now has an ``icon:`` in frontmatter (phone,
  microphone, volume, brain, bolt, wrench, shield, etc.).
- Remove MCP Server from the Dev Tools group and delete
  ``docs/dev-tools/mcp.mdx``.
- Align page titles across Python/TS (``Guardrails``, ``Events``,
  ``Advanced Features``).

**Tunneling** (``docs/dev-tools/tunneling.mdx``):
- Document that ``cloudflared`` is not bundled — Python/npm forbid
  silent installs at runtime. Added a ``tunnel`` extra in pyproject
  so ``pip install "getpatter[tunnel]"`` is the one-liner recipe.
- Quickstart shows both forms (``getpatter[tunnel]`` and the raw
  ``cloudflared`` package for advanced users).

**Example rewrites**:
- ``docs/examples/basic-{inbound,outbound}.{py,ts}`` were using a
  phantom cloud-mode API (``Patter(api_key=...)`` +
  ``phone.connect()``). Rewritten to the v0.5.0 local-mode shape
  (``carrier=Twilio()``, ``engine=OpenAIRealtime()``, tunnel=True).

**Cleanup**:
- Delete orphan ``docs/python-sdk/providers.mdx`` and
  ``docs/typescript-sdk/providers.mdx`` — superseded by the per-category
  STT / TTS / Engines pages.
- Move ``docs/observability.md`` (orphan, stale span names) into
  ``docs/python-sdk/tracing.mdx`` with consistent ``getpatter.*``
  spans and add to the Observability nav group.
- Fix stale "Auto-spawn not yet implemented" note on
  ``python-sdk/reference.mdx`` ``Ngrok`` entry.
- Quickstart 4-line visual: split the long ``phone.agent(...)`` call
  so the primary example fits the width — custom greeting shown in a
  follow-up block instead of inline kwargs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	docs/python-sdk/agents.mdx
#	docs/python-sdk/providers.mdx
#	docs/python-sdk/reference.mdx
#	docs/typescript-sdk/providers.mdx
#	docs/typescript-sdk/reference.mdx
@nicolotognoni nicolotognoni merged commit 49d6c11 into main Apr 22, 2026
15 checks passed
@nicolotognoni nicolotognoni deleted the release/v0.5.0 branch May 8, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant