gemini-rust

A demo for using Google's Vertex API / Gemini demos in Rust via the REST API.

Stars
6

Vertex API / Gemini in Rust Rust

A port of the Vertex API Gemini demos by Mete Atamel to Rust.

Running the demos

  1. Enable the Vertex AI API in the Cloud Console.
  2. Install the Google Cloud SDK is insalled and configured and that you are logged in into an account with the Vertex API enabled in the Cloud Console. You can use gcloud auth login to log in.
  3. Ensure you have the following environment variables set:
  • API_ENDPOINT: The endpoint of the Vertex AI API.
  • PROJECT_ID: The ID of the project to use.
  • LOCATION_ID: The ID of the location to use (also called region).

Alternatively, create .cargo/config.toml with the following content:

[env]
API_ENDPOINT="<api endpoint>"
PROJECT_ID="<project id>"
LOCATION_ID="<location id (also called region)"
  1. Run one of the demos:
  • generate-text-from-image-gcs: Generates text from an image in Google Could Storage.
  • generate-text-from-image-local: Generate text from an local image.
  • generate-text-from-text: Generate text from text.

Run with cargo run --bin <demo name>.