feat(plugins-tavus): rename replica/persona to face/pal#6239
feat(plugins-tavus): rename replica/persona to face/pal#6239carolin-tavus wants to merge 5 commits into
Conversation
Tavus is renaming its public API surface from replica_id/persona_id to face_id/pal_id. Rename the plugin's public params (face_id/pal_id) and env vars (TAVUS_FACE_ID/TAVUS_PAL_ID); the old replica_id/persona_id args and TAVUS_REPLICA_ID/TAVUS_PERSONA_ID env vars still work as deprecated aliases. The Tavus wire payload keys are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Mocked pytest unit tests (no live API): face_id/pal_id map onto the unchanged wire keys, deprecated replica_id/persona_id args and TAVUS_REPLICA_ID/ TAVUS_PERSONA_ID env vars still work and warn, env-var fallback, the TAVUS_FACE_ID-required error, and AvatarSession alias resolution. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Tavus API now accepts face_id/pal_id on /v2/conversations and exposes /v2/pals (pal_name + default_face_id). Send the new keys, add create_pal() hitting /v2/pals, and auto-create a pal (not a persona) when none is given. create_persona() stays as a deprecated alias on the legacy /v2/personas. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A pal carries its own default_face_id, so a conversation can be created from pal_id alone. Require face_id only when no pal_id is given (to create one); otherwise send pal_id and let the pal's default face apply. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Instead of erroring when neither a face nor a pal is given, fall back to a default stock face to create the pal, so the zero-config path works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| @@ -0,0 +1,127 @@ | |||
| import warnings | |||
There was a problem hiding this comment.
π‘ New test file missing required category marker, which will block CI collection
The new test module lacks the mandatory pytestmark declaration (test_tavus.py:1), so pytest's category enforcement will reject it.
Impact: The tests cannot be selected or run under the standard --unit flag, and CI will fail if this file is ever added to the main test paths.
AGENTS.md rule and enforcement details
The repository's AGENTS.md states:
Adding a test: give the new module a category marker (
pytestmark = pytest.mark.unit, etc.) β collection fails with a hint if it lacks one.
Every other test module in the repo (including the comparable livekit-plugins/livekit-plugins-sarvam/tests/test_speech_timing.py:13) declares a module-level pytestmark. This file contains pure unit tests (everything is mocked, no network or credentials needed), so the correct marker is pytest.mark.unit.
| import warnings | |
| import warnings | |
| import pytest | |
| pytestmark = pytest.mark.unit | |
Was this helpful? React with π or π to provide feedback.
| if not pal_id: | ||
| # no pal to reuse, so create one β falling back to the default face | ||
| pal_id = await self.create_pal(default_face_id=face_id or DEFAULT_FACE_ID) |
There was a problem hiding this comment.
π© Behavioral change: missing face/pal no longer raises an exception
Previously, if no replica_id was provided (via argument or env var), create_conversation raised TavusException("TAVUS_REPLICA_ID must be set"). Now, if neither face_id nor pal_id is provided, the code silently auto-creates a pal using DEFAULT_FACE_ID = "r72f7f7f7c8b" (livekit-plugins/livekit-plugins-tavus/livekit/plugins/tavus/api.py:27). This is a deliberate UX improvement (zero-config start), but existing users who relied on the error to catch missing configuration will no longer get that safety net. The default face ID is hardcoded; if it becomes invalid on the Tavus side, the API call will fail with a less clear error from the Tavus API rather than a local validation error.
Was this helpful? React with π or π to provide feedback.
Summary
Align the Tavus plugin with Tavus's renamed API (
replicaβface,personaβpal). Public params, env vars, and the wire payload move to the new naming; the old names stay working as deprecated aliases (non-breaking for plugin users).face_id/pal_idparams (andTAVUS_FACE_ID/TAVUS_PAL_IDenv vars) toAvatarSessionandTavusAPI.create_conversation.face_id/pal_idon the conversation-create payload; addcreate_pal()hittingPOST /v2/pals(pal_name+default_face_id), and auto-create a pal (not a persona) when none is supplied.replica_id/persona_idparams,TAVUS_REPLICA_ID/TAVUS_PERSONA_IDenv vars, andcreate_persona()(legacy/v2/personas) working as deprecated aliases with aDeprecationWarning.avatar_agents/tavusexample to the new names.Test plan
ruff check(E,W,F,I,B,C4,UP) andruff format --checkpass._postmocked): new keys map onto theface_id/pal_idwire payload, deprecated args/env still work and warn, auto-create routes to/v2/palswithdefault_face_id, theTAVUS_FACE_ID-required error, andAvatarSessionalias resolution./v2/palsβ conversation withface_id/pal_id) on both the new-arg and deprecated-arg paths.Notes
The face/pal wire support is live on Tavus prod (
tavusapi.com); both old and new keys are accepted, so this is non-breaking for existing integrations.