GeminiClient
Category: LLM Providers
Source: gemini_client.dart
Streaming client for the Gemini Developer API (v1beta).
Talks to generativelanguage.googleapis.com via SSE streams. Unlike the other built-in LLM clients this also doubles as the data-parser that [GeminiProvider] delegates to — parseStreamEvents is exposed as a static for testability.
Classes
GeminiClient
Constructor
dart
GeminiClient({
required this.apiKey,
required this.model,
required this.systemPrompt,
String baseUrl = _defaultBaseUrl,
http.Client Function()? requestClientFactory,
})Properties
| Property | Type | Description |
|---|---|---|
apiKey | String | |
model | String | |
systemPrompt | String |
Methods
Stream<LlmChunk> stream(List<Message> messages, {List<Tool>? tools})
`static Stream<LlmChunk> parseStreamEvents(
Stream<Map<String, dynamic>> events,
)`
Parse Gemini SSE event payloads into [LlmChunk]s.
Exposed as static for testability — callers feed already-decoded JSON objects (one per SSE data: event).