Skip to content

[BUG] Gemini provider sends incorrect max_tokens parameter #386

@SequentialDesign

Description

@SequentialDesign

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

When using the Gemini provider, the gem sends a payload with max_tokens, which is invalid for the Gemini API. This results in the error: LLM API error: Invalid JSON payload received. Unknown name "max_tokens": Cannot find field. The correct parameter for Gemini is maxOutputTokens nested inside generationConfig

How to reproduce

use max_tokens with Gemini

Expected behavior

i expect max_tokens to be correctly translated to maxOutputTokens

What actually happened

i got a max_tokens error

Environment

Ruby 3.2.2 (rbenv shim)
Latest
Gemini
Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions