Skip to main content

Module provider

Module provider 

Source
Expand description

The provider side: what a runner sends each provider for one item, and what the provider answers. Both starting providers share one shape (Cloudflare calls clef “fully Jev-API compatible”); CONTRACT.md cites the documentation each shape comes from.

One provider call carries one item’s state with every question of the batch. The runner maps the batch’s catalog id to the provider’s own model value (models) and forwards state, the questions and the images as the caller wrote them.

Modules§

catalog_ids
Catalog ids of the starting providers’ models: models.dev’s provider key, then /, then models.dev’s model id. The first / splits the two, so @ and any further / belong to the model id. Each pins a model version, never a moving alias.
clef_limits
clef’s limits on one request, from Cloudflare’s documentation.
hosts
Provider hosts a role.describe names as egress_host.
models
The model value each provider expects in its request body.
workers_ai_codes
The Workers AI error codes this crate maps, with what each means in Cloudflare’s error reference.

Structs§

ProviderRequest
The provider request for one item: {model, state, questions, images?}. images is clef only; TypeSafe takes text only.
ProviderResponse
The provider response for one item: {model, answers, usage}.

Constants§

TYPESAFE_ENDPOINT
TypeSafe’s classification endpoint.

Functions§

item_code_for_status
The per-item error code for a provider’s HTTP status, for a provider whose error body the runner does not read:
workers_ai_item_code
The per-item error code for a Cloudflare Workers AI error: the HTTP status and the first errors[].code of its reply, when it gave one.