Repository navigation
Conversation
Add a provider-independent incremental Server-Sent Events decoder (event/data fields, multi-line data, CRLF/CR/LF, chunk boundaries) and switch the Gemini provider's inline frame parsing to it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Riffer::Providers::GoogleCloud::Client is a Net::HTTP transport for
Vertex AI (Gemini Enterprise Agent Platform), modelled on
Gemini::Client. It is bound to one project and location, derives the
endpoint from the location (global, us/eu multi-region, or regional),
and authenticates with a googleauth credentials object, defaulting to
Application Default Credentials shared process-wide.
googleauth's metadata-server path (GCE, Cloud Run, GKE) runs through
google-cloud-env's process-wide LazyValue cache, which detects
reentrancy by Thread: concurrent fibers refreshing a token raise
ThreadError ("deadlock: tried to call LazyValue#get from its own
computation"), hidden by googleauth's retries until latency surfaces it
as Google::Auth::AuthorizationError. Token access is serialized behind
one fiber-aware Mutex, and apply! refreshes only a missing or
near-expiry token, so concurrent fibers share a single refresh.
googleauth is an optional dependency, added to the Gemfile and loaded
with depends_on only on the ADC path.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Riffer::Providers::GoogleCloud (provider key google_cloud, semconv gcp.vertex_ai) serves Gemini models on Vertex AI. Vertex accepts the same generateContent body as the Gemini Developer API, so the provider subclasses the Gemini provider and swaps only the transport and the publishers/google/models resource path. Model ids may carry an @Version suffix. Configured through Riffer.config.google_cloud: project_id, location (default "global"), credentials (default ADC) and client (instance or Proc). Tags are not mapped to Vertex labels yet. The VCR tests await cassettes recorded with real credentials; the helper filters the access token and project id. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add docs/providers/GOOGLE_CLOUD.md (Gemini models for now) with its site manifest entry, and list the provider wherever the others appear. The page calls out that the default "global" location carries no data-residency guarantee and shows how to bind a location through config.google_cloud.client or a per-location provider subclass. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
google_cloudprovider for Gemini models on Google Cloud Vertex AI (now called Gemini Enterprise Agent Platform).Why not the official gem
google-cloud-ai_platform-v1is the only official Ruby gem, and neither of its transports works well under fibers:breakorAsync::Stop.This provider instead uses its own Net::HTTP client, like
Gemini::Client, withgoogleauthfor tokens. Vertex's Gemini request/response JSON matches the Gemini Developer API, soGoogleCloudsubclassesGeminiand only changes the transport and URL paths.Fiber-safe auth
On Cloud Run, GKE and GCE,
googleauthgets tokens throughgoogle-cloud-env, which spots re-entry by comparingThread.current. When several fibers refresh a token at once, it raises a falseThreadError: deadlock. The client puts everygoogleauthcall behind a process-wideMutex, which works per fiber, and shares one set of Application Default Credentials (ADC) across clients.Checked against a fake metadata server, 5 concurrent fibers:
A unit test fails if the lock is removed.
Regions
Location is set on the client. The default is
"global", and the docs say plainly that it has no data-residency guarantee. They show how to bind a location with aconfig.google_cloud.clientProc or with a provider subclass per location.Commits
Riffer::Wire::SSE, a shared SSE decoder that Gemini now uses.GoogleCloud::Clientwith fiber-safe token refresh.google_cloudprovider for Gemini models, with VCR cassettes recorded against a real project.Follow-ups
feat/google-cloud-claude. It's waiting on Model Garden access to record cassettes.labels.gs://files by URL.🤖 Generated with Claude Code