From 9b216116f1707c638b0627933903c4ffc31821b8 Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Tue, 2 Sep 2025 16:00:48 -0400 Subject: [PATCH] Remove `supports_universal_context` gate from OpenAI-library-based LLM services. It's no longer needed, as they all now support universal `LLMContext`. --- src/pipecat/services/google/llm_openai.py | 9 --------- src/pipecat/services/openai/base_llm.py | 19 +------------------ src/pipecat/services/openai/llm.py | 9 --------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/pipecat/services/google/llm_openai.py b/src/pipecat/services/google/llm_openai.py index 83d90e4ac..81d124cb7 100644 --- a/src/pipecat/services/google/llm_openai.py +++ b/src/pipecat/services/google/llm_openai.py @@ -76,15 +76,6 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService): super().__init__(api_key=api_key, base_url=base_url, model=model, **kwargs) - @property - def supports_universal_context(self) -> bool: - """Check if this service supports universal LLMContext. - - Returns: - False, as GoogleLLMOpenAIBetaService does not yet support universal LLMContext. - """ - return False - async def _process_context(self, context: OpenAILLMContext): functions_list = [] arguments_list = [] diff --git a/src/pipecat/services/openai/base_llm.py b/src/pipecat/services/openai/base_llm.py index 42eeb8981..682c0f227 100644 --- a/src/pipecat/services/openai/base_llm.py +++ b/src/pipecat/services/openai/base_llm.py @@ -419,18 +419,6 @@ class BaseOpenAILLMService(LLMService): await self.run_function_calls(function_calls) - @property - def supports_universal_context(self) -> bool: - """Check if this service supports universal LLMContext. - - Returns: - Whether service supports universal LLMContext. - """ - # Return True in subclasses that support universal LLMContext - # This property lets us gradually roll out support for universal - # LLMContext to OpenAI-like services in a controlled manner. - return False - async def process_frame(self, frame: Frame, direction: FrameDirection): """Process frames for LLM completion requests. @@ -450,12 +438,7 @@ class BaseOpenAILLMService(LLMService): context = frame.context elif isinstance(frame, LLMContextFrame): # Handle universal (LLM-agnostic) LLM context frames - if self.supports_universal_context: - context = frame.context - else: - raise NotImplementedError( - f"Universal LLMContext is not yet supported for {self.__class__.__name__}." - ) + context = frame.context elif isinstance(frame, LLMMessagesFrame): # NOTE: LLMMessagesFrame is deprecated, so we don't support the newer universal # LLMContext with it diff --git a/src/pipecat/services/openai/llm.py b/src/pipecat/services/openai/llm.py index 9f5d896b6..7919dd159 100644 --- a/src/pipecat/services/openai/llm.py +++ b/src/pipecat/services/openai/llm.py @@ -107,15 +107,6 @@ class OpenAILLMService(BaseOpenAILLMService): assistant = OpenAIAssistantContextAggregator(context, params=assistant_params) return OpenAIContextAggregatorPair(_user=user, _assistant=assistant) - @property - def supports_universal_context(self) -> bool: - """Check if this service supports universal LLMContext. - - Returns: - True, as OpenAI service supports universal LLMContext. - """ - return True - class OpenAIUserContextAggregator(LLMUserContextAggregator): """OpenAI-specific user context aggregator.