Skip to content

docs(py): Genkit 1.0 API review - #6778

Closed
huangjeff5 wants to merge 45 commits into
mainfrom
chore/py-1.0-api-review
Closed

huangjeff5 wants to merge 45 commits into
mainfrom
chore/py-1.0-api-review

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds py/engdocs/genkit_1_0_api_review.md: the Python surface we plan to ship as 1.0, mostly as snippets, for API review.

It describes the state after the open API PRs land, not main today: #6697, #6698, #6699, #6709, #6757, #6764–#6770, #6775, #6777, #6314, #6655.

What's in it

  • Public API surface: every public module's exports, grouped, one comment per cluster.
  • Generation: structured output, reading message parts, streaming, streamed tool chunks (partial tool responses and tool.stream()), interrupts, typed Gemini refs and flat config, background models.
  • Mid-turn error recovery: a failed turn keeps its history; restart from response.messages.
  • Flows: typed input/output and typed stream chunks.
  • Web serving: four levels of control (serve_flow, handle_genkit_request, to_sse, genkit.web helpers), per-tenant keys through context.secrets, PublicError vs internal error redaction.
  • Telemetry with genkit_otel, embedders, evaluators, middleware (A2UI Surfaces), and the runtime architecture.

@github-actions github-actions Bot added docs Improvements or additions to documentation python Python chore labels Oct 12, 2026

@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 introduces the Genkit 1.0 API Review document for Python, detailing the public API surface, model generation, error recovery, flows, web serving, telemetry, and runtime architecture. The review feedback highlights a recurring issue across multiple code snippets where StreamResponse objects (from ai.generate_stream, deploy_service.stream, and quarterly_report.stream) are directly used as async iterables. Since StreamResponse does not implement __aiter__ or __anext__, these snippets should be updated to iterate over the .stream property instead.

Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
huangjeff5 and others added 3 commits October 12, 2026 05:48
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Comment thread py/engdocs/genkit_1_0_api_review.md Resolved
huangjeff5 and others added 20 commits October 12, 2026 11:47
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Background models return Operation[ModelResponse]; example builds a
  ModelResponse and reloads a stored handle.
- Explain genkit.exp.Genkit as the experimental subclass.
- Mid-turn recovery: pass the Failure value to a handler; clarify that
  except GenkitError only catches setup errors.
- Typed evaluator options (per-row and batch) and embedder options.
- Interrupt resume takes a single Part; streaming uses stream.stream.
- Drop the streamed-chunk tradeoffs and the ASCII runtime diagram.
- Veo 3.1 model id; enum annotations print values.
# => Total tokens: 34
```

### Streaming Structured Output: Typed Partials (feedback wanted)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Feedback wanted here

@huangjeff5

Copy link
Copy Markdown
Contributor Author

Closing as approved by Lahiru; Genkit 1.0 Python API review and implementation migrated to genkit-ai/genkit-python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore docs Improvements or additions to documentation python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant