Proposal: collect Responses API answer and summary text (#3581)
Summary
Extend ai-statistics built-in answer and reasoning attributes to collect OpenAI/Azure Responses API output. Tracking issue: #3581.
Evidence and scope
At Higress faccaad586a3cdc9e85dc7fa39358ff31a6453b2, getBuiltinAttributeValue recognizes Chat Completions/Claude answers but not Responses output-text deltas, reasoning-summary deltas or non-stream output[] blocks.
- Collect response.output_text.delta and response.reasoning_summary_text.delta, preserving event order and UTF-8 across host callbacks.
- Prefer a nonempty JSON type; use the SSE event name only when JSON type is absent.
- For non-stream output[], collect message content[] output_text and reasoning summary[] summary_text string fields in response order.
- Do not duplicate done/completed snapshots or collect tool arguments, encrypted/private reasoning, arbitrary deltas or malformed events as text.
- Preserve custom attributes, disabled-processing behavior, existing token/error framing from #4265, and exact client response bytes.
- Add CN/EN documentation and real proxy-Wasm baseline/fixed verification.
This is content extraction, not the default-path/token-metrics change in #4206. Tests/examples explicitly enable /responses. No new provider, SDK upgrade, stream framer, default path or tool-call feature is proposed.
Prior work and approval
The July prototype bf2b3b2de90fe5e58793c8bf47569d3a6ccc6ef5 is local reference material; former PR #4223 currently returns 404. It is not evidence of approval or current compatibility. Any reuse must retain truthful provenance and must not silently rewrite old commit identity.
Current contributor: pilichoumao. AI assistance is material. Explicit maintainer approval of Proposal and Design is requested before this current-main adaptation is implemented. No retroactive approval, human-only declaration or maintainer exception is claimed.
Acceptance
Pinned real proxy-Wasm data path and deterministic mock Responses upstream; baseline demonstrates missing content and fixed artifact yields exact expected answer/summary for JSON and fragmented SSE, without changing client status/headers/body bytes. Record source SHAs, Wasm hashes, image digest, fixtures, logs, machine assertions, repeated runs and cleanup. Unit tests alone are not runtime proof.
Source: higress-group/higress