Describe the Problem
OrchestrationStreamResponse does not expose the underlying HTTP response headers, specifically x-request-id, which is available in non-streaming mode via response.rawResponse.headers["x-request-id"].
This prevents:
- Correlating client requests with SAP AI Core backend logs
- Providing request IDs to SAP support for debugging
- Building proper observability and auditing systems
- Consistent metadata in downstream integrations (e.g., Vercel AI SDK providers)
Propose a Solution
Add readonly rawResponse?: HttpResponse to OrchestrationStreamResponse, matching the non-streaming API design:
export class OrchestrationStreamResponse<T> {
readonly rawResponse?: HttpResponse; // NEW
// ... existing properties
}
Usage:
const streamResponse = await client.stream(requestBody, signal);
const requestId = streamResponse.rawResponse?.headers["x-request-id"];
This is fully backward compatible (optional property) and provides consistent developer experience across streaming/non-streaming modes.
Describe Alternatives
Current workaround: Generate client-side UUID instead of using backend request ID (loses correlation with backend logs).
Alternative considered: Add getRequestMetadata() method, but direct property access is simpler and consistent with non-streaming API.
Affected Development Phase
Development
Impact
Inconvenience
Timeline
Non-blocking, but increasingly important as streaming becomes standard for production applications requiring observability.
Additional Context
- Downstream package:
@mymediset/sap-ai-provider (Vercel AI SDK integration)
- Current workaround: Using client-generated UUIDs instead of backend
x-request-id
- Similar implementations: OpenAI, Anthropic, and Google AI SDKs expose request IDs in both streaming and non-streaming modes
Describe the Problem
OrchestrationStreamResponsedoes not expose the underlying HTTP response headers, specificallyx-request-id, which is available in non-streaming mode viaresponse.rawResponse.headers["x-request-id"].This prevents:
Propose a Solution
Add
readonly rawResponse?: HttpResponsetoOrchestrationStreamResponse, matching the non-streaming API design:Usage:
This is fully backward compatible (optional property) and provides consistent developer experience across streaming/non-streaming modes.
Describe Alternatives
Current workaround: Generate client-side UUID instead of using backend request ID (loses correlation with backend logs).
Alternative considered: Add
getRequestMetadata()method, but direct property access is simpler and consistent with non-streaming API.Affected Development Phase
Development
Impact
Inconvenience
Timeline
Non-blocking, but increasingly important as streaming becomes standard for production applications requiring observability.
Additional Context
@mymediset/sap-ai-provider(Vercel AI SDK integration)x-request-id