Raise errors when trying to use universal LLMContext with LLM services that don't yet support it
This commit is contained in:
@@ -31,6 +31,7 @@ from pipecat.frames.frames import (
|
|||||||
FunctionCallCancelFrame,
|
FunctionCallCancelFrame,
|
||||||
FunctionCallInProgressFrame,
|
FunctionCallInProgressFrame,
|
||||||
FunctionCallResultFrame,
|
FunctionCallResultFrame,
|
||||||
|
LLMContextFrame,
|
||||||
LLMEnablePromptCachingFrame,
|
LLMEnablePromptCachingFrame,
|
||||||
LLMFullResponseEndFrame,
|
LLMFullResponseEndFrame,
|
||||||
LLMFullResponseStartFrame,
|
LLMFullResponseStartFrame,
|
||||||
@@ -408,6 +409,8 @@ class AnthropicLLMService(LLMService):
|
|||||||
context = None
|
context = None
|
||||||
if isinstance(frame, OpenAILLMContextFrame):
|
if isinstance(frame, OpenAILLMContextFrame):
|
||||||
context: "AnthropicLLMContext" = AnthropicLLMContext.upgrade_to_anthropic(frame.context)
|
context: "AnthropicLLMContext" = AnthropicLLMContext.upgrade_to_anthropic(frame.context)
|
||||||
|
elif isinstance(frame, LLMContextFrame):
|
||||||
|
raise NotImplementedError("Universal LLMContext is not yet supported for Anthropic.")
|
||||||
elif isinstance(frame, LLMMessagesFrame):
|
elif isinstance(frame, LLMMessagesFrame):
|
||||||
context = AnthropicLLMContext.from_messages(frame.messages)
|
context = AnthropicLLMContext.from_messages(frame.messages)
|
||||||
elif isinstance(frame, VisionImageRawFrame):
|
elif isinstance(frame, VisionImageRawFrame):
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ from pipecat.frames.frames import (
|
|||||||
FunctionCallFromLLM,
|
FunctionCallFromLLM,
|
||||||
FunctionCallInProgressFrame,
|
FunctionCallInProgressFrame,
|
||||||
FunctionCallResultFrame,
|
FunctionCallResultFrame,
|
||||||
|
LLMContextFrame,
|
||||||
LLMFullResponseEndFrame,
|
LLMFullResponseEndFrame,
|
||||||
LLMFullResponseStartFrame,
|
LLMFullResponseStartFrame,
|
||||||
LLMMessagesFrame,
|
LLMMessagesFrame,
|
||||||
@@ -1044,6 +1045,8 @@ class AWSBedrockLLMService(LLMService):
|
|||||||
context = None
|
context = None
|
||||||
if isinstance(frame, OpenAILLMContextFrame):
|
if isinstance(frame, OpenAILLMContextFrame):
|
||||||
context = AWSBedrockLLMContext.upgrade_to_bedrock(frame.context)
|
context = AWSBedrockLLMContext.upgrade_to_bedrock(frame.context)
|
||||||
|
if isinstance(frame, LLMContextFrame):
|
||||||
|
raise NotImplementedError("Universal LLMContext is not yet supported for AWS Bedrock.")
|
||||||
elif isinstance(frame, LLMMessagesFrame):
|
elif isinstance(frame, LLMMessagesFrame):
|
||||||
context = AWSBedrockLLMContext.from_messages(frame.messages)
|
context = AWSBedrockLLMContext.from_messages(frame.messages)
|
||||||
elif isinstance(frame, VisionImageRawFrame):
|
elif isinstance(frame, VisionImageRawFrame):
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ from pipecat.frames.frames import (
|
|||||||
FunctionCallFromLLM,
|
FunctionCallFromLLM,
|
||||||
InputAudioRawFrame,
|
InputAudioRawFrame,
|
||||||
InterimTranscriptionFrame,
|
InterimTranscriptionFrame,
|
||||||
|
LLMContextFrame,
|
||||||
LLMFullResponseEndFrame,
|
LLMFullResponseEndFrame,
|
||||||
LLMFullResponseStartFrame,
|
LLMFullResponseStartFrame,
|
||||||
LLMTextFrame,
|
LLMTextFrame,
|
||||||
@@ -322,6 +323,10 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
|
|
||||||
if isinstance(frame, OpenAILLMContextFrame):
|
if isinstance(frame, OpenAILLMContextFrame):
|
||||||
await self._handle_context(frame.context)
|
await self._handle_context(frame.context)
|
||||||
|
elif isinstance(frame, LLMContextFrame):
|
||||||
|
raise NotImplementedError(
|
||||||
|
"Universal LLMContext is not yet supported for AWS Nova Sonic."
|
||||||
|
)
|
||||||
elif isinstance(frame, InputAudioRawFrame):
|
elif isinstance(frame, InputAudioRawFrame):
|
||||||
await self._handle_input_audio_frame(frame)
|
await self._handle_input_audio_frame(frame)
|
||||||
elif isinstance(frame, BotStoppedSpeakingFrame):
|
elif isinstance(frame, BotStoppedSpeakingFrame):
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ from pipecat.frames.frames import (
|
|||||||
Frame,
|
Frame,
|
||||||
InputAudioRawFrame,
|
InputAudioRawFrame,
|
||||||
InterimTranscriptionFrame,
|
InterimTranscriptionFrame,
|
||||||
|
LLMContextFrame,
|
||||||
LLMFullResponseEndFrame,
|
LLMFullResponseEndFrame,
|
||||||
LLMFullResponseStartFrame,
|
LLMFullResponseStartFrame,
|
||||||
LLMMessagesAppendFrame,
|
LLMMessagesAppendFrame,
|
||||||
@@ -343,6 +344,10 @@ class OpenAIRealtimeBetaLLMService(LLMService):
|
|||||||
await self.reset_conversation()
|
await self.reset_conversation()
|
||||||
# Run the LLM at next opportunity
|
# Run the LLM at next opportunity
|
||||||
await self._create_response()
|
await self._create_response()
|
||||||
|
elif isinstance(frame, LLMContextFrame):
|
||||||
|
raise NotImplementedError(
|
||||||
|
"Universal LLMContext is not yet supported for OpenAI Realtime."
|
||||||
|
)
|
||||||
elif isinstance(frame, InputAudioRawFrame):
|
elif isinstance(frame, InputAudioRawFrame):
|
||||||
if not self._audio_input_paused:
|
if not self._audio_input_paused:
|
||||||
await self._send_user_audio(frame)
|
await self._send_user_audio(frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user