Skip to content

Update ServerContent and UsageMetadata live types - #22

Closed
tgodniak wants to merge 2 commits into
nshkrdotcom:mainfrom
u2i:fix-live-response-usage-metadata
Closed

Update ServerContent and UsageMetadata live types#22
tgodniak wants to merge 2 commits into
nshkrdotcom:mainfrom
u2i:fix-live-response-usage-metadata

Conversation

@tgodniak

@tgodniak tgodniak commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add candidates_token_count and candidates_tokens_details to Gemini.Types.Live.UsageMetadata — mirrors the fields already present in Gemini.Types.Response.UsageMetadata
  • Add turn_complete_reason to Gemini.Types.Live.ServerContent — Vertex AI v1 field indicating why a turn completed (MALFORMED_FUNCTION_CALL, RESPONSE_REJECTED, NEED_MORE_INPUT)

Both fields are fully wired through @type t, defstruct, new/1, to_api/1, and from_api/1.

@tgodniak tgodniak changed the title Update ServerContent and UsageMetadata Update Live ServerContent and UsageMetadata Mar 27, 2026
@tgodniak tgodniak changed the title Update Live ServerContent and UsageMetadata Update ServerContent and UsageMetadata live types Mar 27, 2026
@nshkrdotcom

Copy link
Copy Markdown
Owner

Thanks @tgodniak. I used your PR as the guide for the final fix.

Your changes were the right starting point: they surfaced the missing Live API fields and helped pin down what Vertex Live v1 was sending. I ended up fixing the broader compatibility path around it as well, including Gemini Live vs Vertex Live usage field normalization, typed turn_complete_reason, downstream token accounting, and live-test behavior for environments that only expose native-audio Vertex Live models.

The full fix shipped in v0.11.1, and it's live on Hex here:
https://hex.pm/packages/gemini_ex/0.11.1

Appreciate you taking the time to put this together.

@nshkrdotcom nshkrdotcom closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants