Skip to main content

upload_file

Function upload_file 

Source
pub async fn upload_file(
    file_data: &[u8],
    proxy: Option<&str>,
) -> Result<String>
Expand description

Uploads a file to the Gemini upload endpoint and returns the raw response text.

§Arguments

  • file_data - The file content as bytes
  • proxy - Optional proxy URL

§Returns

The file identifier string from the server

§Errors

Returns Error::Upload if the request fails, the response status is not successful, or the response body cannot be read.

There is no retry or polling behavior. External failures (upload endpoint availability or connectivity issues) are returned as errors.