pub struct ChatViaGemini { /* private fields */ }Expand description
A prepared Chat Completions client request executed by the selected Gemini endpoint.
Implementations§
Source§impl ChatViaGemini
impl ChatViaGemini
pub fn prepare( input: GenerateContentRequestBody, selected_model: impl Into<String>, endpoint: Endpoint, identities: GenerationIdentity, function_names: &BTreeMap<String, String>, ) -> Result<Self, TransformError>
Sourcepub async fn prepare_with_state<S: StateStore>(
input: GenerateContentRequestBody,
endpoint: Endpoint,
identities: GenerationIdentity,
state: &GenerationStateAccess<'_, S>,
function_names: &BTreeMap<String, String>,
) -> Result<Self, TransformError>
pub async fn prepare_with_state<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, function_names: &BTreeMap<String, String>, ) -> Result<Self, TransformError>
Restore exact tool aliases and names from declared history/scoped state before mapping.
Sourcepub async fn prepare_with_capabilities<S: StateStore, R: ResourceAccess>(
input: GenerateContentRequestBody,
endpoint: Endpoint,
identities: GenerationIdentity,
state: &GenerationStateAccess<'_, S>,
resources: &GenerationResources<'_, R>,
function_names: &BTreeMap<String, String>,
) -> Result<Self, TransformError>
pub async fn prepare_with_capabilities<S: StateStore, R: ResourceAccess>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, resources: &GenerationResources<'_, R>, function_names: &BTreeMap<String, String>, ) -> Result<Self, TransformError>
Materialize foreign resources and restore scoped history before preparing the selected endpoint.
pub fn original_request(&self) -> &GenerateContentRequestBody
pub fn target_request(&self) -> &GenerateContentRequestBody
pub fn identities(&self) -> &GenerationIdentity
pub fn report(&self) -> &Report
pub fn selected_model(&self) -> &str
pub fn convert_response( &mut self, native: GenerateContentResponseBody, facts: GeminiChatResponseSupplement, ) -> Result<Converted<GenerateContentResponseBody>, TransformError>
Sourcepub 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<GeminiChatResponseSupplement, TransformError>,
) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>
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<GeminiChatResponseSupplement, 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.
Sourcepub async fn recover<S: StateStore>(
&mut self,
limits: CodecLimits,
state: &GenerationStateAccess<'_, S>,
progress: &mut GenerationProgress<GenerateContentResponseBody>,
facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiChatResponseSupplement, TransformError>,
) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>
pub async fn recover<S: StateStore>( &mut self, limits: CodecLimits, state: &GenerationStateAccess<'_, S>, progress: &mut GenerationProgress<GenerateContentResponseBody>, facts: impl FnOnce(&GenerateContentResponseBody) -> Result<GeminiChatResponseSupplement, TransformError>, ) -> Result<GenerationOutcome<GenerateContentResponseBody>, TransformError>
Complete response conversion and pending state writes using the retained result; sends no request.
Source§impl ChatViaGemini
impl ChatViaGemini
Sourcepub async fn prepare_for_stream_synthesis<S: StateStore>(
input: GenerateContentRequestBody,
endpoint: Endpoint,
identities: GenerationIdentity,
state: &GenerationStateAccess<'_, S>,
function_names: &BTreeMap<String, String>,
) -> Result<Self, TransformError>
pub async fn prepare_for_stream_synthesis<S: StateStore>( input: GenerateContentRequestBody, endpoint: Endpoint, identities: GenerationIdentity, state: &GenerationStateAccess<'_, S>, function_names: &BTreeMap<String, String>, ) -> Result<Self, TransformError>
Prepare a buffered upstream result for later native stream synthesis, retaining the original client stream flag and all declared controls.
Sourcepub async fn prepare_for_stream_synthesis_with_capabilities<S: StateStore, R: ResourceAccess>(
input: GenerateContentRequestBody,
endpoint: Endpoint,
identities: GenerationIdentity,
state: &GenerationStateAccess<'_, S>,
resources: &GenerationResources<'_, R>,
function_names: &BTreeMap<String, String>,
) -> Result<Self, TransformError>
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>, function_names: &BTreeMap<String, String>, ) -> Result<Self, TransformError>
Prepare a buffered upstream result for later native stream synthesis, retaining the original client stream flag and all declared controls.