pub struct InteractionResume {
pub provider: GeminiConfig,
pub interaction_id: String,
pub last_event_id: Option<String>,
}Expand description
Read an existing interaction resource or resume its event stream.
Unary mode retrieves the resource once. Streaming mode resumes after
last_event_id, or from the beginning if no event id is supplied.
Fields§
§provider: GeminiConfigThe key and the API root.
interaction_id: StringThe interaction to read.
last_event_id: Option<String>The last event the consumer saw, so a resumed stream does not
redeliver it. None resumes from the beginning, as the API defaults.
Implementations§
Source§impl InteractionResume
impl InteractionResume
Sourcepub fn new(provider: GeminiConfig, interaction_id: impl Into<String>) -> Self
pub fn new(provider: GeminiConfig, interaction_id: impl Into<String>) -> Self
The wire for the interaction interaction_id.
Sourcepub fn after_event(self, last_event_id: impl Into<String>) -> Self
pub fn after_event(self, last_event_id: impl Into<String>) -> Self
Resume a streamed read after the event last_event_id.
Trait Implementations§
Source§impl Clone for InteractionResume
impl Clone for InteractionResume
Source§impl Debug for InteractionResume
impl Debug for InteractionResume
Source§impl<'de> Deserialize<'de> for InteractionResume
impl<'de> Deserialize<'de> for InteractionResume
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for InteractionResume
impl PartialEq for InteractionResume
Source§impl ReplayTarget for InteractionResume
impl ReplayTarget for InteractionResume
Source§fn map_options(
&self,
_request: &CompletionRequest,
fields: OptionFields<'_>,
) -> OptionMap
fn map_options( &self, _request: &CompletionRequest, fields: OptionFields<'_>, ) -> OptionMap
A resumed interaction is read, not created, so every set option is refused.
Source§fn later_system(&self, _model: &str) -> LaterSystem
fn later_system(&self, _model: &str) -> LaterSystem
Gemini takes system text only in systemInstruction: later system
messages fold into the leading one, as pi’s collapseSystemMessages.
Source§fn accepts(&self, model: &str) -> Accepts
fn accepts(&self, model: &str) -> Accepts
model, the model a request addresses on this wire, reads.
adapt downgrades everything else, so the encoder never sees it.Source§fn normalize_tool_call_id(
&self,
id: &str,
_model: &str,
_: Option<&Origin>,
) -> String
fn normalize_tool_call_id( &self, id: &str, _model: &str, _: Option<&Origin>, ) -> String
id takes when a call another model made is sent to model
on this wire. source is the call’s origin, None for a hand-built
turn. Results answering the call are rewritten to match, and an id
another call already took is made distinct.Source§fn call_id_slot(&self) -> Option<&'static str>
fn call_id_slot(&self) -> Option<&'static str>
Source§fn encodes(&self, model: &str, media: Media<'_>) -> bool
fn encodes(&self, model: &str, media: Media<'_>) -> bool
media to model: its source (data,
URL, file id or string), its media type, and where it sits. adapt
replaces every part this refuses with a placeholder, or a text
document with its text, so the encoder never refuses canonical
content. Row H9 of the history conformance suite holds every wire to
it. By default every form is carried.Source§fn continues_stored(&self, request: &CompletionRequest) -> bool
fn continues_stored(&self, request: &CompletionRequest) -> bool
request continues a conversation the provider stores, such
as one naming a previous interaction. Results before the history’s
first turn then answer calls the provider holds, so adapt keeps
them.Source§fn declares_tools(&self, request: &CompletionRequest) -> bool
fn declares_tools(&self, request: &CompletionRequest) -> bool
request declares tools to the provider, in tools, in the
tools of its additional_params, or through tools the wire adds.
A request that declares none gets its history’s calls and results as
text. ToolChoice::None still declares them: the wire sends its own
none choice beside the tool history.Source§fn identity(&self, item: &Value) -> Map<String, Value>
fn identity(&self, item: &Value) -> Map<String, Value>
Replay::Identity).
By default none do.Source§fn states_finish_reason(&self) -> bool
fn states_finish_reason(&self) -> bool
supportsFinishReason); a wire
with no finish vocabulary, such as a local runtime, says false.Source§fn binds_context(&self, model: &str) -> bool
fn binds_context(&self, model: &str) -> bool
model binds its provider items to the request’s tools and
system prompt, so a turn made under another context replays as if
from another model.Source§fn drops_unbound_items(&self, request: &CompletionRequest) -> bool
fn drops_unbound_items(&self, request: &CompletionRequest) -> bool
request asks the provider to drop an item bound to another
context itself (Anthropic’s drop_block), so a turn made under
another context replays verbatim rather than as another model’s.Source§fn route(&self, request: &CompletionRequest) -> Option<&dyn ReplayTarget>
fn route(&self, request: &CompletionRequest) -> Option<&dyn ReplayTarget>
request is sent to, for a wire that picks its API per
request. Preparing the request and folding its reply both read the
target this names, so a turn records the API it was made on. None,
the default, is this target.Source§fn takes_documents(&self) -> bool
fn takes_documents(&self) -> bool
Source§fn needs_next(&self, item: &Value) -> bool
fn needs_next(&self, item: &Value) -> bool
Source§fn hosted_pair(&self, item: &Value) -> Option<(Pairing, String)>
fn hosted_pair(&self, item: &Value) -> Option<(Pairing, String)>
Source§fn starts_with_user(&self) -> bool
fn starts_with_user(&self) -> bool
adapt then drops the
assistant turns before the first user message, with their results.Source§fn alternates_roles(&self) -> bool
fn alternates_roles(&self) -> bool
adapt then joins two messages of one role that only system
messages separate, which move after them.Source§fn hosted_needs_tools(&self) -> bool
fn hosted_needs_tools(&self) -> bool
Source§fn result_parts(&self, model: &str) -> bool
fn result_parts(&self, model: &str) -> bool
model reads a tool result as several parts. When it reads
neither parts nor result images, adapt joins a result’s text
parts into one.Source§fn sends_alone(&self, block: &AssistantContent) -> bool
fn sends_alone(&self, block: &AssistantContent) -> bool
block on its own makes an assistant message this wire
sends. A turn with no such block carries nothing, so adapt drops
it and the user messages around it become one. By default every
block does.Source§impl Serialize for InteractionResume
impl Serialize for InteractionResume
impl StructuralPartialEq for InteractionResume
Source§impl Wire for InteractionResume
impl Wire for InteractionResume
Source§fn describe(&self) -> Descriptor<'_>
fn describe(&self) -> Descriptor<'_>
The interaction names its own model; this wire addresses no model id. The decoder reports the model the interaction names, which the turn’s origin takes.
Source§fn encode(
&self,
request: CompletionRequest,
mode: Mode,
) -> Result<Encoded, EncodeError>
fn encode( &self, request: CompletionRequest, mode: Mode, ) -> Result<Encoded, EncodeError>
Reads an existing interaction, so the request carries no body: what
to read is the wire’s own data. A request that sets options,
provider options or additional_params is refused, since nothing
would send them.
Source§type Op = Completion
type Op = Completion
Source§type Payload = Encoded
type Payload = Encoded
Self::encode produces for the transport to send.Source§type Decoder<'id> = InteractionsDecoder
type Decoder<'id> = InteractionsDecoder
Source§type Reassembler = Interaction
type Reassembler = Interaction
raw.
A wire whose operation’s decoders record raw themselves names
document::Unreassembled; a completion wire cannot, because it
does not Serve completions.Source§fn reassembler(&self) -> Self::Reassembler
fn reassembler(&self) -> Self::Reassembler
Auto Trait Implementations§
impl Freeze for InteractionResume
impl RefUnwindSafe for InteractionResume
impl Send for InteractionResume
impl Sync for InteractionResume
impl Unpin for InteractionResume
impl UnsafeUnpin for InteractionResume
impl UnwindSafe for InteractionResume
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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