Skip to content

docs(python): Update package names and imports for 0.8.0 SDK reorganization#309

Open
huangjeff5 wants to merge 3 commits into
mainfrom
reorg/py-docs
Open

docs(python): Update package names and imports for 0.8.0 SDK reorganization#309
huangjeff5 wants to merge 3 commits into
mainfrom
reorg/py-docs

Conversation

@huangjeff5

Copy link
Copy Markdown
Collaborator

This PR coordinates the documentation updates for the Genkit Python SDK 0.8.0 package renaming and namespace flattening.

What This PR Does:

  1. Source Documentation Migration:
    • Migrated all Python-related documentation source files under src/content/docs/docs/ to use the new package naming pattern and flat import statements.
    • Replaced all instances of genkit-plugin-<name> with genkit-<name> (e.g., genkit-plugin-google-genai -> genkit-googleai, genkit-plugin-compat-oai -> genkit-openai).
    • Replaced all import statements from from genkit.plugins.<name> import ... to import genkit_<name> / from genkit_<name> import ....
    • Covered pages including Django, FastAPI, Flask, Anthropic, Google GenAI, Ollama, Vertex AI, Google Cloud, and OpenAI-Compatible.
  2. Page Regeneration:
    • Ran the Astro language page generator script (pnpm generate-language-pages) to successfully regenerate all language-specific pages under python/ with 0 compilation or link-resolution errors.

…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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +699 to +713
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':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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:

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.

1 participant