Module: LLM::Google::Utils
- Defined in:
- lib/llm/providers/google/utils.rb
Instance Method Summary collapse
-
#tool_id(part:,
cindex:, pindex:) ⇒ String
Returns a stable internal tool-call ID for Gemini function calls.
Instance Method Details
#tool_id(part:, cindex:, pindex:) ⇒ String
Returns a stable internal tool-call ID for Gemini function calls.
Gemini responses may omit a direct tool-call ID, but llm.rb expects one for matching pending tool calls with tool returns across streaming and normal completion flows.
When Gemini provides a thoughtSignature, that
value is used as the basis for the ID. Otherwise the ID falls
back to the candidate and part indexes, which are stable within
the response.
24 25 26 27 28 |
# File 'lib/llm/providers/google/utils.rb', line 24 def tool_id(part:, cindex:, pindex:) signature = part["thoughtSignature"].to_s return "google_#{signature}" unless signature.empty? "google_call_#{cindex}_#{pindex}" end |