Skip to content

Conversation

@NielsKSchjoedt
Copy link

@NielsKSchjoedt NielsKSchjoedt commented Jan 3, 2026

Problem

When configuring RubyLLM with vertexai_location: "global", the VertexAI provider incorrectly constructs the API URL as https://global-aiplatform.googleapis.com/v1beta1. This hostname does not exist, causing requests to fail with a 404 error.

According to the Google Cloud Vertex AI documentation, the global endpoint should use the base hostname https://aiplatform.googleapis.com/v1beta1 without a location prefix.

Solution

Updated RubyLLM::Providers::VertexAI#api_base to handle "global" as a special case:

  • Global: Returns https://aiplatform.googleapis.com/v1beta1
  • Regional: Continues to return https://{location}-aiplatform.googleapis.com/v1beta1 (e.g., us-central1)

Changes

  • Modified lib/ruby_llm/providers/vertexai.rb to conditionally build the base URL.
  • Added spec/ruby_llm/providers/vertexai_spec.rb to verify the URL construction logic for both global and regional configurations.

Verification

  • Added unit tests confirming correct URL generation for global vs us-central1 locations.

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