Skip to content

feat: accumulate streaming continuation usage metadata and expose initial_prompt_token_count - #3098

Merged
copybara-service[bot] merged 1 commit into
mainfrom
copybara/997253509
Oct 11, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
copybara/997253509

Conversation

@copybara-service

Copy link
Copy Markdown

feat: accumulate streaming continuation usage metadata and expose initial_prompt_token_count

@adri22235

Copy link
Copy Markdown

Hi! Just noticed the CI Run mypy (3.11) check is failing due to two attribute typing errors.

Here are the two minimal fixes that cleanly resolve the Mypy check (Success: no issues found in 41 source files):

  1. In google/genai/_extra_utils.py:
# TypeVar "C" does not guarantee the attribute, use getattr or type ignore:
else getattr(curr, "initial_prompt_token_count", None)  # type: ignore[attr-defined]
In google/genai/models.py:
code
Python
# Mypy requires type ignore for async for over an evaluated awaitable:
async for chunk in await self._generate_content_stream(  # type: ignore[attr-defined]
(Optional note: In google/genai/_local_tokenizer_loader.py:83, changing return cast(bytes, resp.content) to return resp.content also clears the [redundant-cast] warning).
We verified these fixes on our CI pipeline and all typing/import jobs pass completely in green. Hope this helps get the PR unblocked!

@copybara-service
copybara-service Bot force-pushed the copybara/997253509 branch 3 times, most recently from 8ddcbbb to 8de4722 Compare October 11, 2026 16:18
…tial_prompt_token_count

PiperOrigin-RevId: 997482740
@copybara-service
copybara-service Bot merged commit b27f3cd into main Oct 11, 2026
1 check passed
@copybara-service
copybara-service Bot deleted the copybara/997253509 branch October 11, 2026 16:29

This branch was successfully deployed

1 active deployment
github-pages — b27f3cde Deployed Oct 11, 2026 by github-pages[bot] via deploy #1532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants