Skip to content

Conversation

bennapp
Copy link

@bennapp bennapp commented Jul 1, 2025

tool_calls would return nil for gemini if the response contained parts that had a text response as the first part but then subsequent tool_calls. Now, we fix that by checking if any of the parts of a functionResponse.

This handles a response like this:

{
  "candidates": [
    {
      "content": {
        "parts": [
          {"text": "Let's add those numbers"},
          {
            "functionCall": {
              "name": "calculator__execute",
              "args": {"input": "2+2"}
            }
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": []
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant