Skip to main content

Module driver

Module driver 

Source
Expand description

Calls a model. A Model pairs a Wire (what to send and how to read the reply) with a Transport (how the payload travels). Its stream yields any operation’s events as a Streamed, and its call is that stream, finished: one decoder, one fold and one response constructor for both. The _observed twins take the observation context a bus records under.

use rig_core::completion::CompletionRequest;
use rig_core::driver::Model;
use rig_core::providers::openai::{self, OpenAI};

let model = OpenAI::from_env()?.with_http(http).responses(openai::GPT_5_2);
let response = model.call(CompletionRequest::new("Hello")).await?;

Structs§

DynModel
A model of one operation with its wire and transport erased. Clones share the model. Built with Model::erase or From<Model<W, T>>, so a consumer takes impl Into<DynModel<Op>> and accepts either.
Exchange
What the driver tells a transport about one send.
Local
A wire whose payload is the request and whose frames are the reply’s steps, for an operation whose events the runtime builds itself.
Model
An endpoint of one provider: a wire bound to a transport.
Opened
One reply a transport opened: its frames, and the facts the transport owns.
Opening
One reply, opened when first polled.

Enums§

Step
One step of a local runtime’s reply.

Traits§

Transport
Sends a wire’s payloads and delivers its replies’ frames.

Functions§

warn_unmodeled
Logs an unmodeled payload’s kind and serialized size, never its content. Callers must supply a structural kind label without sensitive data.