Skip to main content

elizaos_plugin_google_genai/
lib.rs

1//! Google GenAI plugin for elizaOS.
2//!
3//! This crate provides a client for interacting with Google's Generative AI (Gemini) API,
4//! supporting text generation, embeddings, and image analysis capabilities.
5
6#![warn(missing_docs)]
7#![deny(unsafe_code)]
8
9pub mod client;
10pub mod config;
11pub mod error;
12pub mod models;
13pub mod types;
14
15#[cfg(feature = "wasm")]
16pub mod wasm;
17
18pub use client::GoogleGenAIClient;
19pub use config::GoogleGenAIConfig;
20pub use error::{GoogleGenAIError, Result};
21pub use models::{Model, ModelSize};
22pub use types::{
23    EmbeddingParams, EmbeddingResponse, ObjectGenerationParams, TextGenerationParams,
24    TextGenerationResponse,
25};
26
27/// Creates a new Google GenAI client using configuration from environment variables.
28///
29/// This is a convenience function that reads the API key and other settings
30/// from environment variables and creates a configured client instance.
31///
32/// # Errors
33///
34/// Returns an error if required environment variables are missing or invalid.
35pub fn create_client_from_env() -> Result<GoogleGenAIClient> {
36    let config = GoogleGenAIConfig::from_env()?;
37    GoogleGenAIClient::new(config)
38}
39
40/// The name identifier for this plugin.
41pub const PLUGIN_NAME: &str = "google-genai";
42
43/// A human-readable description of this plugin's functionality.
44pub const PLUGIN_DESCRIPTION: &str =
45    "Google GenAI Gemini API client with text generation, embeddings, and image analysis support";
46
47/// The version of this plugin, derived from Cargo.toml.
48pub const PLUGIN_VERSION: &str = env!("CARGO_PKG_VERSION");