docs(py): upgrade plugin docstrings to landing-page hero style with inline return shapes - #5650
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new docstring style guide (SKILL.md) for Genkit Python packages, mandating the "Landing Page Hero Snippet" pattern. This pattern focuses on clean, product-oriented code examples with numbered steps and inline return shape annotations (# =>), while removing verbose ELI5 explanations and ASCII diagrams. Accordingly, docstrings across multiple packages (including genkit-anthropic, genkit-django, genkit-fastapi, genkit-flask, genkit-googleai, genkit-googlecloud, genkit-middleware, genkit-ollama, genkit-openai, and genkit-vertexai) have been refactored to align with this style. The review feedback correctly identifies several bugs in the newly introduced code examples, such as incorrect attribute access on evaluation results, long-running operations, and media parts, which would lead to AttributeErrors at runtime.
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.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request streamlines and simplifies the module-level docstrings across multiple Genkit Python packages by removing large ASCII diagrams, ELI5 explanations, and complex architecture overviews. These are replaced with concise descriptions, updated requirements, and cleaner, more practical code examples. The feedback points out a missing asyncio import in the veo.py example code block, which is necessary to make the snippet fully functional and copy-pasteable.
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.
a7c93ba to
8580b26
Compare
…e snippets across plugins
…-page hero style with inline shapes and clean multi-line comments
…with landing-page hero snippets
…a part attribute access in docstrings
9496af6 to
71c998a
Compare
hilariie
left a comment
There was a problem hiding this comment.
The snippets read well, but some snippets still require implementation support. For example
-
Flask:
genkit_flask_handler(ai)returns a decorator; the current form passes the flow ascontext_providerand returns the decorator as the response. Real usage is the stacked@app.post(...)/@genkit_flask_handler(ai)/@ai.flow() form. -
Ollama does not accept string model definitions: models= is list[ModelDefinition]; strings hit AttributeError on .name. Either wrap in ModelDefinition(name=...) or (preferably) teach the plugin to accept strings so the snippet stays clean.
-
Model Garden: models register under modelgarden/, not vertexai/, and only when passed via models=[...]. modelgarden/claude-3-5-sonnet-v2 with an explicit models list resolves; vertexai/... never will.
-
Veo/Lyria route through the wrong path: Veo is a background model (start/check action pair), so ai.generate(...) isn't the invocation path. Lyria is Vertex-only predict-based audio with the same concern.
Since these are presented as runnable examples, could we either land the supporting changes first in an implementation PR, tracked by an issue, and rebase this PR onto it, or include the fixes here to avoid publishing these snippets before the behavior exists. If this is intended as follow-up work, could we link the tracking issue here and make the release ordering explicit?
Address review feedback on #5650: correct Flask decorator stacking, Ollama lazy model resolve, and Model Garden namespace; drop Veo/Lyria snippets that do not run on this branch yet.
|
Thanks for the review @hilariie! We've updated the docstring examples across this PR so that every snippet reflects APIs that run on this branch today, without relying on unmerged follow-up PRs:
The fixes have been pushed to |
Description
As part of PR stack #3 (branched off PR #2
reorg/py-plugins), this pull request audits all Genkit Python plugin and core packages to replace verbose ELI5 explanations and ASCII data-flow diagrams with professional, product-oriented landing-page hero snippets.Key highlights:
genkit-docstring-styleskill defining required code block formatting.# 1. ...,# 2. ...,# 3. ...comments guiding developers through initialization and execution.# =>): Illustrates expected response shapes directly inline without requiring execution.#lines without escape codes like\n.googleai/gemini-flash-latest,googleai/gemini-pro-latest, orvertexai/...equivalents across generation snippets.Base Branch
Branches off of and targets
reorg/py-plugins(#5644).