Skip to main content

GeminiViaResponses

Struct GeminiViaResponses 

Source
pub struct GeminiViaResponses { /* private fields */ }
Expand description

A prepared Gemini client request executed by the selected Responses endpoint.

Implementations§

Source§

impl GeminiViaResponses

Source

pub async fn prepare_with_image_resources<S: StateStore, R: ResourceAccess>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, ) -> Result<Self, TransformError>

URI delivery is handled by actual publication after generation. Only the mapped request uses inline delivery; original_request remains unchanged.

Source

pub async fn convert_response_with_image_resources<S: StateStore, R: ResourceAccess>( &mut self, native: GenerateContentResponseBody, facts: GeminiReplayContext, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, progress: &mut ImageResourceProgress<GenerateContentResponseBody, R::PublishedHandle>, ) -> Result<Converted<GenerateContentResponseBody>, TransformError>

Convert and publish requested image URLs before persisting identities and returning any client result. The original native response stays separate.

Source

pub async fn invoke_with_image_resources<U: Upstream, S: StateStore, R: ResourceAccess>( &mut self, upstream: &U, target: &U::Target, limits: CodecLimits, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, progress: &mut ImageResourceProgress<GenerateContentResponseBody, R::PublishedHandle>, facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiReplayContext, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

Source

pub async fn recover_with_image_resources<S: StateStore, R: ResourceAccess>( &mut self, limits: CodecLimits, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, progress: &mut ImageResourceProgress<GenerateContentResponseBody, R::PublishedHandle>, facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiReplayContext, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

Source§

impl GeminiViaResponses

Source

pub fn prepare( input: GenerateContentRequestBody, selected_model: impl Into<String>, endpoint: Endpoint, identities: GenerationIdentity, ) -> Result<Self, TransformError>

Source

pub async fn prepare_with_state<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, ) -> Result<Self, TransformError>

Restore exact tool aliases and names from declared history/scoped state before mapping.

Source

pub async fn prepare_with_capabilities<S: StateStore, R: ResourceAccess>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, ) -> Result<Self, TransformError>

Materialize foreign resources and restore scoped history before preparing the selected endpoint.

Source

pub fn original_request(&self) -> &GenerateContentRequestBody

Source

pub fn target_request(&self) -> &GenerateContentRequestBody

Source

pub fn identities(&self) -> &GenerationIdentity

Source

pub fn report(&self) -> &Report

Source

pub fn selected_model(&self) -> &str

Source

pub fn convert_response( &mut self, native: GenerateContentResponseBody, facts: GeminiReplayContext, ) -> Result<Converted<GenerateContentResponseBody>, TransformError>

Source

pub async fn invoke<U: Upstream, S: StateStore>( &mut self, upstream: &U, target: &U::Target, limits: CodecLimits, state: &GenerationStateAccess<'_, S>, progress: &mut GenerationProgress<GenerateContentResponseBody>, facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiReplayContext, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

Performs one POST. The factual supplement is obtained from the actual decoded response. Conversion errors keep native bytes/results in caller-owned progress.

Source

pub async fn recover<S: StateStore>( &mut self, limits: CodecLimits, state: &GenerationStateAccess<'_, S>, progress: &mut GenerationProgress<GenerateContentResponseBody>, facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiReplayContext, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

Complete response conversion and pending state writes using the retained result; sends no request.

Source§

impl GeminiViaResponses

Source

pub async fn prepare_for_stream_synthesis<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, ) -> Result<Self, TransformError>

Prepare a buffered upstream result for later native stream synthesis, retaining the original client stream flag and all declared controls.

Source

pub async fn prepare_for_stream_synthesis_with_capabilities<S: StateStore, R: ResourceAccess>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, ) -> Result<Self, TransformError>

Prepare a buffered upstream result for later native stream synthesis, retaining the original client stream flag and all declared controls.

Source§

impl GeminiViaResponses

Trait Implementations§

Source§

impl Debug for GeminiViaResponses

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ResourceSend for T
where T: Send + ?Sized,

Source§

impl<T> ResourceSync for T
where T: Sync + ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.