Skip to content

fix(google-genai): avoid redundant serialization and preserve stream parts - #951

Merged
Abhijeet Prasad (AbhiPrasad) merged 7 commits into
mainfrom
abhi/genai-interaction-fixes-8697d74c
Oct 16, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 7 commits into
mainfrom
abhi/genai-interaction-fixes-8697d74c

Conversation

@AbhiPrasad

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Guard Pydantic model classes during interaction materialization so response_format classes do not break traced calls.
  • Preserve streamed executable code and code execution results, including their encounter order among text parts per candidate.
  • Reduce redundant serialization in tools, embeddings, interaction metadata/results, candidate aggregation, and interaction tool-span cleanup.
  • Add mixed text/code-execution stream coverage with new VCR recordings for every supported google-genai version.

Logged shape

Streamed code execution parts now log under executable_code or code_execution_result in provider order. Previously, the pydantic Part attribute check caused these parts to be logged as {"function_call": null}, and aggregation could move code parts after all text.

Validation

  • Full test_google_genai(latest) suite: 44 passed, 2 skipped, replay-only.
  • The new mixed text/code stream test passed against recordings for latest (2.29.0), 1.75.0, and 1.30.0.
  • Focused stream and tool-use tests passed across all three versions.
  • Added new cassette files for this test only; existing cassettes were not re-recorded.

Follow-up observation

_reconstruct_interaction_outputs_from_events still materializes each event fragment before merging deltas. Media fragments may therefore create repeated attachment materialization; this optional optimization was left unchanged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T00:31:04.113275Z 9d0d822 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7270897aa3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread py/src/braintrust/integrations/google_genai/tracing.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fec2fd14f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread py/src/braintrust/integrations/google_genai/test_google_genai.py
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit ca80760 into main Oct 16, 2026
96 of 98 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi/genai-interaction-fixes-8697d74c branch October 16, 2026 01:49
@AbhiPrasad

Copy link
Copy Markdown
Member Author

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.

1 participant