pub struct GoogleInteractionsLanguageModel { /* private fields */ }Expand description
A language model backed by Google’s Interactions API.
§Examples
use ferrin_google::{create_google, GoogleSettings};
use ferrin_spec::LanguageModel;
use ferrin_spec::language_model::{CallOptions, PromptMessage};
let google = create_google(GoogleSettings::default())?;
let model = google.interactions("gemini-2.5-flash");
let result = model.do_generate(CallOptions::new(vec![PromptMessage::user_text("Hello")])).await?;Implementations§
Source§impl GoogleInteractionsLanguageModel
impl GoogleInteractionsLanguageModel
Sourcepub fn new(config: SharedConfig, model_id: impl Into<ModelId>) -> Self
pub fn new(config: SharedConfig, model_id: impl Into<ModelId>) -> Self
Creates an Interactions model using the shared provider configuration.
Sourcepub fn config(&self) -> &SharedConfig
pub fn config(&self) -> &SharedConfig
Returns the shared configuration.
Sourcepub fn prepare_request(
&self,
options: &CallOptions,
) -> Result<JsonValue, ProviderError>
pub fn prepare_request( &self, options: &CallOptions, ) -> Result<JsonValue, ProviderError>
Converts a call to the Interactions request body without sending it.
§Errors
Returns an invalid argument error for unsupported options or file references.
Sourcepub async fn start_interaction(
&self,
options: CallOptions,
) -> Result<JsonValue, ProviderError>
pub async fn start_interaction( &self, options: CallOptions, ) -> Result<JsonValue, ProviderError>
Creates an interaction and returns its initial resource without polling.
§Errors
Returns option conversion, transport, provider or cancellation errors.
Sourcepub async fn get_interaction(
&self,
id: &str,
options: GoogleInteractionOptions,
) -> Result<JsonValue, ProviderError>
pub async fn get_interaction( &self, id: &str, options: GoogleInteractionOptions, ) -> Result<JsonValue, ProviderError>
Retrieves an interaction resource by its server-assigned identifier.
§Errors
Returns an invalid argument error for an empty ID, or an HTTP/provider error.
Sourcepub async fn cancel_interaction(
&self,
id: &str,
options: GoogleInteractionOptions,
) -> Result<JsonValue, ProviderError>
pub async fn cancel_interaction( &self, id: &str, options: GoogleInteractionOptions, ) -> Result<JsonValue, ProviderError>
Stops an interaction on the server, including a background run.
§Errors
Returns an invalid argument error for an empty ID, or an HTTP/provider error.
Trait Implementations§
Source§impl Clone for GoogleInteractionsLanguageModel
impl Clone for GoogleInteractionsLanguageModel
Source§fn clone(&self) -> GoogleInteractionsLanguageModel
fn clone(&self) -> GoogleInteractionsLanguageModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl LanguageModel for GoogleInteractionsLanguageModel
impl LanguageModel for GoogleInteractionsLanguageModel
Source§fn provider(&self) -> &ProviderId
fn provider(&self) -> &ProviderId
Provider identifier, for example
openai.responses.Source§async fn supported_urls(&self) -> SupportedUrls
async fn supported_urls(&self) -> SupportedUrls
URL patterns (by media type) the provider can fetch itself. Read more
Source§async fn do_generate(
&self,
options: CallOptions,
) -> Result<GenerateResult, ProviderError>
async fn do_generate( &self, options: CallOptions, ) -> Result<GenerateResult, ProviderError>
Generates a complete response.
Source§async fn do_stream(
&self,
options: CallOptions,
) -> Result<StreamResult, ProviderError>
async fn do_stream( &self, options: CallOptions, ) -> Result<StreamResult, ProviderError>
Generates a streamed response.
Auto Trait Implementations§
impl !RefUnwindSafe for GoogleInteractionsLanguageModel
impl !UnwindSafe for GoogleInteractionsLanguageModel
impl Freeze for GoogleInteractionsLanguageModel
impl Send for GoogleInteractionsLanguageModel
impl Sync for GoogleInteractionsLanguageModel
impl Unpin for GoogleInteractionsLanguageModel
impl UnsafeUnpin for GoogleInteractionsLanguageModel
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
Mutably borrows from an owned value. Read more