Skip to content

feat: regenerate Python SDK (agent/tts namespaces) + bundled realtime connect layer#8

Open
lspeechify wants to merge 10 commits into
masterfrom
realtime-connect
Open

feat: regenerate Python SDK (agent/tts namespaces) + bundled realtime connect layer#8
lspeechify wants to merge 10 commits into
masterfrom
realtime-connect

Conversation

@lspeechify

Copy link
Copy Markdown
Collaborator

Regenerates the Python SDK from the updated API spec and adds a hand-written realtime connect layer.

What's in here

1. Regenerated client (product namespaces). Generated from the spec with per-product SDK namespaces, so the surface is:

  • client.tts.audio.*, client.tts.voices.*
  • client.agent.* (agent CRUD, flattened) + client.agent.{conversations,tools,knowledge_bases,tests,...}

(Previously everything was nested under client.tts.*.) HTTP wire is unchanged — this is the generated SDK method surface only.

2. speechify.realtime connect layer (hand-written, .fernignore'd). Opens a realtime voice-agent session from the { url, token } returned by client.agent.create_conversation(...) / create_session(...):

from speechify import Speechify, realtime

client = Speechify(token="...")
conv = client.agent.create_conversation(agent_id)
session = await realtime.connect_conversation(conv)   # connect, observe events, disconnect

Public surface is vendor-neutral (connect, connect_conversation, RealtimeSession, events participant_joined / audio / disconnected); the realtime transport client is an internal implementation detail. The module lives under src/speechify/realtime/ and is listed in .fernignore, so regeneration never clobbers it.

3. Dependency. Adds the realtime client as a dependency scoped with a Python marker — python = "^3.8" (base SDK) stays, the realtime client is only pulled on >=3.9 (it requires 3.9+). Configured via extra_dependencies in the upstream fern/generators.yml.

Notes

  • Generated on top of the spec's namespace change (api PR #1629). Draft pending that landing + review.
  • Verified locally: generation + poetry install solve, import smoke, and a live create→connect→disconnect against prod.

🤖 Generated with Claude Code

fern-api Bot and others added 3 commits June 16, 2026 19:30
Generated by Fern
CLI Version: unknown
Generators:
  - fernapi/fern-python-sdk: 4.3.19
Hand-written, .fernignore'd module that opens a realtime voice-agent
session from the {url, token} returned by client.agent.create_conversation
/ create_session. Vendor-neutral surface (connect, connect_conversation,
RealtimeSession); the realtime transport client is an internal import,
never named in the public API. Survives regeneration via .fernignore.
No native device audio in the SDK. Expose the session as raw PCM byte
streams the app plumbs itself, plus transcript events:

- output_audio() -> async iterator of AudioChunk (agent PCM16)
- send_audio(bytes, sample_rate=, num_channels=) -> push caller PCM16
- on_text(cb) -> TextEvent(role, text, final) transcript updates

Verified live (create-only): 913 audio chunks / ~876 KB received,
input track publishes + captures, 9 transcript events.
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

DRG-31

examples/realtime_wav.py streams a WAV to a voice agent and saves the
reply, using only the SDK's byte-stream surface (output_audio /
send_audio / on_text) — no audio-device dependency. examples/README.md
shows running it against a hosted Speechify audio sample
(speechify.ai/audio/...) converted to PCM16 via ffmpeg. examples/ added
to .fernignore so regeneration never clobbers it.
The generated pyproject carried a partial PEP-621 `[project]` table
(name only, no version/dependencies) alongside the real `[tool.poetry]`
config. PEP-621 build frontends (uv, pip git installs) validate
`[project]` and fail ("project.version neither set nor in dynamic"), so
`pip install git+...` / uv source installs were broken (PyPI wheels were
unaffected). Drop the vestigial `[project]`/`[project.urls]` tables and
move the URLs under `[tool.poetry.urls]` so poetry-core fully owns the
metadata. `uv build` now produces sdist + wheel.

NOTE: hand-patch of a generated file; the durable fix is upstream in the
Fern python generator's pyproject emission.
The runnable example lives in the cookbook
(speechify-api-cookbook: recipes/voice-agents/python/realtime-conversation),
verified end to end before removal. The generated SDK no longer carries
an examples/ folder; speechify.realtime usage is documented in the
module docstring.
@lspeechify lspeechify marked this pull request as ready for review June 17, 2026 09:13
lspeechify and others added 4 commits June 17, 2026 10:38
…ltime [DRG-31]

Matches the generator's pyproject_python_version=>=3.9 (api PR): SDK floor
becomes >=3.9 and livekit is a plain dependency (no marker). 3.8 is EOL and
the realtime layer needs 3.9+. Keeps the source-install fix (no [project] table).
Generated by Fern
CLI Version: unknown
Generators:
  - fernapi/fern-python-sdk: 4.3.19
Patches applied (1):
  - patch-3ae14425: fix(packaging): make the SDK installable from source [DRG-31]

Patches absorbed by generator (1):
  - patch-698be8b4: chore(packaging): require python >=3.9 (drop EOL 3.8) for livekit/realtime [DRG-31]
    The generator now produces these customizations natively.
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