fix: conform AWSNovaSonicLLMService.get_setup_params to its protocol

The service implements the NovaSonicSessionSender protocol so the
session-continuation helper can target either the current or next
session. The protocol declares
`get_setup_params(self) -> tuple[str | None, list]`, but the
implementation was unannotated and could return NotGiven in the tools
position when from_standard_tools fell through to its NotGiven
sentinel. Add the matching return annotation and coerce the NotGiven
case to an empty list.
This commit is contained in:
Paul Kompfner
2026-04-27 16:05:25 -04:00
parent 5e1bb4cbe5
commit 191bdc733f

View File

@@ -1106,7 +1106,7 @@ class AWSNovaSonicLLMService(LLMService):
'''
await self.send_event(event_json, stream)
def get_setup_params(self):
def get_setup_params(self) -> tuple[str | None, list]:
"""Return ``(system_instruction, tools)`` for the next session setup."""
if not self._context:
return None, []
@@ -1115,7 +1115,9 @@ class AWSNovaSonicLLMService(LLMService):
self._context, system_instruction=self._settings.system_instruction
)
tools = (
llm_params["tools"] if llm_params["tools"] else adapter.from_standard_tools(self._tools)
llm_params["tools"]
if llm_params["tools"]
else (adapter.from_standard_tools(self._tools) or [])
)
return llm_params["system_instruction"], tools