Skip to content

docs(py): check res.error for provider failures in the 0.12 migration guide - #7110

Closed
huangjeff5 wants to merge 1 commit into
mainfrom
huangjeff/py-provider-error-check
Closed

huangjeff5 wants to merge 1 commit into
mainfrom
huangjeff/py-provider-error-check

Conversation

@huangjeff5

Copy link
Copy Markdown
Contributor

ai.generate returns provider failures on res.error instead of raising (TURN_FAILURES in _ai/_generate.py), so the migration guide's except GenkitError snippet never fires for an unreachable provider. This updates that snippet and the Ollama README's matching prose. It also fixes the _tracing.py docstring for the default metric export interval, which is 300000ms (DEFAULT_METRIC_EXPORT_INTERVAL_MS), not 60000ms.

Before (migrating-from-0.12.md):

except GenkitError as e:
    if e.status == 'UNAVAILABLE': ...

After:

res = await ai.generate(model=m, prompt=p)
if res.error and res.error.status == 'UNAVAILABLE': ...

Verified against GoogleAI, Anthropic, OpenAI, and Ollama pointed at a closed port: each returns res.error.status == 'UNAVAILABLE' without raising.

@github-actions github-actions Bot added docs Improvements or additions to documentation python Python labels Nov 6, 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 updates documentation and docstrings to reflect changes in error handling and configuration defaults. Specifically, the migration guide and Ollama plugin README are updated to show that connection errors are now returned via res.error instead of raising a GenkitError. Additionally, the telemetry tracing docstring is updated to change the default metric export interval from 60,000ms to 300,000ms. There are no review comments, and I have no feedback to provide.

@huangjeff5

Copy link
Copy Markdown
Contributor Author

Closing: migrated to standalone repository genkit-ai/genkit-python (PR #40): genkit-ai/genkit-python#40

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

Labels

docs Improvements or additions to documentation python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant