feat(ai): add Google Vertex AI provider#6388
Open
tuttarealstep wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: 3139732 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5 tasks
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.
Type
Description
Hi, for a personal project I needed google vertex, so i added a package to the repo "@effect/ai-google-vertex" this work like anthropic/openai... packages.
This pr adds:
@effect/ai-google-vertexpackage, implementing:LanguageModelandEmbeddingModelon top of the Vertex AI REST API (generateContent,streamGenerateContent...)google-auth-library(serviceaccounts)
GoogleSearch,UrlContext, andCodeExecutiontoolsSmall playground and example output
Output:
MODEL: gemini-2.5-flash EMBEDDING_MODEL: text-embedding-005 === 1. Text generation === Functional programming is a paradigm where programs are constructed by applying and composing pure functions, avoiding shared state and mutable data. This approach emphasizes immutability and side-effect-free operations, leading to more predictable, testable, and concurrent code. finishReason: stop usage: Usage { inputTokens: { uncached: 7, total: 7, cacheRead: 0, cacheWrite: undefined, }, outputTokens: { total: 272, text: 49, reasoning: 223, }, "~effect/Schema/Class/effect/ai/AiResponse/Usage": [Getter], toString: [Function: toString], pipe: [Function: pipe], } === 2. Text streaming === The *Sea Serpent* cut through the obsidian waters, a sturdy speck beneath a sky stitched with a million indifferent stars. Elias Thorne, captain and owner, gripped thehelm, his face a roadmap of salt and sun. Beside him, Finn, his young deckhand, fiddled with the radio, complaining about the static. "Atmospherics," Elias grunted, his gaze sweeping the horizon. "Or something else." Finn scoffed. "Always ‘something else’ with you, Cap. Just a bad signal." Then, the air grew thick, not with fog, but with an unnatural hush. The familiar thrum of the engine seemed to recede, and the slosh of waves against the hull became muted, as if the sea itself held its breath. The compass needle, usually steady as a seasoned sailor, began to spin a frantic, directionless jig. Finn’s radio crackled and died, emitting a faint, high-pitched whine. "What in the..." Finn started, his voice trailing off as Elias pointed, a single, gnarled finger, into the darkness ahead. At first, it was just a deeper shade of night, a void in the void. But as it drew closer, it resolved into the impossible shape of a ship. It was vast, ancient, yet utterly silent. No lights glimmered from its portholes, no anchor chains clanked, no creak of timbers disturbed the profound silence it carried with it. Its hull, craftedfrom what appeared to be pure shadow, absorbed the starlight, leaving a gaping hole in the visible spectrum. Its sails, impossibly tattered yet perfectly taut, were woven from mist and starlight, shifting like smoke in a phantom breeze. They billowed not with wind, but with an unseen energy, propelling the vessel forward with a grace that defied its immense mass. There was no wake, no disturbance on the water’s surface, as if it merely passed *through* the sea, rather than upon it. A cold seeped into their bones, not from the wind, but from within, a chill that carried the scent of forgotten ages and the weight of unspoken grief. Finn stammered, "It's... it's not real, Cap. My eyes are playing tricks." Elias said nothing, his eyes wide, fixed on the approaching apparition. He’d heard the legends, whispered in dimly lit taverns by old salts with trembling hands: the Shadow Ship, the Ghost of the Tides, a vessel lost to time, doomed to wander the endless currents. Some said it carried the souls of sailors who died alone, others that it was the sea’s own mournful heart given form. The Shadow Ship passed them by, gliding impossibly close. They could almost reach out and touch its spectral timbers. For a moment, the world shrank to just their tinyfishing boat and that colossal, silent leviathan. They felt a profound emptiness emanating from it, a silent song of eternal voyage. They saw no crew, no figures on the deck, only the silent, gaping maw of its shadow-draped form. Then, as swiftly and silently as it had appeared, it was gone. It didn't sail over the horizon; it simply faded, melting back into the darkness, leaving no trace, no lingering cold, no ripple on the water. The compass needle slowly settled, the radio crackled back to life, spitting out static, and the familiar drone of the *Sea Serpent*'s engine returned. Finn collapsed onto a crate, breathing heavily. "What was that?" Elias just stared at the empty expanse where the ship had been. He’d seen many strange things in his years at sea, but nothing had ever so profoundly shaken the foundations of his world. "Some things," he said, his voice hoarse, "aren't meant to be understood, Finn. Just... seen." They continued their fishing, but the night felt different, the stars a little colder, the sea a little deeper. And though they never saw the Shadow Ship again, both men carried the indelible imprint of its passing—a silent, chilling reminder of the vast, unfathomable mysteries that truly lurked beneath the surface of the world. [finish: stop] === 3. Tool calling === [tool] get_weather called for: Rome [step 1] the model called 1 tools, continuing... The weather in Rome today is sunny with a temperature of 22 degrees Celsius. === 4. Structured output === { "name": "Simple Spaghetti Carbonara", "servings": 2, "ingredients": [ "200g spaghetti", "100g guanciale (or pancetta/bacon)", "2 large egg yolks", "1 whole large egg", "50g Pecorino Romano cheese, grated", "Freshly ground black pepper", "Salt for pasta water" ], "steps": [ "Cook spaghetti in a pot of generously salted boiling water until al dente.", "While pasta cooks, dice the guanciale and fry in a pan over medium heat until crispy. Remove from heat, leaving the rendered fat in the pan.", "In a bowl, whisk together the egg yolks, whole egg, grated Pecorino Romano, and a generous amount of black pepper.", "Before draining, reserve about 1/2 cup of pasta cooking water.", "Drain the spaghetti and immediately add it to the pan with the guanciale and its fat. Toss quickly.", "Pour the egg mixture over the pasta, stirring vigorously to coat. Add a tablespoon or two of the reserved pasta water to create a creamy sauce. Continue stirring until the sauce emulsifies and thickens.", "Serve immediately with extra Pecorino Romano and black pepper." ] } === 5. Embeddings === dimensioni: 768 primi 5: [ 0.00021459400886669755, -0.02994261123239994, 0.032815590500831604, -0.03095276840031147, 0.0072927456349134445 ] numero embeddings: 3 [0] dim=768 [1] dim=768 [2] dim=768 === 6. Google Search grounding === The most recent Formula 1 Grand Prix was the British Grand Prix, held on July 5, 2026. Charles Leclerc, driving for Ferrari, emerged as the victor in this event. Fonti: - formula1.com: https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEyNE3z58STyc_slX5cuxESJsBo0jlnfJXTKSvYCEtt_MIdHvvAGnvCCO0V6Dwi9F1-B9lW1YoPGq_d8dS_BsS7KlHMOf5ohThq8e4Kba3F4jfir3SpQYllK8msP9AiP7GYnXxBh573cRo-xjjbm4iNszuqNeySkc9ZnTzUq25gyFy30YkT5DynPSaPP5a4Oe7PXYFFkQDVWRbc7lt9he_7vC1SAQPRz_4q4HLBJj9o2J-yh-2zp_0y4bbWDp-mLKrAdsvpbbEZmOeAkQMnJqlpmLJLZgDTD46e0iY= - gridguy.racing: https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQF_Or-GX5P7WuqGKeP-9DC419NjBqw5n_JE0GM0I58ido-HMyehxIMT54ZrmSlFgdIuWxYF_Tibiy2PUBugKNaX2gn2hWA_OaCdE0dSDrPmJVp-u1U3YRkvBajEUCDizWzqz3ynqw==