Skip to main content

ResponsesViaGemini

Struct ResponsesViaGemini 

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

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

Implementations§

Source§

impl ResponsesViaGemini

Source

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

Materialize actual native fileData images and convert that view. An image’s signature goes to the client with its bytes, so nothing is kept.

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<GeminiReturnFacts, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

One buffered generation POST followed by scoped image reads. Recovery retains the native result and never repeats the generation request.

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<GeminiReturnFacts, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

Source§

impl ResponsesViaGemini

Source

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

Source

pub async fn prepare_with_state<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, context: GeminiReplayContext, ) -> 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>, context: GeminiReplayContext, ) -> 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: GeminiReturnFacts, ) -> 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<GeminiReturnFacts, 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<GeminiReturnFacts, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>

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

Source§

impl ResponsesViaGemini

Source

pub async fn prepare_for_stream_synthesis<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, context: GeminiReplayContext, ) -> 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>, context: GeminiReplayContext, ) -> 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 ResponsesViaGemini

Trait Implementations§

Source§

impl Debug for ResponsesViaGemini

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.