Skip to content

chore: release v0.15.0 - #277

Merged
huangjeff5 merged 2 commits into
mainfrom
release/v0.15.0
Dec 3, 2026
Merged

huangjeff5 merged 2 commits into
mainfrom
release/v0.15.0

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Google Cloud backends now live directly inside genkit-anthropic and genkit-openai, and genkit-vertexai is deprecated for removal next release. Evaluators, deprecated in 0.14, are removed. This release also adds OpenAICompatible for third-party and local servers, native Mistral support, and pre-1.0 response and error fixes across genkit-google-genai and genkit-a2ui. Anthropic and OpenAI model catalogs are refreshed, and declared dependency floors now match the lowest versions tested in CI.

uv add --upgrade genkit  # plus any plugins you use, e.g. genkit-google-genai
# or: pip install --upgrade genkit

Connect third-party and local servers with OpenAICompatible and Mistral

genkit-openai adds OpenAICompatible for connecting OpenRouter, Together, Groq, vLLM, LiteLLM, or local servers under their own namespace (#258). Each instance registers chat models and embedders under <name>/<id>, forwards model IDs verbatim without stripping provider prefixes, and discovers models dynamically from /models, letting you run multiple servers alongside OpenAI(). api_key accepts a string, an async callable for rotating tokens, or None for keyless local servers, and never reads ambient OPENAI_API_KEY.

Mistral() (equivalent to OpenAI(provider='mistral')) registers Mistral's model catalog under mistral/ and reads MISTRAL_API_KEY (#123). It translates Genkit options to Mistral's wire fields (random_seed, max_tokens, output_dimension) and round-trips thinking chunks as reasoning parts.

import os

from genkit import Genkit
from genkit_openai import Mistral, OpenAI, OpenAICompatible

# 1. Register third-party, local, and Mistral servers alongside OpenAI
openrouter = OpenAICompatible(
    name='openrouter',
    base_url='https://openrouter.ai/api/v1',
    api_key=os.environ['OPENROUTER_API_KEY'],
)
local = OpenAICompatible(name='local', base_url='http://localhost:8000/v1')

ai = Genkit(plugins=[OpenAI(), Mistral(), openrouter, local])

# 2. Model IDs pass through verbatim without stripping provider prefixes
res = await ai.generate(
    model=openrouter.model('openai/gpt-4o'),
    prompt='Name a neighborhood bakery.',
)
print(res.text)
# => Hearth & Crumb Bakery

# 3. Mistral translates seed and reasoning_effort to Mistral wire fields
mistral_res = await ai.generate(
    model=Mistral.model('mistral-small-latest'),
    prompt='List three gluten-free desserts.',
    config={'seed': 42, 'reasoning_effort': 'high'},
)
print(mistral_res.text)
# => 1. Flourless Chocolate Torte
# => 2. Vanilla Bean Panna Cotta
# => 3. Lemon Almond Polenta Cake

Run Claude and Model Garden open models on Google Cloud

Previously, running Claude or Model Garden open models on Google Cloud meant installing genkit-vertexai and using ModelGarden. That put Claude under a separate modelgarden/anthropic/... namespace, limited callers to string refs, and coupled .prompt files to Vertex (#257, #259, #260).

Anthropic(backend=GoogleCloud(...)) routes through AsyncAnthropicVertex (default location: 'global') while keeping the anthropic/ namespace, typed Anthropic.claude(...) refs, and AnthropicConfig identical to the direct API.

OpenAICompatible(backend=GoogleCloud(...)) targets the Vertex OpenAI endpoint (default location: 'us-central1'), refreshes Application Default Credentials (ADC) in a worker thread, and defaults to name='modelgarden' so existing modelgarden/<publisher>/<model> refs keep working. Both backends require the [google-cloud] extra and fail fast with FAILED_PRECONDITION—printing the gcloud auth application-default login command—when credentials or a project are missing.

# uv add 'genkit-anthropic[google-cloud]' 'genkit-openai[google-cloud]'
from genkit import Genkit
from genkit_anthropic import Anthropic, GoogleCloud as AnthropicGoogleCloud
from genkit_openai import GoogleCloud as OpenAIGoogleCloud, OpenAICompatible

# 1. Serve Claude from Google Cloud with the same refs and config as the direct API
claude = Anthropic(backend=AnthropicGoogleCloud(project='bistro-prod', location='global'))

# 2. Serve Llama, Mistral, and other Model Garden open models under modelgarden/<publisher>/<model>
garden = OpenAICompatible(backend=OpenAIGoogleCloud(project='bistro-prod', location='us-central1'))

ai = Genkit(plugins=[claude, garden])

# 3. Call Claude with typed refs
res = await ai.generate(
    model=Anthropic.claude('claude-sonnet-5-5'),
    prompt='Suggest a main course for a guest with a shellfish allergy.',
)
print(res.text)
# => Herb-Roasted Chicken with Lemon Rice

# 4. Call Model Garden open models with the same refs ModelGarden used
open_res = await ai.generate(
    model=garden.model('meta/llama-3.3-70b-instruct-maas'),
    prompt='Pair a non-alcoholic drink with herb-roasted chicken.',
)
print(open_res.text)
# => Sparkling Rosemary Lemonade

Return Gemini candidate metadata and coalesce streamed parts

genkit-google-genai had three pre-1.0 rough edges in Gemini and Vertex calls (#50). Replies dropped groundingMetadata, citationMetadata, logprobsResult, and safetyRatings from response.custom; streamed turns left response.message.content fragmented into one Part per chunk; and missing Vertex projects raised a bare ValueError that Retry middleware kept retrying.

One-shot and streamed Gemini calls now populate response.custom['candidates'][i], coalesce adjacent streamed text and reasoning fragments into whole Parts at stream end, and round-trip thoughtSignature across all part kinds. Missing Vertex projects raise GenkitError(status='FAILED_PRECONDITION') across Gemini, Veo, and Virtual Try-On so Retry stops immediately. Billed tokens from built-in tools (google_search, code_execution, url_context) now appear in usage.custom['toolUseTokens'] (#168).

from genkit import Genkit
from genkit_google_genai import GeminiConfig, GoogleAI

ai = Genkit(plugins=[GoogleAI()])

# 1. Candidate metadata lands at res.custom['candidates'][i]
res = await ai.generate(
    model=GoogleAI.gemini('gemini-flash-latest'),
    prompt='Cite recent FDA allergen labeling guidance for sesame.',
    config=GeminiConfig(google_search=True),
)
print(res.custom['candidates'][0]['groundingMetadata']['webSearchQueries'])
# => ['FDA sesame allergen labeling guidance']

# 2. Streamed turns coalesce into whole text parts at stream end
stream = ai.generate_stream(
    model=GoogleAI.gemini('gemini-flash-latest'),
    prompt='Describe a three-course winter tasting menu.',
)
final = await stream.response
print(len(final.message.content))
# => 1

Smaller things worth knowing

Before you upgrade

  • Evaluators are removed (feat(py)!: remove evaluators #278): genkit-evaluators, the genkit[evaluators] extra, genkit.evaluator, ai.define_evaluator, ai.define_batch_evaluator, ai.evaluate, and the Vertex AI evaluators in genkit-google-genai are gone, as announced in 0.14 (revert: restore evaluators for 0.14 #131).
    • If you still use evaluators, stay on 0.14. genkit-evaluators 0.14 requires genkit<0.15, so it keeps a plain pip install or uv lock on 0.14 until you uninstall it.
    • If genkit-evaluators is already installed in your environment, an in-place pip install -U genkit reports a dependency conflict. Any remaining import of genkit.evaluator on 0.15 raises ModuleNotFoundError with migration instructions.
    • If you pin genkit-google-genai below 0.14, raise the pin to at least 0.14. Older versions import genkit.evaluator unconditionally and fail on startup.
  • genkit-vertexai is deprecated (feat(py): deprecate genkit-vertexai; remove it in the next release #260): Still works in 0.15 with a FutureWarning on ModelGarden(...), but is capped at genkit<0.16 and will be removed next release. Move Claude to genkit-anthropic[google-cloud] with Anthropic(backend=GoogleCloud()), and move Model Garden open models to genkit-openai[google-cloud] with OpenAICompatible(backend=GoogleCloud()).
  • genkit-google-genai response and error shapes (fix(py/google-genai)!: keep candidate metadata, coalesce streamed parts, and fail fast without a Vertex project #50):
    • Streamed response.message.content coalesces adjacent text/reasoning fragments into whole Parts rather than one Part per chunk.
    • fileData reply parts arrive as media parts instead of empty text parts in both chunks and final messages.
    • custom.executableCode.language and custom.codeExecutionResult.outcome are now wire strings ('PYTHON', 'OUTCOME_OK') instead of google-genai enum members.
    • Multi-region VertexAI(...) (such as location='eu') without a project no longer raises ValueError at construction; the first call raises GenkitError(status='FAILED_PRECONDITION'). Per-request Veo and Virtual Try-On clients without a Vertex project also raise FAILED_PRECONDITION instead of INVALID_ARGUMENT.
  • genkit-a2ui wire key changed to messages (refactor(a2ui)!: carry A2UI messages under the spec's messages key #150): a2ui_part now writes {"messages": [...]} instead of {"envelopes": [...]} to match the A2UI spec. envelopes_from_parts(...) reads both keys (no change required if you use it), but code reading part.data['envelopes'] directly must switch to envelopes_from_parts(...) or part.data['messages'].
  • Mistral targets via genkit-openai (feat(py/openai): send Mistral's field names when base_url points at Mistral #123): Pointing OpenAI(base_url=...) at a Mistral host now registers models under mistral/<id> instead of openai/<id>, drops OpenAI's catalog, and reads MISTRAL_API_KEY instead of OPENAI_API_KEY. Move any Mistral key stored in OPENAI_API_KEY to MISTRAL_API_KEY or pass api_key=.
  • Raised minimum dependency floors (fix(py): enforce dependency bounds policy and raise declared floors #154, feat(py): add OpenAICompatible for any OpenAI-compatible server, matching JS and Go #258): Declared minimums now match the lowest versions tested in CI, and packages cap core/SDK dependencies at the next major version. Key bumps: openai>=1.106.0, anthropic>=0.98.0, google-genai>=2.17.0, ollama>=0.6.0, anyio>=4.12.0 (genkit-mcp), and opentelemetry-api/sdk>=1.39.0 + opentelemetry-exporter-gcp-logging>=1.12.0a0 (genkit-google-cloud).

@genkit-bot genkit-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Details

Run b33cbf4a-3464-41ea-bd8b-d738a2147ddf · Cloud Run logs · Dashboard

# Conflicts:
#	packages/genkit-evaluators/pyproject.toml
#	packages/genkit/pyproject.toml
#	uv.lock
@huangjeff5
huangjeff5 merged commit a12413f into main Dec 3, 2026
22 of 23 checks passed
@huangjeff5
huangjeff5 deleted the release/v0.15.0 branch December 3, 2026 18:58
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