aws_nova_sonic_adapter

AWS Nova Sonic LLM adapter for Pipecat.

class pipecat.adapters.services.aws_nova_sonic_adapter.Role(*values)[source]

Bases: Enum

Roles supported in AWS Nova Sonic conversations.

Parameters:
  • SYSTEM – System-level messages (not used in conversation history).

  • USER – Messages sent by the user.

  • ASSISTANT – Messages sent by the assistant.

  • TOOL – Messages sent by tools (not used in conversation history).

SYSTEM = 'SYSTEM'
USER = 'USER'
ASSISTANT = 'ASSISTANT'
TOOL = 'TOOL'
class pipecat.adapters.services.aws_nova_sonic_adapter.AWSNovaSonicConversationHistoryMessage(role: Role, text: str)[source]

Bases: object

A single message in AWS Nova Sonic conversation history.

Parameters:
  • role – The role of the message sender (USER or ASSISTANT only).

  • text – The text content of the message.

role: Role
text: str
class pipecat.adapters.services.aws_nova_sonic_adapter.AWSNovaSonicLLMInvocationParams[source]

Bases: TypedDict

Context-based parameters for invoking AWS Nova Sonic LLM API.

This is a placeholder until support for universal LLMContext machinery is added for AWS Nova Sonic.

system_instruction: str | None
messages: list[AWSNovaSonicConversationHistoryMessage]
tools: list[dict[str, Any]]
class pipecat.adapters.services.aws_nova_sonic_adapter.AWSNovaSonicLLMAdapter[source]

Bases: BaseLLMAdapter[AWSNovaSonicLLMInvocationParams]

Adapter for AWS Nova Sonic language models.

Converts Pipecat’s standard function schemas into AWS Nova Sonic’s specific function-calling format, enabling tool use with Nova Sonic models.

property id_for_llm_specific_messages: str

Get the identifier used in LLMSpecificMessage instances for AWS Nova Sonic.

get_llm_invocation_params(context: LLMContext, *, system_instruction: str | None = None) AWSNovaSonicLLMInvocationParams[source]

Get AWS Nova Sonic-specific LLM invocation parameters from a universal LLM context.

Parameters:
  • context – The LLM context containing messages, tools, etc.

  • system_instruction – Optional system instruction from service settings.

Returns:

Dictionary of parameters for invoking AWS Nova Sonic’s LLM API.

get_messages_for_logging(context) list[dict[str, Any]][source]

Get messages from a universal LLM context in a format ready for logging about AWS Nova Sonic.

Removes or truncates sensitive data like image content for safe logging.

This is a placeholder until support for universal LLMContext machinery is added for AWS Nova Sonic.

Parameters:

context – The LLM context containing messages.

Returns:

List of messages in a format ready for logging about AWS Nova Sonic.

class ConvertedMessages(messages: list[AWSNovaSonicConversationHistoryMessage], system_instruction: str | None = None)[source]

Bases: object

Container for Google-formatted messages converted from universal context.

messages: list[AWSNovaSonicConversationHistoryMessage]
system_instruction: str | None = None
to_provider_tools_format(tools_schema: ToolsSchema) list[dict[str, Any]][source]

Convert tools schema to AWS Nova Sonic function-calling format.

Parameters:

tools_schema – The tools schema containing function definitions to convert.

Returns:

List of dictionaries in AWS Nova Sonic function format.