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.
CachedContentFold
The reply’s one answer: a reply with no body at all ends as CachedContentReply::Acknowledged. Finishing never fails.
CallFragment
What one fragment of a buffered tool call carries.
CallPart
An open tool call of one reply. It has its id and its name, and becomes visible when it closes.
Completion
Generating an assistant turn, unary or streamed.
ContextCache
Creates, reads, lists, updates expiry, or deletes explicit context caches. Requests use CachedContentRequest; a listing reads one page per call.
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.
ReasoningPart
An open reasoning part of one reply.
Rerank
Ordering documents by relevance to a query.
RerankRequest
A reranking request: the query, the documents to order, and the batch limit’s subject.
Seal
How a closed reasoning part ends: its provider id, a signature, or the provider’s whole restatement of it.
TextPart
An open text part of one reply. Only opening the part gives one, so a fragment cannot precede its part’s start:
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§

IfMalformed
What to do with a call whose arguments do not parse when it closes.