open_ai_responses_adapter

OpenAI Responses API adapter for Pipecat.

class pipecat.adapters.services.open_ai_responses_adapter.OpenAIResponsesLLMInvocationParams[source]

Bases: TypedDict

Context-based parameters for invoking OpenAI Responses API.

input: list[EasyInputMessageParam | Message | ResponseOutputMessageParam | ResponseFileSearchToolCallParam | ResponseComputerToolCallParam | ComputerCallOutput | ResponseFunctionWebSearchParam | ResponseFunctionToolCallParam | FunctionCallOutput | ToolSearchCall | ResponseToolSearchOutputItemParamParam | ResponseReasoningItemParam | ResponseCompactionItemParamParam | ImageGenerationCall | ResponseCodeInterpreterToolCallParam | LocalShellCall | LocalShellCallOutput | ShellCall | ShellCallOutput | ApplyPatchCall | ApplyPatchCallOutput | McpListTools | McpApprovalRequest | McpApprovalResponse | McpCall | ResponseCustomToolCallOutputParam | ResponseCustomToolCallParam | ItemReference]
tools: list[FunctionToolParam | FileSearchToolParam | ComputerToolParam | ComputerUsePreviewToolParam | WebSearchToolParam | Mcp | CodeInterpreter | ImageGeneration | LocalShell | FunctionShellToolParam | CustomToolParam | NamespaceToolParam | ToolSearchToolParam | WebSearchPreviewToolParam | ApplyPatchToolParam] | NotGiven
instructions: str
class pipecat.adapters.services.open_ai_responses_adapter.OpenAIResponsesLLMAdapter[source]

Bases: BaseLLMAdapter[OpenAIResponsesLLMInvocationParams]

OpenAI Responses API adapter for Pipecat.

Handles:

  • Converting LLMContext messages to Responses API input items

  • Converting Pipecat’s standardized tools schema to Responses API function tool format

  • Extracting and sanitizing messages from the LLM context for logging

property id_for_llm_specific_messages: str

Get the identifier used in LLMSpecificMessage instances.

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

Get Responses API 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 the Responses API.

to_provider_tools_format(tools_schema: ToolsSchema) list[FunctionToolParam | FileSearchToolParam | ComputerToolParam | ComputerUsePreviewToolParam | WebSearchToolParam | Mcp | CodeInterpreter | ImageGeneration | LocalShell | FunctionShellToolParam | CustomToolParam | NamespaceToolParam | ToolSearchToolParam | WebSearchPreviewToolParam | ApplyPatchToolParam][source]

Convert function schemas to Responses API function tool format.

Parameters:

tools_schema – The Pipecat tools schema to convert.

Returns:

List of Responses API function tool definitions.

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

Get messages from context in a format ready for logging.

Binary data (images, audio) is replaced with short placeholders.

Parameters:

context – The LLM context containing messages.

Returns:

List of messages in a format ready for logging.