Skip to content

backport(google-genai): preserve JSON Schema tool parameters - #5200

Merged
aabmass merged 2 commits into
open-telemetry:package-release/opentelemetry-instrumentation-google-genai/v0.7bxfrom
RKest:backport-834-parameters-json-schema
Oct 22, 2026
Merged

aabmass merged 2 commits into
open-telemetry:package-release/opentelemetry-instrumentation-google-genai/v0.7bxfrom
RKest:backport-834-parameters-json-schema

Conversation

@RKest

@RKest RKest commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Important

This is a backport PR to the v0.7b release branch!

Backport of open-telemetry/opentelemetry-python-genai#834 to the v0.7b release branch.

When a FunctionDeclaration defines its schema through parameters_json_schema instead of parameters, gen_ai.tool.definitions reports the tool with "parameters": null. This change falls back to parameters_json_schema when parameters is unset; parameters still takes precedence when both are present.

Google ADK and other frameworks built on google-genai declare tools this way. Many of them still pin opentelemetry-instrumentation-google-genai<1, so they can only pick up the fix through a 0.7b patch release. If this lands, could we also get a 0.7b2 release?

Related: open-telemetry/opentelemetry-python-genai#827 (fixed on main by open-telemetry/opentelemetry-python-genai#834)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Added tests/generate_content/test_tool_definitions.py, which covers a JSON-schema-only declaration, an empty JSON schema, and parameters taking precedence over parameters_json_schema. The upstream test relies on fixtures and VCR helpers that don't exist on this branch, so it was rewritten in this branch's TestCase style.
  • The JSON-schema cases fail without the source change and pass with it.
  • Package test suite passes with google-genai 1.32.0 (oldest), 2.4.0 (latest pin), and 2.32.0.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Additional CI fixes on this branch

The second commit repairs CI failures that already existed on package-release/opentelemetry-instrumentation-google-genai/v0.7bx after upstream dependency drift. It doesn't change behavior in these packages:

  • instrumentation-anthropic (latest): the anthropic 1.0 release removed temperature, top_p and top_k from messages.create(). The sampling-parameter test is skipped on anthropic >= 1.0 and still runs on the oldest pin.
  • instrumentation-claude-agent-sdk (oldest and lint): claude-agent-sdk==0.1.14 has been removed from PyPI, so the oldest pin moves to 0.1.19. Version 0.1.18 is yanked, so 0.1.19 is the oldest available release at or above 0.1.14.
  • typecheck: removes three # type: ignore comments that pyright reports as unnecessary.

Backport of open-telemetry/opentelemetry-python-genai#834. Function
declarations that define their schema via parameters_json_schema were
reported in gen_ai.tool.definitions with parameters set to null, because
only the parameters field was read.
@github-actions github-actions Bot added the gen-ai Related to generative AI label Oct 21, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-22 18:21 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

- Skip the sampling-parameter test for anthropic >= 1.0, which removed
  temperature, top_p and top_k from messages.create().
- Pin the oldest claude-agent-sdk to 0.1.19. 0.1.14 is no longer on PyPI
  and 0.1.18 is yanked.
- Drop type: ignore comments that pyright reports as unnecessary.
@RKest
RKest marked this pull request as ready for review October 22, 2026 13:22
@RKest
RKest requested a review from a team as a code owner October 22, 2026 13:22
@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Oct 22, 2026
@aabmass
aabmass merged commit 5352e94 into open-telemetry:package-release/opentelemetry-instrumentation-google-genai/v0.7bx Oct 22, 2026
770 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Oct 22, 2026
@aabmass

aabmass commented Oct 22, 2026

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gen-ai Related to generative AI

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants