Skip to content

Conversation

@multiplegeorges
Copy link

What this does

This pull request adds support for authenticating to Google Vertex AI using a Service Account JSON key in addition to the existing Application Default Credentials (ADC) method. It updates both the documentation and the implementation to allow users to provide a Service Account key for Vertex AI authentication, improving flexibility and compatibility with Google Cloud best practices.

Vertex AI Authentication Enhancements:

  • Added a new configuration option vertexai_service_account_key to the RubyLLM configuration, allowing users to specify a Service Account JSON key as a string for Vertex AI authentication. [1] [2] [3]
  • Updated the Vertex AI provider logic to use the Service Account key for authentication if provided; otherwise, it falls back to Application Default Credentials (ADC). This includes refactoring the authorizer initialization to support both methods and defining the required OAuth scopes. [1] [2]

Documentation Updates:

  • Expanded the configuration documentation to explain the new vertexai_service_account_key option, how authentication works, and Google Cloud’s recommendations regarding API keys and Service Accounts.

Test/Spec Configuration:

  • Updated the test configuration to include a default value for vertexai_service_account_key, ensuring test environments can utilize the new authentication method.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • [x ] I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
    • For provider changes: Re-recorded VCR cassettes with bundle exec rake vcr:record[provider_name]
    • All tests pass: bundle exec rspec
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

Related issues

None.

…ation logic

- Added `vertexai_service_account_key` to the configuration requirements for Vertex AI.
- Updated the authorization method to use service account credentials if the key is provided, otherwise defaults to application default credentials.
@multiplegeorges
Copy link
Author

Looks like #520 is making related changes to the Vertex provider, so probably a good idea to review both in tandem/together.

@crespire
Copy link

+1, could use this!

@Kcharle
Copy link

Kcharle commented Dec 10, 2025

+1

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.

3 participants