pub struct AiService { /* private fields */ }Implementations§
Source§impl AiService
impl AiService
Sourcepub fn app(&self) -> &FirebaseApp
pub fn app(&self) -> &FirebaseApp
Returns the Firebase app associated with this AI service.
Sourcepub fn backend_type(&self) -> BackendType
pub fn backend_type(&self) -> BackendType
Returns the backend type tag.
Sourcepub fn options(&self) -> AiRuntimeOptions
pub fn options(&self) -> AiRuntimeOptions
Returns the runtime options currently applied to this AI service.
Sourcepub async fn prepare_generate_content_request(
&self,
model: &str,
body: Value,
request_options: Option<RequestOptions>,
) -> AiResult<PreparedRequest>
pub async fn prepare_generate_content_request( &self, model: &str, body: Value, request_options: Option<RequestOptions>, ) -> AiResult<PreparedRequest>
Prepares a REST request for a generateContent call without executing it.
This mirrors the behaviour of constructRequest in the TypeScript SDK and allows advanced
callers to integrate with custom HTTP stacks while the SDK handles URL/header generation.
Sourcepub async fn generate_text(
&self,
request: GenerateTextRequest,
) -> AiResult<GenerateTextResponse>
pub async fn generate_text( &self, request: GenerateTextRequest, ) -> AiResult<GenerateTextResponse>
Generates text using the configured backend.
This issues a generateContent REST call against the active backend, attaching
auth and App Check credentials when available. The optional
RequestOptions can override the base URL or timeout, which is primarily
intended for tests and emulator scenarios.
§Examples
let response = ai
.generate_text(GenerateTextRequest {
prompt: "Hello Gemini".to_owned(),
model: None,
request_options: None,
})
.await?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for AiService
impl RefUnwindSafe for AiService
impl Send for AiService
impl Sync for AiService
impl Unpin for AiService
impl UnwindSafe for AiService
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