Skip to content
5 min read · 1,082 words

@nhtio/adk/batteries/llm/openai_responses/types

TypeScript wire shapes, helper contracts, and option types for the OpenAI Responses battery.

Remarks

Type aliases for the OpenAI Responses adapter — wire shapes, helper input/output shapes, and the adapter's options shape. These are documentation-level types only; runtime validation lives in validation.ts (openAIResponsesOptionsSchema).

The Responses API replaces the flat messages[] array with a flat input: Item[] array — a tool call and its result are two SIBLING top-level items, not one message containing both. The system prompt lives in a top-level instructions string field by default (or, via systemPromptChannel, a leading developer/system-role item instead).

Interfaces

InterfaceDescription
OpenAIResponsesAdapterOptionsConfiguration options for the OpenAI Responses adapter.
OpenAIResponsesCompletedEventTerminal SSE event emitted when the response completes successfully.
OpenAIResponsesErrorEventTerminal SSE event emitted when the stream itself errors, outside of any particular response object.
OpenAIResponsesFailedEventTerminal SSE event emitted when the response fails outright.
OpenAIResponsesFunctionCallArgumentsDeltaEventSSE event emitted when a fragment of a tool call's JSON arguments streams in.
OpenAIResponsesFunctionCallArgumentsDoneEventSSE event emitted when a tool call's JSON arguments string is finalized.
OpenAIResponsesFunctionCallItemA model-emitted function (tool) call item.
OpenAIResponsesFunctionCallOutputItemThe result of executing a function_call_output's paired function_call.
OpenAIResponsesHelpersFull translation-helper contract for the OpenAI Responses battery.
OpenAIResponsesIncompleteEventTerminal SSE event emitted when the response stops before completing (e.g. hit max_output_tokens).
OpenAIResponsesMessageItemAn input message item — the leading-content-channel item shape (role: 'user', or the leading developer/system-role item rendered when systemPromptChannel is not 'instructions', or a trailing after-timeline bucket message), plus a peer-identity assistant timeline turn rendered as a plain input message rather than the full output-item shape.
OpenAIResponsesOpaqueOutputItemAny other output item type the Responses API can emit that this battery does not natively model (hosted server-side tools: web_search_call, code_interpreter_call, mcp_call, etc.). Carried through structurally so the streaming state machine can recognize — and deliberately decline to open a slot for — an item type it does not know, per Known Gotcha #6.
OpenAIResponsesOutputItemAddedEventSSE event emitted when a new output item is opened (streaming begins for that item).
OpenAIResponsesOutputItemDoneEventSSE event emitted when an output item is finalized — its terminal, fully-populated shape.
OpenAIResponsesOutputMessageItemAn assistant output-message item, in the OUTPUT shape (not the input shape) — used when replaying the ADK's OWN prior assistant text back into input, so the reasoning-pairing validator (see the Known Gotchas) recognizes it correctly as a genuine prior output item.
OpenAIResponsesOutputTextDeltaEventSSE event emitted when a text fragment streams in for an output message's content.
OpenAIResponsesOutputTextDoneEventSSE event emitted when an output message's text content part is finalized.
OpenAIResponsesReasoningContentPartOne full-reasoning-text part of a reasoning item (present only under some include values).
OpenAIResponsesReasoningItemA model-emitted reasoning item — the native wire representation of a "thought." Only ever sent back on input when reasoningReplay !== 'off' and its stored signature/prefix-fingerprint is still valid; see the reasoning-pairing adjacency-sweep pass and Known Gotcha #1.
OpenAIResponsesReasoningReplayPayloadOpaque payload stored on a replayable OpenAI Responses reasoning Thought. Sibling to the Anthropic battery's AnthropicThinkingReplayPayload.
OpenAIResponsesReasoningSummaryPartOne summary-text part of a reasoning item.
OpenAIResponsesReasoningSummaryTextDeltaEventSSE event emitted when a reasoning-summary text fragment streams in for a reasoning item.
OpenAIResponsesReasoningSummaryTextDoneEventSSE event emitted when a reasoning item's summary-text part is finalized.
OpenAIResponsesReasoningTextDeltaEventSSE event emitted when a full-reasoning text fragment streams in for a reasoning item.
OpenAIResponsesReasoningTextDoneEventSSE event emitted when a reasoning item's full-reasoning-text part is finalized.
OpenAIResponsesRefusalDeltaEventSSE event emitted when a refusal fragment streams in for an output message's content.
OpenAIResponsesRefusalDoneEventSSE event emitted when an output message's refusal content part is finalized.
OpenAIResponsesRequestBodyThe WIRE body shape this battery constructs and sends — not a 1:1 mirror of consumer-settable options. instructions and store are ALWAYS adapter-computed; neither is a key on OpenAIResponsesAdapterOptions.
OpenAIResponsesResponseObjectThe full response object — returned directly (non-streaming), or nested under a terminal streaming event.
OpenAIResponsesUsageToken-usage accounting on a Responses response object.
ResponsesOutputSlotMachinePer-dispatch streaming-state accumulator, keyed by output_index (one slot per output item — NOT a tool-call index, unlike Chat Completions). Constructed fresh per generation via OpenAIResponsesHelpers.createResponsesOutputSlotMachine.
ResponsesTextSlotA streaming text (assistant output-message) slot.
ResponsesThinkingSlotA streaming reasoning ("thinking") slot.
ResponsesToolCallSlotA streaming tool-call slot.

Type Aliases

Type AliasDescription
OpenAIResponsesIncludableValue(s) requestable via the wire include array.
OpenAIResponsesInputContentBlockDiscriminated union of content block shapes accepted by the OpenAI Responses input item content array (and, per the API reference, also the shape a function_call_output.output array entry may take).
OpenAIResponsesInputItemDiscriminated union of every item shape this battery sends on the input array.
OpenAIResponsesOutputItemDiscriminated union of every item shape the Responses API can emit in response.output.
OpenAIResponsesOutputMessageContentPartOne output-message content part.
OpenAIResponsesStreamEventDiscriminated union of every streaming event this battery handles explicitly, plus a structural fallback ({type: string, ...}) for the many other event types the Responses API emits (response.created, response.in_progress, response.content_part.added/.done, hosted-tool progress events, etc.) that this battery does not act on.
OpenAIResponsesToolWire shape of a single function tool advertised to the model. name is TOP-LEVEL, unlike Chat Completions' {type:'function', function:{name, ...}} nesting.
OpenAIResponsesToolChoiceTool-choice directive accepted by this battery's v1 (a subset of the full wire union).
ReasoningReplayModeReasoning-replay mode. See OpenAIResponsesAdapterOptions.reasoningReplay.
ResponsesOutputSlotUnion of every tracked per-output_index slot kind.
SystemPromptChannelChannel the ADK-rendered system prompt is placed on. See OpenAIResponsesAdapterOptions.systemPromptChannel.

References

ChatCompletionsBucketLabel

Re-exports ChatCompletionsBucketLabel


ChatCompletionsBucketOrder

Re-exports ChatCompletionsBucketOrder


ChatCompletionsRetryConfig

Re-exports ChatCompletionsRetryConfig


ChatHelpersCommon

Re-exports ChatHelpersCommon


DescriptionLike

Re-exports DescriptionLike


JsonSchema

Re-exports JsonSchema


MemoryAttrs

Re-exports MemoryAttrs


RetrievableAttrs

Re-exports RetrievableAttrs


StandingInstructionAttrs

Re-exports StandingInstructionAttrs


ThoughtAttrs

Re-exports ThoughtAttrs


ToolCallParserFn

Re-exports ToolCallParserFn


ToolCallParserName

Re-exports ToolCallParserName


TrustedContentAttrs

Re-exports TrustedContentAttrs


UnsupportedMediaPolicy

Re-exports UnsupportedMediaPolicy


UntrustedContentAttrs

Re-exports UntrustedContentAttrs