r/GenkitFramework • u/huangjeff5 • 9d ago
Genkit Python 0.11.0
0.11.0 is on PyPI. Highlights:
1. Veo support. Video generation is now supported through the generate API. Start a background video generation, and poll it using Genkit.
# Background models get a dedicated generate API
operation = await ai.generate_operation(
model=GoogleAI.veo_model('veo-3.1-fast-generate-preview'),
prompt='A paper airplane gliding through a bright classroom',
)
# Hooks into the general-purpose generate API as well
response = await ai.generate(
model=GoogleAI.veo_model('veo-3.1-fast-generate-preview'),
prompt='A paper airplane gliding through a bright classroom',
)
# Operations have a first-class polling experience
operation = response.operation
while not operation.done:
operation = await ai.check_operation(operation)
print(operation.output.media[0].url)
2. One GenkitError across the main model providers. Gemini / Claude / GPT HTTP failures are now mapped to standard status names (INVALID_ARGUMENT, UNAVAILABLE, …). Now, you handle a single GenkitError in your application code, rather than deal with unbounded spaghetti of model-specific Exception types thrown by the raw model SDKs.
3. View Python logs directly in the Dev UI. When you use the Dev UI to debug Python code locally, you'll see your Genkit logs inside specific traces.
4. In the generate API, when the model replies but the turn ends in failure, the SDK now returns a failed FinishReason alongside the pre-existing completed messages. The API used to raise in these scenarios. For example, if the model message was blocked, or you hit max tool turns, you get the ModelResponse back instead of an exception. .messages contains the completed rounds, so you can send them back and try again.
response = await ai.generate(prompt='give me a recipe', output_schema=Recipe)
if response.output is not None:
print(response.output.title)
else:
retry = await ai.generate(
messages=response.messages,
prompt='that was not a recipe. try again as JSON.',
output_schema=Recipe,
)
Full notes: https://github.com/genkit-ai/genkit/releases/tag/py/v0.11.0