Skip to main content

gproxy_protocol/wire/gemini/
stream.rs

1//! Gemini `models.streamGenerateContent` wire shapes.
2//!
3//! The endpoint takes the same request as `generateContent` and returns a
4//! stream of `GenerateContentResponse` JSON records.  A transport chunk is
5//! not a JSON record. SSE (`alt=sse`) or JSON-array framing belongs to the
6//! transport; these aliases do not implement parsing or codecs.
7//! The generated google-cloud-python REST method uses ResponseIterator with
8//! `_rest_streaming_base`, whose JSON-array iterator expects an opening `[`.
9//! Source: `upstream_docs/gemini/docs/Generating content.md`,
10//! `models.streamGenerateContent` (endpoint, request, and response body).
11use super::{GenerateContentRequest, GenerateContentResponseBody};
12use crate::{WireResponse, connection::ByteStream};
13
14/// Every streamed record has exactly the non-streaming response shape.
15pub type StreamChunk = GenerateContentResponseBody;
16pub type StreamRequest = GenerateContentRequest;
17pub type StreamResponse = WireResponse<ByteStream>;