pub struct Completion;Expand description
Generating an assistant turn, unary or streamed.
Trait Implementations§
Source§impl Clone for Completion
impl Clone for Completion
impl Copy for Completion
Source§impl Debug for Completion
impl Debug for Completion
Source§impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
Available on crate feature test-utils only.
impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
test-utils only.Source§fn classify(&self, frame: MockFrame) -> WireEvent<MockFrame>
fn classify(&self, frame: MockFrame) -> WireEvent<MockFrame>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
frame: MockFrame,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, frame: MockFrame, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for MessagesDecoder
impl<'id> Decoder<'id, Completion> for MessagesDecoder
Source§type Event = MessagesEvent
type Event = MessagesEvent
Source§fn classify(&self, frame: WireFrame) -> WireEvent<MessagesEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<MessagesEvent>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
event: MessagesEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: MessagesEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for ChatDecoder
impl<'id> Decoder<'id, Completion> for ChatDecoder
Source§fn classify(&self, frame: WireFrame) -> WireEvent<ChatEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<ChatEvent>
A stream event by its type; a frame without one is the whole
reply, recognized by its message.
Source§fn decode(
&mut self,
event: ChatEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: ChatEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for CohereDecoder
impl<'id> Decoder<'id, Completion> for CohereDecoder
Source§type Event = CohereEvent
type Event = CohereEvent
Source§fn classify(&self, frame: WireFrame) -> WireEvent<CohereEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<CohereEvent>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
event: CohereEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: CohereEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
Source§impl<'id> Decoder<'id, Completion> for InteractionsDecoder
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
impl<'id> Decoder<'id, Completion> for InteractionsDecoder
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
Source§fn classify(&self, frame: WireFrame) -> WireEvent<InteractionsEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<InteractionsEvent>
Classify a frame by its event_type tag, or as a whole resource by
its marker keys when it carries no tag. A tagged frame never passes
for a whole resource.
Source§type Event = InteractionsEvent
type Event = InteractionsEvent
Source§fn decode(
&mut self,
event: InteractionsEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: InteractionsEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for GenerateContentDecoder
impl<'id> Decoder<'id, Completion> for GenerateContentDecoder
Source§fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
Gemini ends a reply at EOF, not at its first finish reason: a hosted-tool round can report one before more content arrives.
Source§type Event = GenerateContentChunk
type Event = GenerateContentChunk
Source§fn classify(&self, frame: WireFrame) -> WireEvent<GenerateContentChunk>
fn classify(&self, frame: WireFrame) -> WireEvent<GenerateContentChunk>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
GenerateContentChunk: GenerateContentChunk,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, GenerateContentChunk: GenerateContentChunk, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for ChatDecoder
impl<'id> Decoder<'id, Completion> for ChatDecoder
Source§fn decode(
&mut self,
ChatRecord: ChatRecord,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, ChatRecord: ChatRecord, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Fields are read leniently: one the record leaves out or sends with
another type is absent, so only error and done steer the reply.
Source§type Event = ChatRecord
type Event = ChatRecord
Source§fn classify(&self, frame: WireFrame) -> WireEvent<ChatRecord>
fn classify(&self, frame: WireFrame) -> WireEvent<ChatRecord>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§impl<'id> Decoder<'id, Completion> for ResponsesDecoder
impl<'id> Decoder<'id, Completion> for ResponsesDecoder
Source§type Event = ResponsesEvent
type Event = ResponsesEvent
Source§fn classify(&self, frame: WireFrame) -> WireEvent<ResponsesEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<ResponsesEvent>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
event: ResponsesEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: ResponsesEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§impl<'id> Decoder<'id, Completion> for OpenAiDecoder
impl<'id> Decoder<'id, Completion> for OpenAiDecoder
Source§type Event = OpenAiEvent
type Event = OpenAiEvent
Source§fn classify(&self, frame: WireFrame) -> WireEvent<OpenAiEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<OpenAiEvent>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
event: OpenAiEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: OpenAiEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Source§fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
fn eof(&mut self, out: Out<'id, Completion>) -> Result<Flow, ProviderError>
impl Emit<Completion> for Assembled
impl Eq for Completion
Source§impl Fold<Completion> for Turn
impl Fold<Completion> for Turn
Source§fn absorb(&mut self, event: &StreamEvent) -> Result<(), ProviderError>
fn absorb(&mut self, event: &StreamEvent) -> Result<(), ProviderError>
Source§fn finish(
self,
end: Finish,
reply: Reply,
) -> Result<CompletionResponse, ProviderError>
fn finish( self, end: Finish, reply: Reply, ) -> Result<CompletionResponse, ProviderError>
Source§impl Operation for Completion
impl Operation for Completion
Source§fn fold(request: &Self::Request, call: &mut Call<'_>) -> Self::Fold
fn fold(request: &Self::Request, call: &mut Call<'_>) -> Self::Fold
The call’s span names the model the request overrides to, when it names one: every wire honours the override on encode.
Source§fn prepare(
request: Self::Request,
wire: &Descriptor<'_>,
) -> Result<Self::Request, ProviderError>
fn prepare( request: Self::Request, wire: &Descriptor<'_>, ) -> Result<Self::Request, ProviderError>
Resolve the model the request addresses once, as the request’s
model: the one it names, else the wire’s. The history is checked
with CompletionRequest::validate_message_content, then
adapted for that model on the wire’s
replay target and checked again. Encoders, the fold and replay all
read the one resolved model. Each option the routed target refuses
is reported first, through
options::check.
Source§type Request = CompletionRequest
type Request = CompletionRequest
Source§type Event = StreamEvent
type Event = StreamEvent
Source§type End = Finish
type End = Finish
Source§type Response = CompletionResponse
type Response = CompletionResponse
Source§impl PartialEq for Completion
impl PartialEq for Completion
impl Serves<Completion> for Interaction
impl Serves<Completion> for GenerateContentResponse
impl Serves<Completion> for OpenAiReassembler
impl Serves<Completion> for MockDocument
test-utils only.impl StructuralPartialEq for Completion
Auto Trait Implementations§
impl Freeze for Completion
impl RefUnwindSafe for Completion
impl Send for Completion
impl Sync for Completion
impl Unpin for Completion
impl UnsafeUnpin for Completion
impl UnwindSafe for Completion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more