[WIP] AWS Nova Sonic service - remove various TODO comments
This commit is contained in:
@@ -132,7 +132,6 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
# TODO: if we have instruction here as an alternative to using context, we should do the same for tools...right?
|
|
||||||
secret_access_key: str,
|
secret_access_key: str,
|
||||||
access_key_id: str,
|
access_key_id: str,
|
||||||
region: str,
|
region: str,
|
||||||
@@ -182,13 +181,6 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
async def start(self, frame: StartFrame):
|
async def start(self, frame: StartFrame):
|
||||||
await super().start(frame)
|
await super().start(frame)
|
||||||
self._wants_connection = True
|
self._wants_connection = True
|
||||||
# TODO: maybe connect but don't send history until we get all of our settings?
|
|
||||||
# how do we know how long to wait?
|
|
||||||
# ah, i think we'll *always* get at least one OpenAILLMContextFrame which kicks things off
|
|
||||||
# so we need to send the initial history when:
|
|
||||||
# - we're connected
|
|
||||||
# - we've gotten the first context
|
|
||||||
# i *think* this is what's controlled by _api_session_ready/_run_llm_when_api_session_ready
|
|
||||||
await self._start_connecting()
|
await self._start_connecting()
|
||||||
|
|
||||||
async def stop(self, frame: EndFrame):
|
async def stop(self, frame: EndFrame):
|
||||||
@@ -247,7 +239,6 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
if self._triggering_assistant_response:
|
if self._triggering_assistant_response:
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO: check if _audio_input_paused? what causes that?
|
|
||||||
await self._send_user_audio_event(frame.audio)
|
await self._send_user_audio_event(frame.audio)
|
||||||
|
|
||||||
async def _handle_bot_stopped_speaking(self):
|
async def _handle_bot_stopped_speaking(self):
|
||||||
@@ -417,9 +408,7 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
region=self._region,
|
region=self._region,
|
||||||
aws_credentials_identity_resolver=StaticCredentialsResolver(
|
aws_credentials_identity_resolver=StaticCredentialsResolver(
|
||||||
credentials=AWSCredentialsIdentity(
|
credentials=AWSCredentialsIdentity(
|
||||||
access_key_id=self._access_key_id,
|
access_key_id=self._access_key_id, secret_access_key=self._secret_access_key
|
||||||
secret_access_key=self._secret_access_key,
|
|
||||||
# TODO: add additional stuff like aws_session_token
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
http_auth_scheme_resolver=HTTPAuthSchemeResolver(),
|
http_auth_scheme_resolver=HTTPAuthSchemeResolver(),
|
||||||
@@ -431,7 +420,6 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
# LLM communication: input events (pipecat -> LLM)
|
# LLM communication: input events (pipecat -> LLM)
|
||||||
#
|
#
|
||||||
|
|
||||||
# TODO: make params configurable?
|
|
||||||
async def _send_session_start_event(self):
|
async def _send_session_start_event(self):
|
||||||
session_start = f"""
|
session_start = f"""
|
||||||
{{
|
{{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class AWSNovaSonicLLMContext(OpenAILLMContext):
|
|||||||
}
|
}
|
||||||
self._assistant_text = ""
|
self._assistant_text = ""
|
||||||
self.add_message(message)
|
self.add_message(message)
|
||||||
# print(f"[pk] context updated (assistant): {self.get_messages_for_logging()}")
|
# logger.debug(f"Context updated (assistant): {self.get_messages_for_logging()}")
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -168,11 +168,6 @@ class AWSNovaSonicUserContextAggregator(OpenAIUserContextAggregator):
|
|||||||
if isinstance(frame, LLMMessagesUpdateFrame):
|
if isinstance(frame, LLMMessagesUpdateFrame):
|
||||||
await self.push_frame(AWSNovaSonicMessagesUpdateFrame(context=self._context))
|
await self.push_frame(AWSNovaSonicMessagesUpdateFrame(context=self._context))
|
||||||
|
|
||||||
# Parent also doesn't push the LLMSetToolsFrame
|
|
||||||
# TODO: this
|
|
||||||
# if isinstance(frame, LLMSetToolsFrame):
|
|
||||||
# await self.push_frame(frame, direction)
|
|
||||||
|
|
||||||
|
|
||||||
class AWSNovaSonicAssistantContextAggregator(OpenAIAssistantContextAggregator):
|
class AWSNovaSonicAssistantContextAggregator(OpenAIAssistantContextAggregator):
|
||||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
|
|||||||
Reference in New Issue
Block a user