docs(python): Update package names and imports for 0.8.0 SDK reorganization#309
docs(python): Update package names and imports for 0.8.0 SDK reorganization#309huangjeff5 wants to merge 3 commits into
Conversation
…zation Updated all Python documentation pages and code snippets to reflect the 0.8.0 reorganization. Replaced all legacy 'genkit-plugin-*' package names with the new 'genkit-*' names and migrated all import statements from 'from genkit.plugins.<name>' to the flat 'import genkit_<name>'. Regenerated all language-specific pages cleanly using generate-language-pages.
There was a problem hiding this comment.
Code Review
This pull request updates the Python documentation across various guides to reflect the renaming of Genkit plugins (e.g., from genkit-plugin-google-genai to genkit-googleai) and their corresponding imports. Additionally, it introduces a comprehensive guide on using and building middleware in Python. The review feedback suggests a minor improvement in the middleware documentation to use the FinishReason enum instead of a raw string literal for checking if a response was interrupted, ensuring better type safety and consistency.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| from genkit import Genkit, restart_tool | ||
| from genkit_middleware import ToolApproval | ||
|
|
||
| ai = Genkit(...) | ||
|
|
||
| # 1. Initial attempt | ||
| response = await ai.generate( | ||
| prompt='write a file', | ||
| tools=[write_file_tool], | ||
| use=[ | ||
| ToolApproval(allowed_tools=[]) # Empty list means all tool calls trigger interrupt | ||
| ] | ||
| ) | ||
|
|
||
| if response.finish_reason == 'interrupted': |
There was a problem hiding this comment.
For consistency with other documentation pages (such as the interrupts guide) and to ensure robust type safety, it is recommended to import and use the FinishReason enum instead of comparing response.finish_reason to a raw string literal.
from genkit import FinishReason, Genkit, restart_tool
from genkit_middleware import ToolApproval
ai = Genkit(...)
# 1. Initial attempt
response = await ai.generate(
prompt='write a file',
tools=[write_file_tool],
use=[
ToolApproval(allowed_tools=[]) # Empty list means all tool calls trigger interrupt
]
)
if response.finish_reason == FinishReason.INTERRUPTED:
…/fastapi/flask conflicts
This PR coordinates the documentation updates for the Genkit Python SDK
0.8.0package renaming and namespace flattening.What This PR Does:
src/content/docs/docs/to use the new package naming pattern and flat import statements.genkit-plugin-<name>withgenkit-<name>(e.g.,genkit-plugin-google-genai->genkit-googleai,genkit-plugin-compat-oai->genkit-openai).from genkit.plugins.<name> import ...toimport genkit_<name>/from genkit_<name> import ....pnpm generate-language-pages) to successfully regenerate all language-specific pages underpython/with 0 compilation or link-resolution errors.