Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/migrating-from-0.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ except GenkitError as e:

## Plugin exception types

Plugin-specific exceptions such as `OllamaConnectionError` are gone. Check the status instead.
Plugin-specific exceptions such as `OllamaConnectionError` are gone. Check the failure's `status` instead: `ai.generate` returns the failure on `res.error`, and `ai.embed` raises it as a `GenkitError`.

**Old:**

Expand All @@ -566,8 +566,13 @@ except GenkitError as e:
**New:**

```python
except GenkitError as e:
if e.status == 'UNAVAILABLE': ...
res = await ai.generate(model=m, prompt=p)
if res.error and res.error.status == 'UNAVAILABLE': ...
Comment thread
huangjeff5 marked this conversation as resolved.
Resolved

try:
await ai.embed(embedder=e, content=doc)
except GenkitError as err:
if err.status == 'UNAVAILABLE': ...
```

## Interrupts and except Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def enable_google_cloud_telemetry(
``GenAiInstrumentation`` is still installed. Metrics and logs may
still be exported. Defaults to False.
metric_export_interval_ms: Metrics export interval in milliseconds.
GCP requires a minimum of 5000ms. Defaults to 60000ms.
GCP requires a minimum of 5000ms. Defaults to 300000ms (5000ms when ``GENKIT_ENV=dev``).
metric_export_timeout_ms: Timeout for metrics export in milliseconds.
Defaults to the export interval if not specified.

Expand Down
9 changes: 5 additions & 4 deletions packages/genkit-ollama/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ embedders.

### Troubleshooting

If the plugin can't reach the server it raises a `GenkitError` with status
`UNAVAILABLE` and the URL it tried (`DEADLINE_EXCEEDED` if the request timed
out). Start the daemon (`ollama serve`) or set `base_url` to a reachable
host.
If the plugin can't reach the server, the failure has status `UNAVAILABLE`
and the URL it tried (`DEADLINE_EXCEEDED` if the request timed out).
`ai.generate` returns it on `res.error`; `ai.embed` raises it as a
`GenkitError`. Start the daemon (`ollama serve`) or set `base_url` to a
reachable host.

## Sample

Expand Down
Loading