Skip to main content

Module operation

Module operation 

Source
Expand description

The operations a Wire can perform.

Each operation declares its request, event, end and response types and the fold one reply goes through. Completion streams events; most others answer with one whole document, folded by Whole. Listings follow their cursors above the driver: each page is one call.

use rig_core::operation::{Completion, Embedding};
use rig_core::wire::Operation;

fn streams<Op: Operation>() {}
streams::<Completion>();
streams::<Embedding>();

Structs§

AudioGenerationaudio
Generating speech.
CallFragment
What one fragment of a buffered tool call carries.
Completion
Generating an assistant turn, unary or streamed.
Embedding
Embedding a batch of texts.
Finish
What the provider sends when it ends a completion reply.
ImageEmbedding
Embedding a batch of images from their encoded file bytes.
ImageGenerationimage
Generating an image.
ModelListing
Lists provider models, one page per call.
ModelPage
One page of a model listing, and the cursor of the page after it.
Rerank
Ordering documents by relevance to a query.
RerankRequest
A reranking request: the query, the documents to order, and the batch limit’s subject.
Transcription
Transcribes audio using provider-specific request encoding.
Turn
The completion fold. The driver and the bus writer build it; no other code can feed one.
Verify
Checks credentials using response status. HTTP 401/403 indicate invalid authentication; status-only decoders do not interpret the response body.
VerifyDecoder
Accepts any body, including an empty one, after driver status validation. Endpoints requiring body validation must use another decoder.
Whole
The fold of an operation whose reply is one whole answer: it has no events, and the provider’s end is the response. The stamp writes what the driver learned about the reply onto it.

Enums§

Block
What a provider item becomes when it opens.

Functions§

merge
Merge delta into item: each string field but type appends to the item’s string of that key, an array extends the item’s array, and any other value replaces the key. A delta kind rig has never seen still lands in the item.