bedrock_adapter

AWS Bedrock LLM adapter for Pipecat.

class pipecat.adapters.services.bedrock_adapter.AWSBedrockLLMInvocationParams[source]

Bases: TypedDict

Context-based parameters for invoking AWS Bedrock’s LLM API.

system: list[dict[str, Any]] | None
messages: list[dict[str, Any]]
tools: list[dict[str, Any]]
tool_choice: Literal['none', 'auto', 'required'] | ChatCompletionAllowedToolChoiceParam | ChatCompletionNamedToolChoiceParam | ChatCompletionNamedToolChoiceCustomParam
class pipecat.adapters.services.bedrock_adapter.AWSBedrockLLMAdapter[source]

Bases: BaseLLMAdapter[AWSBedrockLLMInvocationParams]

Adapter for AWS Bedrock LLM integration with Pipecat.

Provides conversion utilities for transforming Pipecat function schemas into AWS Bedrock’s expected tool format for function calling capabilities.

property id_for_llm_specific_messages: str

Get the identifier used in LLMSpecificMessage instances for AWS Bedrock.

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

Get AWS Bedrock-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 or run_inference.

Returns:

Dictionary of parameters for invoking AWS Bedrock’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 Bedrock.

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

Parameters:

context – The LLM context containing messages.

Returns:

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

class ConvertedMessages(messages: list[dict[str, Any]], system: str | None)[source]

Bases: object

Container for Bedrock-formatted messages converted from universal context.

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

Convert function schemas to Bedrock’s function-calling format.

Parameters:

tools_schema – The tools schema containing functions to convert.

Returns:

List of Bedrock formatted function call definitions.