mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
ConverseStream previously buffered the whole proxied response, translated it in one shot, and returned it as a single byte[]. Both backends now write frames through a JAX-RS StreamingOutput as they're known, and the proxy backend reads the upstream SSE response via HttpResponse.BodyHandlers.ofLines() instead of ofString() - text deltas reach SDK clients as the model generates them instead of landing all at once when the response finishes. Once the StreamingOutput starts writing, JAX-RS has already committed the 200 response, so a failure discovered only after streaming begins - a stream that never reaches a finish_reason or "[DONE]" (upstream connection dropped mid-generation) - can no longer become an HTTP error status. It's now reported as a modelStreamErrorException event, the same wire shape (:message-type: exception, :exception-type: <name>) and modeled exception real Bedrock uses for a mid-stream failure, verified to decode correctly through BedrockRuntimeAsyncClient's generated ConverseStreamResponseHandler. A stream that completes normally (finish_reason or "[DONE]" seen) with no content is now treated as a legitimate empty completion rather than an error, matching real Bedrock. Added a compatibility-tests/sdk-test-java case exercising BedrockRuntimeAsyncClient.converseStream end to end, proving the emitted event-stream frames decode correctly through the real AWS SDK rather than only Floci's own byte-level assertions.