Repository navigation
fix(telemetry): report tool_call finish reason for function-call turns - #8428
Open
GermanGerken wants to merge 2 commits into
Open
GermanGerken wants to merge 2 commits into
GermanGerken wants to merge 2 commits into
Conversation
Gemini and the OpenAI integration report STOP for a model turn that ends in a function call, so GenAI telemetry published finish reason "stop". Under the semconv-aligned schema, report "tool_call" when a STOP turn's content contains a function call. The legacy schema keeps "stop". Fixes google#8425
…all turn Gemini reports STOP for a model turn that ends in a function call, and the OpenAI integration maps tool_calls to STOP, so telemetry recorded such turns as "stop". The GenAI semantic conventions name this case "tool_call". With the semconv-aligned schema (2), a STOP turn whose content has a function_call part is now reported as "tool_call" in gen_ai.response.finish_reasons and in gen_ai.output.messages. The legacy schema (1) keeps reporting "stop". Fixes google#8425
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8425.
Problem
Gemini reports
STOPfor a model turn that ends in a function call, and the OpenAI integration mapstool_callstoSTOPtoo. GenAI telemetry therefore publishedgen_ai.response.finish_reasons = ["stop"](andfinish_reason: "stop"in output messages) for tool-call turns, although the GenAI semantic conventions name this casetool_call.Change
_finish_reason.reports_tool_call(): true when the finish reason isSTOP, the content contains afunction_callpart, and the semconv-aligned schema is active._experimental_semconv._to_finish_reason(response attributes and output messages) and intracing.trace_inference_result.ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN=1) keeps reportingstop.Tests
Added to
tests/unittests/telemetry/test_experimental_semconv.py:tool_call;stop.