From 10d02b5376e276550f0a68c19531d06dfb13c62f Mon Sep 17 00:00:00 2001 From: Ian Sefferman Date: Fri, 13 Jun 2025 09:21:12 -0400 Subject: [PATCH] Improve the check to determine whether a functionCall exists --- lib/langchain/llm/response/google_gemini_response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/langchain/llm/response/google_gemini_response.rb b/lib/langchain/llm/response/google_gemini_response.rb index 3a974d663..5d8e6c692 100644 --- a/lib/langchain/llm/response/google_gemini_response.rb +++ b/lib/langchain/llm/response/google_gemini_response.rb @@ -15,7 +15,7 @@ def role end def tool_calls - if raw_response.dig("candidates", 0, "content") && raw_response.dig("candidates", 0, "content", "parts", 0).has_key?("functionCall") + if raw_response.dig("candidates", 0, "content", "parts", 0) && raw_response.dig("candidates", 0, "content", "parts", 0).has_key?("functionCall") raw_response.dig("candidates", 0, "content", "parts") else []