gemini_crate 0.1.0

A robust Rust client library for Google's Gemini AI API with built-in error handling, retry logic, and comprehensive model support
Documentation
//! This module contains the request and response types for the Gemini API.
use serde::{Deserialize, Serialize};

/// The request to generate content.
#[derive(Serialize, Debug, Clone)]
pub struct GenerateContentRequest {
    /// The contents of the conversation.
    pub contents: Vec<Content>,
}

/// The content of a conversation.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Content {
    /// The role of the author of this content.
    pub role: Role,
    /// The parts of the content.
    pub parts: Vec<Part>,
}

/// The role of the author of a message.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "lowercase")]
pub enum Role {
    /// The user.
    User,
    /// The model.
    Model,
}

/// A part of a conversation.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Part {
    /// The text of the part.
    pub text: String,
}

/// The response from a generate content request.
#[derive(Deserialize, Debug)]
pub struct GenerateContentResponse {
    /// The candidates generated by the model.
    pub candidates: Vec<Candidate>,
}

/// A candidate generated by the model.
#[derive(Deserialize, Debug)]
pub struct Candidate {
    /// The content of the candidate.
    pub content: Content,
}