Skip to content

Fix Google Gemini Pro 2.5 API integration #404

Open
@sladwig

Description

@sladwig

Issue Description

When trying to use the Google Gemini Pro 2.5 model, we're getting API errors related to the JSON schema format:

GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-2.5:generateContent: [400 Bad Request] Invalid JSON payload received. Unknown name "additionalProperties" at "tools[0].function_declarations[0].parameters": Cannot find field.
Invalid JSON payload received. Unknown name "$schema" at "tools[0].function_declarations[0].parameters": Cannot find field.

The Google Gemini API appears to reject certain JSON Schema fields that we're sending, specifically:

  • $schema field
  • additionalProperties field

These fields are valid in JSON Schema but not accepted by Google's API implementation.

Steps to Reproduce

bun run build && bun run bin/cli.js --provider google --model gemini-pro-2.5 "Hi"

Expected Behavior

The CLI should successfully connect to the Google Gemini Pro 2.5 model and receive a response.

Proposed Solution

We need to modify the tool schema conversion for Google models to remove the unsupported fields from the JSON schema before sending it to the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions