Skip to content

[FEATURE] Support Gemini's Different API versions #443

@thefishua

Description

@thefishua

Scope check

  • This is core LLM communication (not application logic)
  • This benefits most users (not just my use case)
  • This can't be solved in application code with current RubyLLM
  • I read the Contributing Guide

Due diligence

  • I searched existing issues
  • I checked the documentation

What problem does this solve?

From Gemini API documentation https://ai.google.dev/gemini-api/docs/api-versions there are currently two versions v1 and v1beta. In the RubyLLM project the default api version is v1beta which is considered a early-access version of the Gemini API that shouldn't be utilised for production code.

The way I found this issue was when trying to use the model gemini-1.5-flash-8b which is not support in the v1beta api version.

Proposed solution

A proposed solution is to add the configuration instance variable @config.gemini_api_base to lib/ruby_llm/providers/gemini.rb. A suggested solution:

def api_base
  @config.gemini_api_base || 'https://generativelanguage.googleapis.com/v1beta'
end

Why this belongs in RubyLLM

This belongs in RubyLLM as would be good for developers/users to switch between the default Gemini api base url to different versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions