Skip to content
1 min read · 224 words

@nhtio/adk/batteries/llm/openai_responses/validation

Runtime validation schema and wrapper for OpenAI Responses adapter options.

Remarks

Schema and call-site wrapper for validating OpenAIResponsesAdapterOptions. Used at construction time and at the start of every iteration against the merged options shape (stash > executor > constructor). Throws E_INVALID_OPENAI_RESPONSES_OPTIONS on failure — same hard-fail policy as every other ADK contract.

Notable divergences from the sibling openai_chat_completions/anthropic_messages schemas:

  • NO instructions key and NO store key at all — both are exclusively adapter-owned (see the battery's design notes). .unknown(false) rejects them the same way it rejects previous_response_id/conversation/prompt/context_management — ADK owns history and the system prompt on every battery; this one simply has no escape hatch for either.
  • max_output_tokens carries .min(16) — an undocumented API minimum (400 Invalid 'max_output_tokens'... Expected a value >= 16) enforced at config time instead of dispatch time.
  • background only accepts false/undefined — true is rejected, since this adapter has no polling/resumption logic for a queued/in_progress background response (see the option's own doc comment in types.ts).

Variables

VariableDescription
openAIResponsesOptionsSchemaValidator schema for OpenAIResponsesAdapterOptions.

Functions

FunctionDescription
validateOptionsValidates an arbitrary input against openAIResponsesOptionsSchema and returns the resolved options shape. Throws E_INVALID_OPENAI_RESPONSES_OPTIONS (carrying the validator's error report on cause) on failure.