Skip to main content

GeminiViaChat

Struct GeminiViaChat 

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

A prepared Gemini client request executed by the selected Chat Completions endpoint.

Implementations§

Source§

impl GeminiViaChat

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

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

Source§

impl GeminiViaChat

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 GeminiViaChat

Trait Implementations§

Source§

impl Debug for GeminiViaChat

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.