diff --git a/ultravox-client/pyproject.toml b/ultravox-client/pyproject.toml index 8c52950..cff4fa7 100644 --- a/ultravox-client/pyproject.toml +++ b/ultravox-client/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ultravox-client" -version = "0.0.5" +version = "0.0.6" packages = [ { include = "ultravox_client", from = "." }, ] diff --git a/ultravox-client/ultravox_client/session.py b/ultravox-client/ultravox_client/session.py index d70a88b..b48e70e 100644 --- a/ultravox-client/ultravox_client/session.py +++ b/ultravox-client/ultravox_client/session.py @@ -124,6 +124,7 @@ def is_live(self): Role = Literal["user", "agent"] +Medium = Literal["text", "voice"] ClientToolImplementation = Callable[ @@ -142,7 +143,7 @@ class Transcript: """Whether the text is complete or the utterance is ongoing.""" speaker: Role """Who emitted the utterance.""" - medium: Literal["text", "voice"] + medium: Medium """The medium through which the utterance was emitted.""" @@ -214,6 +215,11 @@ def toggle_speaker_muted(self) -> None: """Toggles the mute state of the user's speaker (i.e. output audio from the agent).""" self.speaker_muted = not self.speaker_muted + async def set_output_medium(self, medium: Medium) -> None: + """Sets the agent's output medium. If the agent is currently speaking, this will + take effect at the end of the agent's utterance. Also see speaker_muted above.""" + await self._send_data({"type": "set_output_medium", "medium": medium}) + def register_tool_implementation( self, name: str, tool_impl: ClientToolImplementation ) -> None: @@ -266,7 +272,7 @@ async def leave_call(self): await self._disconnect() async def send_text(self, text: str): - """Sends a message via text. The agent will also respond via text.""" + """Sends a message via text.""" if not self._status.is_live(): raise RuntimeError( f"Cannot send text while not connected. Current status is {self.status}"