You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Release v0.11.1: Normalize Live API usage metadata and improve Vertex AI compatibility
- Implement canonical `candidates_*` fields in `UsageMetadata` to unify
Gemini Live (`response_*`) and Vertex Live (`candidates_*`) schemas.
- Add `output_token_count/1` and `output_tokens_details/1` helpers for
backend-agnostic usage tracking.
- Capture and expose Vertex Live `turnCompleteReason` via `ServerContent`.
- Update `RateLimiter.Manager` to reconcile usage against canonical
fields, preferring `candidatesTokenCount` where available.
- Refine Vertex Live model resolution to exclude native-audio-only models
from text-only session candidates.
- Improve test stability:
- Add retry/skip logic for transient upstream 1011 errors.
- Dynamically skip Vertex text-only tests if no compatible model is
detected in the user's project.
- Document backend schema differences and provide updated testing
instructions in README and guides.
- Bump version to 0.11.1.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [0.11.1] - 2026-03-27
11
+
12
+
### Added
13
+
14
+
#### Live API Schema Compatibility Helpers
15
+
-**`Gemini.Types.Live.Enums.TurnCompleteReason`**: typed enum for Vertex Live `turnCompleteReason`
16
+
-**`Gemini.Types.Live.ServerContent.turn_complete_reason`**: captures the server-provided turn completion reason when present
17
+
-**`Gemini.Types.Live.UsageMetadata.output_token_count/1`** and **`output_tokens_details/1`**: backend-agnostic helpers for normalized Live output usage
18
+
19
+
### Changed
20
+
-**Live usage metadata normalization**: Gemini Live `responseTokenCount` / `responseTokensDetails` and Vertex Live `candidatesTokenCount` / `candidatesTokensDetails` now populate the same canonical `candidates_*` fields in `Gemini.Types.Live.UsageMetadata`
21
+
-**Backwards compatibility preserved**: `response_token_count` and `response_tokens_details` remain available as aliases for existing caller code
22
+
-**Vertex text live model filtering**: native-audio-only models are no longer treated as text candidates during Vertex Live text model resolution
23
+
-**Live docs and test instructions**: README and Live API guide now document the Gemini-vs-Vertex schema split and the targeted manual test commands
24
+
25
+
### Fixed
26
+
-**Rate limiter output token accounting**: usage reconciliation now falls back to Gemini-style Live `responseTokenCount` metadata instead of assuming only `candidatesTokenCount`
27
+
-**Vertex Live server content parsing**: `turnCompleteReason` is now captured and exposed through the Live type layer
28
+
-**Live type coverage**: unit tests now cover Gemini-style and Vertex-style usage metadata parsing plus Vertex turn completion reasons
29
+
-**Live integration test stability**: Gemini raw WebSocket setup retries/skips transient upstream `1011` internal errors, and Vertex text-only live session tests skip cleanly when the project has no text-capable Live model
Copy file name to clipboardExpand all lines: README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Add `gemini` to your list of dependencies in `mix.exs`:
59
59
```elixir
60
60
defdepsdo
61
61
[
62
-
{:gemini_ex, "~> 0.11.0"}
62
+
{:gemini_ex, "~> 0.11.1"}
63
63
]
64
64
end
65
65
```
@@ -208,6 +208,8 @@ See `guides/interactions.md` for CRUD, resumption (`last_event_id`), and backgro
208
208
209
209
Real-time bidirectional streaming for voice, video, and text interactions. For Gemini Live connections, `v1beta` is the default API version, while `v1alpha` is available for advanced native-audio features. Vertex Live connections use the Vertex `v1` WebSocket endpoint.
210
210
211
+
Gemini Live and Vertex Live do not emit identical usage metadata fields. `gemini_ex` normalizes both backends into `Gemini.Types.Live.UsageMetadata.candidates_token_count` / `candidates_tokens_details`, keeps `response_*` aliases for backwards compatibility, and exposes `Gemini.Types.Live.UsageMetadata.output_token_count/1` and `output_tokens_details/1` as backend-agnostic helpers. Vertex Live may also populate `server_content.turn_complete_reason`.
212
+
211
213
#### Model Resolution
212
214
213
215
Live API model availability varies by API key and regional rollout. `Gemini.Live.Models.resolve/1` uses the model registry plus runtime `list_models` results to select a compatible model:
@@ -1856,8 +1858,19 @@ mix test --cover
1856
1858
1857
1859
# Run integration tests (requires API key)
1858
1860
GEMINI_API_KEY="your_key" mix test --only integration
1861
+
1862
+
# Run Gemini Live session tests when GEMINI_API_KEY is already exported
1863
+
mix test --only live_gemini test/gemini/live/session_live_test.exs
1864
+
1865
+
# Run Gemini Live feature tests when GEMINI_API_KEY is already exported
1866
+
mix test --only live_gemini test/gemini/live/features_live_test.exs
1867
+
1868
+
# Run billed Vertex Live tests when Vertex credentials are already exported
1869
+
RUN_BILLED_VERTEX_LIVE_TESTS=1 mix test --only live_vertex_ai test/gemini/live/session_vertex_live_test.exs
1859
1870
```
1860
1871
1872
+
If your Vertex project exposes only native-audio Live models, the text-only Vertex session tests will skip instead of failing.
The initial message after establishing the WebSocket connection sets the session configuration:
@@ -1051,6 +1084,25 @@ Session.close(session)
1051
1084
1052
1085
See `examples/13_live_session_resumption.exs` for a complete example.
1053
1086
1087
+
## Testing Live Sessions
1088
+
1089
+
When your environment variables are already exported, run the Live integration tests directly:
1090
+
1091
+
```bash
1092
+
# Gemini Live session coverage
1093
+
mix test --only live_gemini test/gemini/live/session_live_test.exs
1094
+
1095
+
# Gemini Live advanced features
1096
+
mix test --only live_gemini test/gemini/live/features_live_test.exs
1097
+
1098
+
# Vertex Live coverage (billed; requires explicit opt-in)
1099
+
RUN_BILLED_VERTEX_LIVE_TESTS=1 mix test --only live_vertex_ai test/gemini/live/session_vertex_live_test.exs
1100
+
```
1101
+
1102
+
The default test suite excludes `:live_gemini` and `:live_vertex_ai`, so these targeted commands are the intended manual verification path for real credentials.
1103
+
1104
+
If your Vertex project exposes only native-audio Live models, the text-only Vertex session tests will skip instead of failing. This is expected: native-audio-only Vertex models cannot satisfy `response_modalities: ["TEXT"]`.
0 commit comments