pub trait Wire:
Clone
+ WasmCompatSend
+ WasmCompatSync
+ 'static {
type Op: Operation;
type Payload: WasmCompatSend + 'static;
type Frame: WasmCompatSend + 'static;
type Event: WasmCompatSend + 'static;
type Decoder<'id>: Decoder<'id, Self::Op, Self::Frame, Event = Self::Event> + WasmCompatSend;
type Reassembler: Reassemble<Self::Event> + 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 Event: WasmCompatSend + 'static
type Event: WasmCompatSend + 'static
The decoder’s classified event, which the reassembler reads too.
Sourcetype Decoder<'id>: Decoder<'id, Self::Op, Self::Frame, Event = Self::Event> + WasmCompatSend
type Decoder<'id>: Decoder<'id, Self::Op, Self::Frame, Event = Self::Event> + WasmCompatSend
The decoder for one of its replies, branded with that reply.
Sourcetype Reassembler: Reassemble<Self::Event> + Serves<Self::Op>
type Reassembler: Reassemble<Self::Event> + Serves<Self::Op>
What rebuilds a reply’s provider document from its events when the
transport reports no whole document, as for a stream. The driver
hands it every known event before the decoder decodes it, 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 Event = CachedContentReply
type Decoder<'id> = CachedContentsDecoder
type Reassembler = Unreassembled
Source§impl Wire for CohereChat
impl Wire for CohereChat
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
type Op = Embedding
type Payload = Encoded
type Frame = WireFrame
type Event = EmbeddingResponse
type Decoder<'id> = DocumentDecoder<<Embeddings as Wire>::Op, <Embeddings as Wire>::Event>
type Reassembler = Unreassembled
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 Event = GenerateContentChunk
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 Event = Result<ImageEmbeddingResponse, String>
type Decoder<'id> = DocumentDecoder<ImageEmbedding, <ImageEmbeddings as Wire>::Event>
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.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 Event = ImagesEvent
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 Event = InteractionsEvent
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 Event = InteractionsEvent
type Decoder<'id> = InteractionsDecoder
type Reassembler = Interaction
Source§impl Wire for InteractionsModels
impl Wire for InteractionsModels
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 Event = 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 Event = ModelsPage
type Decoder<'id> = DocumentDecoder<ModelListing, ModelsPage>
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 Event = ListModelsResponse
type Decoder<'id> = DocumentDecoder<ModelListing, <Models as Wire>::Event>
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 Event = ModelsReply
type Decoder<'id> = DocumentDecoder<ModelListing, <Models as Wire>::Event>
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 Event = OpenAiEvent
type Decoder<'id> = OpenAiDecoder
type Reassembler = OpenAiReassembler
Source§impl Wire for rig_core::providers::gemini::audio_generation::Speech
Available on crate feature audio only.
impl Wire for rig_core::providers::gemini::audio_generation::Speech
audio only.Source§impl Wire for rig_core::providers::openai::wire::Speech
Available on crate feature audio only.
impl Wire for rig_core::providers::openai::wire::Speech
audio only.Source§impl Wire for rig_core::providers::gemini::transcription::Transcriptions
impl Wire for rig_core::providers::gemini::transcription::Transcriptions
Source§impl Wire for rig_core::providers::openai::wire::Transcriptions
impl Wire for rig_core::providers::openai::wire::Transcriptions
type Op = Transcription
type Payload = Encoded
type Frame = WireFrame
type Event = TranscriptionResponse
type Decoder<'id> = DocumentDecoder<Transcription, <Transcriptions as Wire>::Event>
type Reassembler = Unreassembled
Source§impl Wire for VoiceClones
Available on crate feature audio only.
impl Wire for VoiceClones
audio only.