pub trait Wire:
Clone
+ WasmCompatSend
+ WasmCompatSync
+ 'static {
type Op: Operation;
type Payload: WasmCompatSend + 'static;
type Frame: WasmCompatSend + 'static;
type Decoder<'id>: Decoder<'id, Self::Op, Self::Frame> + WasmCompatSend;
type Reassembler: Reassemble<Self::Frame> + Serves<Self::Op>;
// Required methods
fn describe(&self) -> Descriptor<'_>;
fn encode(
&self,
request: Request<Self>,
mode: Mode,
) -> Result<Self::Payload, EncodeError>;
fn decoder<'id>(&self) -> Self::Decoder<'id>;
// Provided method
fn reassembler(&self) -> Self::Reassembler { ... }
}Expand description
A provider endpoint: plain data that encodes requests and names a decoder for each reply.
No transport, no future, no type parameter. Implementations are plain
data (Clone + PartialEq + Debug + Serialize + Deserialize, with
credentials held in Secret), so a host can store one in a scene, a
component, or a config file. Clone is a supertrait: the driver clones
the wire into every call’s 'static stream.
Required Associated Types§
Sourcetype Payload: WasmCompatSend + 'static
type Payload: WasmCompatSend + 'static
What Self::encode produces for the transport to send.
Sourcetype Frame: WasmCompatSend + 'static
type Frame: WasmCompatSend + 'static
One unit of a reply, as the transport delivers it.
Sourcetype Decoder<'id>: Decoder<'id, Self::Op, Self::Frame> + WasmCompatSend
type Decoder<'id>: Decoder<'id, Self::Op, Self::Frame> + WasmCompatSend
The decoder for one of its replies, branded with that reply.
Sourcetype Reassembler: Reassemble<Self::Frame> + Serves<Self::Op>
type Reassembler: Reassemble<Self::Frame> + Serves<Self::Op>
What rebuilds a reply’s provider document from its frames when the
transport reports no whole document, as for a stream. The driver
feeds it every frame and records what it finishes with as raw.
A wire whose operation’s decoders record raw themselves names
document::Unreassembled; a completion wire cannot, because it
does not Serve completions.
Required Methods§
Sourcefn describe(&self) -> Descriptor<'_>
fn describe(&self) -> Descriptor<'_>
What the wire says about itself.
Sourcefn encode(
&self,
request: Request<Self>,
mode: Mode,
) -> Result<Self::Payload, EncodeError>
fn encode( &self, request: Request<Self>, mode: Mode, ) -> Result<Self::Payload, EncodeError>
The request to send. Pure: it may read self, request and mode,
and nothing else. A request that cannot be built is an
EncodeError, which always reports as a request failure.
Provided Methods§
Sourcefn reassembler(&self) -> Self::Reassembler
fn reassembler(&self) -> Self::Reassembler
A fresh reassembler for one reply. A wire that picks its API per reply builds the matching one.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl Wire for CachedContents
impl Wire for CachedContents
type Op = ContextCache
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = CachedContentsDecoder
type Reassembler = Unreassembled
Source§impl Wire for CohereChat
impl Wire for CohereChat
Source§impl Wire for CopilotWire
impl Wire for CopilotWire
type Op = Completion
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = OpenAiDecoder
type Reassembler = OpenAiReassembler
Source§impl Wire for rig_core::providers::cohere::embeddings::Embeddings
impl Wire for rig_core::providers::cohere::embeddings::Embeddings
Source§impl Wire for rig_core::providers::gemini::embedding::Embeddings
impl Wire for rig_core::providers::gemini::embedding::Embeddings
Source§impl Wire for rig_core::providers::ollama::embedding::Embeddings
impl Wire for rig_core::providers::ollama::embedding::Embeddings
Source§impl Wire for rig_core::providers::openai::wire::Embeddings
impl Wire for rig_core::providers::openai::wire::Embeddings
Source§impl Wire for rig_core::providers::voyageai::wire::Embeddings
impl Wire for rig_core::providers::voyageai::wire::Embeddings
Source§impl Wire for GenerateContent
impl Wire for GenerateContent
type Op = Completion
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = GenerateContentDecoder
type Reassembler = GenerateContentResponse
Source§impl Wire for ImageEmbeddings
impl Wire for ImageEmbeddings
type Op = ImageEmbedding
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ImageEmbeddingsDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::gemini::image_generation::Images
Available on crate feature image only.
impl Wire for rig_core::providers::gemini::image_generation::Images
image only.type Op = ImageGeneration
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ImagesDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::openai::wire::Images
Available on crate feature image only.
impl Wire for rig_core::providers::openai::wire::Images
image only.type Op = ImageGeneration
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ImagesDecoder
type Reassembler = Unreassembled
Source§impl Wire for InteractionResume
impl Wire for InteractionResume
type Op = Completion
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = InteractionsDecoder
type Reassembler = Interaction
Source§impl Wire for Interactions
impl Wire for Interactions
type Op = Completion
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = InteractionsDecoder
type Reassembler = Interaction
Source§impl Wire for InteractionsModels
impl Wire for InteractionsModels
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for MockScript
Available on crate feature test-utils only.
impl Wire for MockScript
test-utils only.type Op = Completion
type Payload = CompletionRequest
type Frame = MockFrame
type Decoder<'id> = MockDecoder<'id>
type Reassembler = MockDocument
Source§impl Wire for rig_core::providers::anthropic::modality::Models
impl Wire for rig_core::providers::anthropic::modality::Models
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::copilot::model_listing::Models
impl Wire for rig_core::providers::copilot::model_listing::Models
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::gemini::model_listing::Models
impl Wire for rig_core::providers::gemini::model_listing::Models
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::ollama::model_listing::Models
impl Wire for rig_core::providers::ollama::model_listing::Models
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for rig_core::providers::openai::wire::Models
impl Wire for rig_core::providers::openai::wire::Models
type Op = ModelListing
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = ModelsDecoder
type Reassembler = Unreassembled
Source§impl Wire for NativeChat
impl Wire for NativeChat
Source§impl Wire for OpenAiWire
impl Wire for OpenAiWire
type Op = Completion
type Payload = Encoded
type Frame = WireFrame
type Decoder<'id> = OpenAiDecoder
type Reassembler = OpenAiReassembler
Source§impl Wire for Speech
Available on crate feature audio only.
impl Wire for Speech
audio only.