feat(components): preserve Gemini tool call IDs - #984
Open
shentongmartin wants to merge 2 commits into
Open
shentongmartin wants to merge 2 commits into
shentongmartin wants to merge 2 commits into
Conversation
Preserve provider-issued function call IDs across classic and agentic Gemini messages, while retaining UUID fallback for legacy responses without IDs. Change-Id: Ie9bcdf87e932383c9fdafbf0f91186ea957c3694
Need to create a new tagThe following modules have changes and may need version updates:
|
Change-Id: Ie4f78174b19cdc3c62ff10b76a2a8f5939327c7d
Need to create a new tagThe following modules have changes and may need version updates:
|
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.
Gemini Tool Call ID Passthrough
Problem
Gemini now returns opaque IDs in
FunctionCall.id, but both the classic andagentic adapters replaced or dropped them. Parallel calls to the same function
could therefore be paired with the wrong result when completion order differed
from call order or when persisted history was rebuilt.
Solution
Preserve Gemini's ID in
schema.ToolCall.IDandschema.FunctionToolCall.CallID, then send the same value back throughFunctionCall.idandFunctionResponse.id.Models and gateways that omit IDs keep the existing compatibility behavior:
the adapter creates a unique UUID and Eino carries that value through the tool
result.
Decisions
Key Insight
Gemini's function name identifies what to execute, while its opaque call ID
identifies which invocation a result belongs to. They must remain separate
when the same function is called concurrently.
Summary
Gemini Tool Call ID 透传
问题
Gemini 已开始在
FunctionCall.id中返回 opaque ID,但 classic 和 agentic适配器此前会替换或丢弃该值。当同一个函数被并行调用,且结果完成顺序与调用顺序不一致,
或持久化历史被重新加载时,结果可能与错误的调用配对。
方案
将 Gemini ID 保留到
schema.ToolCall.ID和schema.FunctionToolCall.CallID,并通过FunctionCall.id与FunctionResponse.id原样回传。对于不返回 ID 的旧模型或旧网关,继续使用兼容行为:适配器生成唯一 UUID,
并由 Eino 在工具结果中携带该值。
决策
核心认知
Gemini 的函数名表示“执行什么”,opaque call ID 表示“结果属于哪一次调用”。
同名函数并发执行时,两者不能互相替代。
总结