Remove supports_universal_context gate from OpenAI-library-based LLM services. It's no longer needed, as they all now support universal LLMContext.
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user