GeminiStreamClient class final

Streams chat completions from the Google Gemini API (streamGenerateContent?alt=sse).

Wire format: SSE frames whose data is a GenerateContentResponse JSON. Text arrives in candidates[0].content.parts[].text; the final frame carries usageMetadata. There is no [DONE] sentinel — the stream ending is the completion signal.

Implemented types

Constructors

GeminiStreamClient({required String apiKey, String baseUrl = 'https://generativelanguage.googleapis.com/v1beta', Client? client})

Properties

apiKey → String
Google AI Studio API key.
final
baseUrl → String
API base URL — override for proxies or gateways.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
streamChat(List<AiChatMessage> messages, {required String model, double? temperature, int? maxTokens, Map<String, Object?> extraBody = const {}}) → Stream<Object>
Streams a chat completion as a sequence of typed events.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited