From c8dd7c2b57404247a146ae23c9a2341834579c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 30 Mar 2026 14:41:10 -0700 Subject: [PATCH] rtvi: remove old deprecations --- .../processors/frameworks/rtvi/__init__.py | 44 --- .../processors/frameworks/rtvi/frames.py | 17 - .../processors/frameworks/rtvi/models.py | 28 -- .../frameworks/rtvi/models_deprecated.py | 330 ------------------ .../processors/frameworks/rtvi/processor.py | 242 +------------ 5 files changed, 6 insertions(+), 655 deletions(-) delete mode 100644 src/pipecat/processors/frameworks/rtvi/models_deprecated.py diff --git a/src/pipecat/processors/frameworks/rtvi/__init__.py b/src/pipecat/processors/frameworks/rtvi/__init__.py index eed90ed09..6c5225906 100644 --- a/src/pipecat/processors/frameworks/rtvi/__init__.py +++ b/src/pipecat/processors/frameworks/rtvi/__init__.py @@ -7,33 +7,10 @@ """RTVI (Real-Time Voice Interface) protocol implementation for Pipecat.""" from pipecat.processors.frameworks.rtvi.frames import ( - RTVIActionFrame, RTVIClientMessageFrame, RTVIServerMessageFrame, RTVIServerResponseFrame, ) -from pipecat.processors.frameworks.rtvi.models_deprecated import ( - ActionResult, - RTVIAction, - RTVIActionArgument, - RTVIActionArgumentData, - RTVIActionResponse, - RTVIActionResponseData, - RTVIActionRun, - RTVIActionRunArgument, - RTVIBotReadyDataDeprecated, - RTVIConfig, - RTVIConfigResponse, - RTVIDescribeActions, - RTVIDescribeActionsData, - RTVIDescribeConfig, - RTVIDescribeConfigData, - RTVIService, - RTVIServiceConfig, - RTVIServiceOption, - RTVIServiceOptionConfig, - RTVIUpdateConfig, -) from pipecat.processors.frameworks.rtvi.observer import ( RTVIFunctionCallReportLevel, RTVIObserver, @@ -42,32 +19,11 @@ from pipecat.processors.frameworks.rtvi.observer import ( from pipecat.processors.frameworks.rtvi.processor import RTVIProcessor __all__ = [ - "ActionResult", - "RTVIAction", - "RTVIActionArgument", - "RTVIActionArgumentData", - "RTVIActionFrame", - "RTVIActionResponse", - "RTVIActionResponseData", - "RTVIActionRun", - "RTVIActionRunArgument", - "RTVIBotReadyDataDeprecated", "RTVIClientMessageFrame", - "RTVIConfig", - "RTVIConfigResponse", - "RTVIDescribeActions", - "RTVIDescribeActionsData", - "RTVIDescribeConfig", - "RTVIDescribeConfigData", "RTVIFunctionCallReportLevel", "RTVIObserver", "RTVIObserverParams", "RTVIProcessor", "RTVIServerMessageFrame", "RTVIServerResponseFrame", - "RTVIService", - "RTVIServiceConfig", - "RTVIServiceOption", - "RTVIServiceOptionConfig", - "RTVIUpdateConfig", ] diff --git a/src/pipecat/processors/frameworks/rtvi/frames.py b/src/pipecat/processors/frameworks/rtvi/frames.py index 6a771f7e4..f4d38ed7e 100644 --- a/src/pipecat/processors/frameworks/rtvi/frames.py +++ b/src/pipecat/processors/frameworks/rtvi/frames.py @@ -12,23 +12,6 @@ from typing import Any, Optional from pipecat.frames.frames import DataFrame, SystemFrame -@dataclass -class RTVIActionFrame(DataFrame): - """Frame containing an RTVI action to execute. - - Parameters: - rtvi_action_run: The action to execute. - message_id: Optional message ID for response correlation. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - rtvi_action_run: Any - message_id: Optional[str] = None - - @dataclass class RTVIServerMessageFrame(SystemFrame): """A frame for sending server messages to the client. diff --git a/src/pipecat/processors/frameworks/rtvi/models.py b/src/pipecat/processors/frameworks/rtvi/models.py index 7a9d4e633..9e54dd227 100644 --- a/src/pipecat/processors/frameworks/rtvi/models.py +++ b/src/pipecat/processors/frameworks/rtvi/models.py @@ -229,34 +229,6 @@ class SendTextData(BaseModel): options: Optional[SendTextOptions] = None -class AppendToContextData(BaseModel): - """Data format for appending messages to the context. - - Contains the role, content, and whether to run the message immediately. - - .. deprecated:: 0.0.85 - The RTVI message, append-to-context, has been deprecated. Use send-text - or custom client and server messages instead. - """ - - role: Literal["user", "assistant"] | str - content: Any - run_immediately: bool = False - - -class AppendToContext(BaseModel): - """RTVI message format to append content to the LLM context. - - .. deprecated:: 0.0.85 - The RTVI message, append-to-context, has been deprecated. Use send-text - or custom client and server messages instead. - """ - - label: MessageLiteral = MESSAGE_LABEL - type: Literal["append-to-context"] = "append-to-context" - data: AppendToContextData - - class LLMFunctionCallStartMessageData(BaseModel): """Data for LLM function call start notification. diff --git a/src/pipecat/processors/frameworks/rtvi/models_deprecated.py b/src/pipecat/processors/frameworks/rtvi/models_deprecated.py deleted file mode 100644 index 07c998f6f..000000000 --- a/src/pipecat/processors/frameworks/rtvi/models_deprecated.py +++ /dev/null @@ -1,330 +0,0 @@ -# -# Copyright (c) 2024-2026, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -"""RTVI pre-1.0 protocol models (deprecated). - -All classes here are kept for backward compatibility only. Pipeline configuration -and the actions API were removed in RTVI protocol 1.0.0. Use custom client and -server messages instead. -""" - -from typing import ( - Any, - Awaitable, - Callable, - Dict, - List, - Literal, - Optional, - Union, -) - -from pydantic import BaseModel, Field, PrivateAttr - -import pipecat.processors.frameworks.rtvi.models as RTVI - -ActionResult = Union[bool, int, float, str, list, dict] - - -class RTVIServiceOption(BaseModel): - """Configuration option for an RTVI service. - - Defines a configurable option that can be set for an RTVI service, - including its name, type, and handler function. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - type: Literal["bool", "number", "string", "array", "object"] - handler: Callable[..., Awaitable[None]] = Field(exclude=True) - - -class RTVIService(BaseModel): - """An RTVI service definition. - - Represents a service that can be configured and used within the RTVI protocol, - containing a name and list of configurable options. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - options: List[RTVIServiceOption] - _options_dict: Dict[str, RTVIServiceOption] = PrivateAttr(default={}) - - def model_post_init(self, __context: Any) -> None: - """Initialize the options dictionary after model creation.""" - self._options_dict = {} - for option in self.options: - self._options_dict[option.name] = option - return super().model_post_init(__context) - - -class RTVIActionArgumentData(BaseModel): - """Data for an RTVI action argument. - - Contains the name and value of an argument passed to an RTVI action. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - value: Any - - -class RTVIActionArgument(BaseModel): - """Definition of an RTVI action argument. - - Specifies the name and expected type of an argument for an RTVI action. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - type: Literal["bool", "number", "string", "array", "object"] - - -class RTVIAction(BaseModel): - """An RTVI action definition. - - Represents an action that can be executed within the RTVI protocol, - including its service, name, arguments, and handler function. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - service: str - action: str - arguments: List[RTVIActionArgument] = Field(default_factory=list) - result: Literal["bool", "number", "string", "array", "object"] - handler: Callable[..., Awaitable[ActionResult]] = Field(exclude=True) - _arguments_dict: Dict[str, RTVIActionArgument] = PrivateAttr(default={}) - - def model_post_init(self, __context: Any) -> None: - """Initialize the arguments dictionary after model creation.""" - self._arguments_dict = {} - for arg in self.arguments: - self._arguments_dict[arg.name] = arg - return super().model_post_init(__context) - - -class RTVIServiceOptionConfig(BaseModel): - """Configuration value for an RTVI service option. - - Contains the name and value to set for a specific service option. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - value: Any - - -class RTVIServiceConfig(BaseModel): - """Configuration for an RTVI service. - - Contains the service name and list of option configurations to apply. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - service: str - options: List[RTVIServiceOptionConfig] - - -class RTVIConfig(BaseModel): - """Complete RTVI configuration. - - Contains the full configuration for all RTVI services. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - config: List[RTVIServiceConfig] - - -# -# Client -> Pipecat messages. -# - - -class RTVIUpdateConfig(BaseModel): - """Request to update RTVI configuration. - - Contains new configuration settings and whether to interrupt the bot. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - config: List[RTVIServiceConfig] - interrupt: bool = False - - -class RTVIActionRunArgument(BaseModel): - """Argument for running an RTVI action. - - Contains the name and value of an argument to pass to an action. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - name: str - value: Any - - -class RTVIActionRun(BaseModel): - """Request to run an RTVI action. - - Contains the service, action name, and optional arguments. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - service: str - action: str - arguments: Optional[List[RTVIActionRunArgument]] = None - - -# -# Pipecat -> Client responses and messages. -# - - -class RTVIBotReadyDataDeprecated(RTVI.BotReadyData): - """Data for bot ready notification. - - Contains protocol version and initial configuration. - """ - - # The config field is deprecated and will not be included if - # the client's rtvi version is 1.0.0 or higher. - config: Optional[List[RTVIServiceConfig]] = None - - -class RTVIDescribeConfigData(BaseModel): - """Data for describing available RTVI configuration. - - Contains the list of available services and their options. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - config: List[RTVIService] - - -class RTVIDescribeConfig(BaseModel): - """Message describing available RTVI configuration. - - Sent in response to a describe-config request. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - label: RTVI.MessageLiteral = RTVI.MESSAGE_LABEL - type: Literal["config-available"] = "config-available" - id: str - data: RTVIDescribeConfigData - - -class RTVIDescribeActionsData(BaseModel): - """Data for describing available RTVI actions. - - Contains the list of available actions that can be executed. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - actions: List[RTVIAction] - - -class RTVIDescribeActions(BaseModel): - """Message describing available RTVI actions. - - Sent in response to a describe-actions request. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - label: RTVI.MessageLiteral = RTVI.MESSAGE_LABEL - type: Literal["actions-available"] = "actions-available" - id: str - data: RTVIDescribeActionsData - - -class RTVIConfigResponse(BaseModel): - """Response containing current RTVI configuration. - - Sent in response to a get-config request. - - .. deprecated:: 0.0.75 - Pipeline Configuration has been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - label: RTVI.MessageLiteral = RTVI.MESSAGE_LABEL - type: Literal["config"] = "config" - id: str - data: RTVIConfig - - -class RTVIActionResponseData(BaseModel): - """Data for an RTVI action response. - - Contains the result of executing an action. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - result: ActionResult - - -class RTVIActionResponse(BaseModel): - """Response to an RTVI action execution. - - Sent after successfully executing an action. - - .. deprecated:: 0.0.75 - Actions have been removed as part of the RTVI protocol 1.0.0. - Use custom client and server messages instead. - """ - - label: RTVI.MessageLiteral = RTVI.MESSAGE_LABEL - type: Literal["action-response"] = "action-response" - id: str - data: RTVIActionResponseData diff --git a/src/pipecat/processors/frameworks/rtvi/processor.py b/src/pipecat/processors/frameworks/rtvi/processor.py index b750bd70b..69a863594 100644 --- a/src/pipecat/processors/frameworks/rtvi/processor.py +++ b/src/pipecat/processors/frameworks/rtvi/processor.py @@ -8,7 +8,7 @@ import asyncio import base64 -from typing import Any, Dict, Mapping, Optional +from typing import Any, Mapping, Optional from loguru import logger from pydantic import BaseModel, ValidationError @@ -31,24 +31,7 @@ from pipecat.frames.frames import ( SystemFrame, ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.processors.frameworks.rtvi.frames import RTVIActionFrame, RTVIClientMessageFrame -from pipecat.processors.frameworks.rtvi.models_deprecated import ( - RTVIAction, - RTVIActionResponse, - RTVIActionResponseData, - RTVIActionRun, - RTVIBotReadyDataDeprecated, - RTVIConfig, - RTVIConfigResponse, - RTVIDescribeActions, - RTVIDescribeActionsData, - RTVIDescribeConfig, - RTVIDescribeConfigData, - RTVIService, - RTVIServiceConfig, - RTVIServiceOptionConfig, - RTVIUpdateConfig, -) +from pipecat.processors.frameworks.rtvi.frames import RTVIClientMessageFrame from pipecat.processors.frameworks.rtvi.observer import RTVIObserver, RTVIObserverParams from pipecat.services.llm_service import ( FunctionCallParams, # TODO(aleix): we shouldn't import `services` from `processors` @@ -68,7 +51,6 @@ class RTVIProcessor(FrameProcessor): def __init__( self, *, - config: Optional[RTVIConfig] = None, transport: Optional[BaseTransport] = None, **kwargs, ): @@ -80,7 +62,6 @@ class RTVIProcessor(FrameProcessor): **kwargs: Additional arguments passed to parent class. """ super().__init__(**kwargs) - self._config = config or RTVIConfig(config=[]) self._bot_ready = False self._client_ready = False @@ -90,12 +71,6 @@ class RTVIProcessor(FrameProcessor): self._client_version = [0, 3, 0] self._llm_skip_tts: bool = False # Keep in sync with llm_service.py's configuration. - self._registered_actions: Dict[str, RTVIAction] = {} - self._registered_services: Dict[str, RTVIService] = {} - - # A task to process incoming action frames. - self._action_task: Optional[asyncio.Task] = None - # A task to process incoming transport messages. self._message_task: Optional[asyncio.Task] = None @@ -111,41 +86,6 @@ class RTVIProcessor(FrameProcessor): self._input_transport = input_transport self._input_transport.enable_audio_in_stream_on_start(False) - def register_action(self, action: RTVIAction): - """Register an action that can be executed via RTVI. - - Args: - action: The action to register. - """ - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "The actions API is deprecated, use server and client messages instead.", - DeprecationWarning, - ) - - id = self._action_id(action.service, action.action) - self._registered_actions[id] = action - - def register_service(self, service: RTVIService): - """Register a service that can be configured via RTVI. - - Args: - service: The service to register. - """ - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "The actions API is deprecated, use server and client messages instead.", - DeprecationWarning, - ) - - self._registered_services[service.name] = service - def create_rtvi_observer(self, *, params: Optional[RTVIObserverParams] = None, **kwargs): """Creates a new RTVI Observer. @@ -171,11 +111,6 @@ class RTVIProcessor(FrameProcessor): If left as None, the Pipecat library and version will be used. """ self._bot_ready = True - # Only call the (deprecated) _update_config method if the we're using a - # config (which is deprecated). Otherwise we'd always print an - # unnecessary deprecation warning. - if self._config.config: - await self._update_config(self._config, False) await self._send_bot_ready(about=about) async def interrupt_bot(self): @@ -281,8 +216,6 @@ class RTVIProcessor(FrameProcessor): await self.push_frame(frame, direction) await self._stop(frame) # Data frames - elif isinstance(frame, RTVIActionFrame): - await self._action_queue.put(frame) elif isinstance(frame, LLMConfigureOutputFrame): self._llm_skip_tts = frame.skip_tts await self.push_frame(frame, direction) @@ -292,9 +225,6 @@ class RTVIProcessor(FrameProcessor): async def _start(self, frame: StartFrame): """Start the RTVI processor tasks.""" - if not self._action_task: - self._action_queue = asyncio.Queue() - self._action_task = self.create_task(self._action_task_handler()) if not self._message_task: self._message_queue = asyncio.Queue() self._message_task = self.create_task(self._message_task_handler()) @@ -310,21 +240,10 @@ class RTVIProcessor(FrameProcessor): async def _cancel_tasks(self): """Cancel all running tasks.""" - if self._action_task: - await self.cancel_task(self._action_task) - self._action_task = None - if self._message_task: await self.cancel_task(self._message_task) self._message_task = None - async def _action_task_handler(self): - """Handle incoming action frames.""" - while True: - frame = await self._action_queue.get() - await self._handle_action(frame.message_id, frame.rtvi_action_run) - self._action_queue.task_done() - async def _message_task_handler(self): """Handle incoming transport messages.""" while True: @@ -359,36 +278,17 @@ class RTVIProcessor(FrameProcessor): data = None pass await self._handle_client_ready(message.id, data) - case "describe-actions": - await self._handle_describe_actions(message.id) - case "describe-config": - await self._handle_describe_config(message.id) - case "get-config": - await self._handle_get_config(message.id) - case "update-config": - update_config = RTVIUpdateConfig.model_validate(message.data) - await self._handle_update_config(message.id, update_config) case "disconnect-bot": await self.push_frame(EndTaskFrame(), FrameDirection.UPSTREAM) case "client-message": data = RTVI.RawClientMessageData.model_validate(message.data) await self._handle_client_message(message.id, data) - case "action": - action = RTVIActionRun.model_validate(message.data) - action_frame = RTVIActionFrame(message_id=message.id, rtvi_action_run=action) - await self._action_queue.put(action_frame) case "llm-function-call-result": data = RTVI.LLMFunctionCallResultData.model_validate(message.data) await self._handle_function_call_result(data) case "send-text": data = RTVI.SendTextData.model_validate(message.data) await self._handle_send_text(data) - case "append-to-context": - logger.warning( - f"The append-to-context message is deprecated, use send-text instead." - ) - data = RTVI.AppendToContextData.model_validate(message.data) - await self._handle_update_context(data) case "raw-audio" | "raw-audio-batch": await self._handle_audio_buffer(message.data) @@ -441,100 +341,6 @@ class RTVIProcessor(FrameProcessor): # Handle missing keys, decoding errors, and invalid types logger.error(f"Error processing audio buffer: {e}") - async def _handle_describe_config(self, request_id: str): - """Handle a describe-config request.""" - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "Configuration helpers are deprecated. If your application needs this behavior, use custom server and client messages.", - DeprecationWarning, - ) - - services = list(self._registered_services.values()) - message = RTVIDescribeConfig(id=request_id, data=RTVIDescribeConfigData(config=services)) - await self.push_transport_message(message) - - async def _handle_describe_actions(self, request_id: str): - """Handle a describe-actions request.""" - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "The Actions API is deprecated, use custom server and client messages instead.", - DeprecationWarning, - ) - - actions = list(self._registered_actions.values()) - message = RTVIDescribeActions(id=request_id, data=RTVIDescribeActionsData(actions=actions)) - await self.push_transport_message(message) - - async def _handle_get_config(self, request_id: str): - """Handle a get-config request.""" - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "Configuration helpers are deprecated. If your application needs this behavior, use custom server and client messages.", - DeprecationWarning, - ) - - message = RTVIConfigResponse(id=request_id, data=self._config) - await self.push_transport_message(message) - - def _update_config_option(self, service: str, config: RTVIServiceOptionConfig): - """Update a specific configuration option.""" - for service_config in self._config.config: - if service_config.service == service: - for option_config in service_config.options: - if option_config.name == config.name: - option_config.value = config.value - return - # If we couldn't find a value for this config, we simply need to - # add it. - service_config.options.append(config) - - async def _update_service_config(self, config: RTVIServiceConfig): - """Update configuration for a specific service.""" - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "Configuration helpers are deprecated. If your application needs this behavior, use custom server and client messages.", - DeprecationWarning, - ) - - service = self._registered_services[config.service] - for option in config.options: - handler = service._options_dict[option.name].handler - await handler(self, service.name, option) - self._update_config_option(service.name, option) - - async def _update_config(self, data: RTVIConfig, interrupt: bool): - """Update the RTVI configuration.""" - import warnings - - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn( - "Configuration helpers are deprecated. If your application needs this behavior, use custom server and client messages.", - DeprecationWarning, - ) - - if interrupt: - await self.interrupt_bot() - for service_config in data.config: - await self._update_service_config(service_config) - - async def _handle_update_config(self, request_id: str, data: RTVIUpdateConfig): - """Handle an update-config request.""" - await self._update_config(RTVIConfig(config=data.config), data.interrupt) - await self._handle_get_config(request_id) - async def _handle_send_text(self, data: RTVI.SendTextData): """Handle a send-text message from the client.""" opts = data.options if data.options is not None else RTVI.SendTextOptions() @@ -555,15 +361,6 @@ class RTVIProcessor(FrameProcessor): output_frame = LLMConfigureOutputFrame(skip_tts=cur_llm_skip_tts) await self.push_frame(output_frame) - async def _handle_update_context(self, data: RTVI.AppendToContextData): - if data.run_immediately: - await self.interrupt_bot() - frame = LLMMessagesAppendFrame( - messages=[{"role": data.role, "content": data.content}], - run_llm=data.run_immediately, - ) - await self.push_frame(frame) - async def _handle_client_message(self, msg_id: str, data: RTVI.RawClientMessageData): """Handle a client message frame.""" # Create a RTVIClientMessageFrame to push the message @@ -588,24 +385,6 @@ class RTVIProcessor(FrameProcessor): ) await self.push_frame(frame) - async def _handle_action(self, request_id: Optional[str], data: RTVIActionRun): - """Handle an action execution request.""" - action_id = self._action_id(data.service, data.action) - if action_id not in self._registered_actions: - await self._send_error_response(request_id, f"Action {action_id} not registered") - return - action = self._registered_actions[action_id] - arguments = {} - if data.arguments: - for arg in data.arguments: - arguments[arg.name] = arg.value - result = await action.handler(self, action.service, arguments) - # Only send a response if request_id is present. Things that don't care about - # action responses (such as webhooks) don't set a request_id - if request_id: - message = RTVIActionResponse(id=request_id, data=RTVIActionResponseData(result=result)) - await self.push_transport_message(message) - async def _send_bot_ready(self, about: Mapping[str, Any] = None): """Send the bot-ready message to the client. @@ -615,19 +394,10 @@ class RTVIProcessor(FrameProcessor): """ if not about: about = {"library": "pipecat-ai", "library_version": f"{pipecat_version()}"} - if self._client_version and self._client_version[0] < 1: - config = self._config.config - message = RTVI.BotReady( - id=self._client_ready_id, - data=RTVIBotReadyDataDeprecated( - version=RTVI.PROTOCOL_VERSION, about=about, config=config - ), - ) - else: - message = RTVI.BotReady( - id=self._client_ready_id, - data=RTVI.BotReadyData(version=RTVI.PROTOCOL_VERSION, about=about), - ) + message = RTVI.BotReady( + id=self._client_ready_id, + data=RTVI.BotReadyData(version=RTVI.PROTOCOL_VERSION, about=about), + ) await self.push_transport_message(message) async def _send_server_message(self, message: RTVI.ServerMessage | RTVI.ServerResponse):