{
  "name": "forge-provider-google",
  "language": "rust",
  "version": "0.2.0",
  "description": "Google Gemini provider for the Forge SDK \u2014 implements the LanguageModel trait for Google Generative Language API",
  "manifest": "forge-rs/crates/forge-provider-google/Cargo.toml",
  "manifestSha256": "7a9daf4d2e98109e3b8dcfccc836e94610365ae48596b85d73096b33ac89d6e3",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/rust/forge-provider-google",
  "features": {},
  "files": [
    {
      "path": "forge-rs/crates/forge-provider-google/src/client.rs",
      "sha256": "22206e4617aab90aa7bd7a84af1532e64e579c0cf6006c81227b9629716261d0",
      "artifactSha256": "c987fb92a8d3e1fe715224a1a00a72d92abd49518a80eed5f683cf2fb1e8f930",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/client.rs.txt",
      "declarations": [
        {
          "name": "::GoogleHttpClient",
          "line": 47,
          "signature": "#[derive(Clone)]\npub struct GoogleHttpClient {\n\n}",
          "documentation": "HTTP client for the Google Gemini API.\n\nWraps `hyper` with TLS support and provides methods for both synchronous\n(buffered) and streaming API calls. The client handles URL construction,\nAPI key injection, serialization, and retry logic.\n\n# Examples\n\n```no_run\nuse forge_provider_google::{GoogleConfig, GoogleError};\nuse forge_provider_google::client::GoogleHttpClient;\n\n# async fn example() -> Result<(), GoogleError> {\nlet config = GoogleConfig::builder(\"your-key\").build();\nlet client = GoogleHttpClient::new(config)?;\n# Ok(())\n# }\n```"
        },
        {
          "name": "::GoogleHttpClient::new",
          "line": 68,
          "signature": "pub fn new(config: GoogleConfig) -> Result<Self, GoogleError>;",
          "documentation": "Creates a new HTTP client for the Gemini API.\n\n# Arguments\n\n* `config` - The Google provider configuration.\n\n# Returns\n\nA configured HTTP client, or an error if the configuration is invalid.\n\n# Errors\n\nReturns [`GoogleError::MissingApiKey`] if the API key is empty."
        },
        {
          "name": "::GoogleHttpClient::generate_content",
          "line": 96,
          "signature": "pub async fn generate_content(\n        &self,\n        model: &str,\n        request: &GenerateContentRequest,\n    ) -> Result<GenerateContentResponse, GoogleError>;",
          "documentation": "Sends a `generateContent` request and returns the parsed response.\n\nIncludes retry logic for transient failures (HTTP 429, 500, 502, 503, 504).\n\n# Arguments\n\n* `model` - The model identifier (e.g., `\"gemini-2.5-pro\"`).\n* `request` - The generate content request body.\n\n# Returns\n\nThe parsed API response, or an error if the request fails after retries.\n\n# Errors\n\n- [`GoogleError::HttpError`] if the HTTP request itself fails.\n- [`GoogleError::ApiError`] if the API returns a non-2xx status.\n- [`GoogleError::DeserializationError`] if the response cannot be parsed.\n- [`GoogleError::Timeout`] if the request exceeds the configured timeout."
        },
        {
          "name": "::GoogleHttpClient::stream_generate_content",
          "line": 137,
          "signature": "pub async fn stream_generate_content(\n        &self,\n        model: &str,\n        request: &GenerateContentRequest,\n    ) -> Result<Vec<u8>, GoogleError>;",
          "documentation": "Sends a `streamGenerateContent` request and returns the raw SSE bytes.\n\nThe caller is responsible for parsing the SSE stream using the `sse` module.\n\n# Arguments\n\n* `model` - The model identifier.\n* `request` - The generate content request body.\n\n# Returns\n\nThe raw response bytes (SSE stream content), or an error.\n\n# Errors\n\n- [`GoogleError::HttpError`] if the HTTP request fails.\n- [`GoogleError::ApiError`] if the API returns a non-2xx status.\n- [`GoogleError::Timeout`] if the request exceeds the configured timeout."
        },
        {
          "name": "::GoogleHttpClient::stream_generate_content_body",
          "line": 161,
          "signature": "pub async fn stream_generate_content_body(\n        &self,\n        model: &str,\n        request: &GenerateContentRequest,\n    ) -> Result<hyper::body::Incoming, GoogleError>;",
          "documentation": "Sends a `streamGenerateContent` request and returns the response body\n**without collecting it**. Used by `LanguageModel::stream_chunks`\n(RFC 0001 / F-6 / F-7) to deliver Gemini SSE events to consumers as\nthe upstream wire produces them.\n\nConnect-time errors (auth, malformed request, non-2xx status) surface\nhere on the outer Result; mid-stream errors land as per-item errors\non the consumer's stream. No retry \u2014 partial streamed responses can't\nbe resumed cleanly."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/config.rs",
      "sha256": "e373add2b5f3e5badb2adc57a3fa821efd1d5a3bd771b892d6f169c000f8572c",
      "artifactSha256": "5e53c7d59d9669c5f32abec1e22c1193fdbd166bf6b1eb6c4f1c58e1338e0e20",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/config.rs.txt",
      "declarations": [
        {
          "name": "::DEFAULT_BASE_URL",
          "line": 31,
          "signature": "pub const DEFAULT_BASE_URL: &str;",
          "documentation": "Default base URL for the Google Generative Language API."
        },
        {
          "name": "::GoogleConfig",
          "line": 61,
          "signature": "#[derive(Clone)]\npub struct GoogleConfig {\n\n}",
          "documentation": "Configuration for the Google Gemini language model provider.\n\nContains the API key, base URL, timeout, and retry settings. Construct\ninstances via [`GoogleConfig::builder`].\n\n# Security\n\nThe `Debug` implementation redacts the API key to prevent accidental\nexposure in logs. The API key is never included in any log output,\ntrace span, or error message produced by this crate.\n\n# Examples\n\n```\nuse forge_provider_google::GoogleConfig;\n\nlet config = GoogleConfig::builder(\"my-key\").build();\nlet debug_output = format!(\"{:?}\", config);\nassert!(debug_output.contains(\"[REDACTED]\"));\nassert!(!debug_output.contains(\"my-key\"));\n```"
        },
        {
          "name": "::GoogleConfig::builder",
          "line": 94,
          "signature": "pub fn builder(api_key: impl Into<String>) -> GoogleConfigBuilder;",
          "documentation": "Creates a new configuration builder with the given API key.\n\n# Arguments\n\n* `api_key` - The Google API key for Gemini. This is sent as a query\n  parameter on every request.\n\n# Returns\n\nA [`GoogleConfigBuilder`] for further configuration.\n\n# Examples\n\n```\nuse forge_provider_google::GoogleConfig;\n\nlet config = GoogleConfig::builder(\"your-api-key\")\n    .base_url(\"https://custom-endpoint.example.com/v1beta\")\n    .timeout_seconds(30)\n    .build();\n```"
        },
        {
          "name": "::GoogleConfig::base_url",
          "line": 114,
          "signature": "pub fn base_url(&self) -> &str;",
          "documentation": "Returns the base URL for the Gemini API."
        },
        {
          "name": "::GoogleConfig::timeout_seconds",
          "line": 119,
          "signature": "pub fn timeout_seconds(&self) -> u64;",
          "documentation": "Returns the request timeout in seconds."
        },
        {
          "name": "::GoogleConfig::max_retries",
          "line": 124,
          "signature": "pub fn max_retries(&self) -> u32;",
          "documentation": "Returns the maximum number of retries for transient failures."
        },
        {
          "name": "::GoogleConfig::validate",
          "line": 134,
          "signature": "pub fn validate(&self) -> Result<(), GoogleError>;",
          "documentation": "Validates the configuration, returning an error if required fields\nare missing or invalid.\n\n# Errors\n\nReturns [`GoogleError::MissingApiKey`] if the API key is empty."
        },
        {
          "name": "::GoogleConfigBuilder",
          "line": 169,
          "signature": "pub struct GoogleConfigBuilder {\n\n}",
          "documentation": "Builder for [`GoogleConfig`].\n\nConstructed via [`GoogleConfig::builder`]. All fields have sensible defaults\nexcept `api_key`, which must be provided at builder creation.\n\n# Examples\n\n```\nuse forge_provider_google::GoogleConfig;\n\nlet config = GoogleConfig::builder(\"key\")\n    .timeout_seconds(60)\n    .max_retries(5)\n    .build();\n```"
        },
        {
          "name": "::GoogleConfigBuilder::base_url",
          "line": 183,
          "signature": "pub fn base_url(mut self, url: impl Into<String>) -> Self;",
          "documentation": "Sets a custom base URL for the Gemini API.\n\n# Arguments\n\n* `url` - The base URL (without trailing slash). Defaults to\n  `https://generativelanguage.googleapis.com/v1beta`."
        },
        {
          "name": "::GoogleConfigBuilder::timeout_seconds",
          "line": 193,
          "signature": "pub fn timeout_seconds(mut self, seconds: u64) -> Self;",
          "documentation": "Sets the request timeout in seconds.\n\n# Arguments\n\n* `seconds` - Timeout in seconds. Defaults to 120."
        },
        {
          "name": "::GoogleConfigBuilder::max_retries",
          "line": 203,
          "signature": "pub fn max_retries(mut self, retries: u32) -> Self;",
          "documentation": "Sets the maximum number of retries for transient failures (5xx, timeouts).\n\n# Arguments\n\n* `retries` - Maximum retry count. Defaults to 2."
        },
        {
          "name": "::GoogleConfigBuilder::build",
          "line": 213,
          "signature": "pub fn build(self) -> GoogleConfig;",
          "documentation": "Builds the [`GoogleConfig`].\n\n# Returns\n\nA fully configured [`GoogleConfig`] instance."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/error.rs",
      "sha256": "66c5937121962fe1497d4cd193fbf5f216225a5ef03c2fc5eaf5f652099eaadf",
      "artifactSha256": "b04f9101e661cdd433ca109e8b942a2254f7f14a3a21e5f76710cd3fb892e1a4",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/error.rs.txt",
      "declarations": [
        {
          "name": "::GoogleError",
          "line": 32,
          "signature": "#[derive(Debug, Error)]\npub enum GoogleError {\n    /// The API key was not provided in the configuration.\n    #[error(\"Google API key is missing: provide it via GoogleConfig::builder(api_key) or the GOOGLE_API_KEY environment variable\")]\n    MissingApiKey,\n\n    /// The model identifier is empty or invalid.\n    #[error(\"invalid model identifier '{model_id}': model ID must be a non-empty string (e.g., 'gemini-2.5-pro', 'gemini-2.5-flash')\")]\n    InvalidModelId {\n        /// The invalid model identifier that was provided.\n        model_id: String,\n    },\n\n    /// An HTTP request to the Gemini API failed.\n    #[error(\"HTTP request to Google Gemini API failed: {reason} (url: {url})\")]\n    HttpError {\n        /// The URL that was being requested.\n        url: String,\n        /// A description of the failure.\n        reason: String,\n    },\n\n    /// The Gemini API returned a non-success HTTP status code.\n    #[error(\"Google Gemini API returned HTTP {status_code}: {body} (model: {model})\")]\n    ApiError {\n        /// The HTTP status code returned.\n        status_code: u16,\n        /// The response body (may contain error details from Google).\n        body: String,\n        /// The model that was being called.\n        model: String,\n    },\n\n    /// The Gemini API response could not be deserialized.\n    #[error(\"failed to deserialize Google Gemini API response: {reason} (raw: {raw_body})\")]\n    DeserializationError {\n        /// A description of what was expected.\n        reason: String,\n        /// The raw response body that failed to parse (truncated to 500 chars).\n        raw_body: String,\n    },\n\n    /// The Gemini API response contained no candidates.\n    #[error(\"Google Gemini API returned no candidates for model '{model}': the response was empty or all candidates were filtered\")]\n    EmptyResponse {\n        /// The model that was called.\n        model: String,\n    },\n\n    /// An SSE stream event could not be parsed.\n    #[error(\"failed to parse SSE stream event: {reason}\")]\n    SseParseError {\n        /// A description of what went wrong.\n        reason: String,\n    },\n\n    /// A request timed out.\n    #[error(\"request to Google Gemini API timed out after {timeout_seconds}s (model: {model})\")]\n    Timeout {\n        /// The timeout duration in seconds.\n        timeout_seconds: u64,\n        /// The model that was being called.\n        model: String,\n    },\n\n    /// Message translation failed.\n    #[error(\"failed to translate message to Gemini format: {reason}\")]\n    MessageTranslationError {\n        /// A description of what went wrong.\n        reason: String,\n    },\n\n    /// The Gemini API indicated content was blocked by safety filters.\n    #[error(\"Google Gemini API blocked content for model '{model}': safety filter triggered (finish_reason: SAFETY)\")]\n    SafetyBlocked {\n        /// The model that was called.\n        model: String,\n    },\n}",
          "documentation": "Errors that can occur during interaction with the Google Gemini API.\n\nEach variant includes actionable context: what failed, what was expected,\nand what the developer should check.\n\n# Conversion\n\nAll variants convert to [`ForgeError`] via `From<GoogleError>`, so callers\nworking with `ForgeResult<T>` can use the `?` operator transparently.\n\n# Examples\n\n```\nuse forge_provider_google::GoogleError;\n\nlet err = GoogleError::MissingApiKey;\nlet msg = err.to_string();\nassert!(msg.contains(\"API key\"));\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/lib.rs",
      "sha256": "4ddf1534f16b87941e35bb88e54d69bbdf3bcc484cc7bca71d749e4c16549921",
      "artifactSha256": "f7f302d0be1fde8fadee3f70981778ac1e85c625522a95848f0fcf7360edaf0b",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/lib.rs.txt",
      "declarations": [
        {
          "name": "client",
          "line": 69,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod client;",
          "documentation": "# forge-provider-google\n\nGoogle Gemini provider for the Forge SDK, implementing the\n[`LanguageModel`](forge_core::model::LanguageModel) trait from `forge-core` for the\n[Google Generative Language API](https://ai.google.dev/api).\n\nThis crate translates between Forge's provider-agnostic message types and\nGoogle Gemini's API format. It handles authentication via API key query\nparameters, SSE streaming for `streamGenerateContent`, and tool calling\nvia `functionDeclarations`.\n\n# ANVIL Spec Reference\n\nANVIL Spec S6.1 -- Cognitive Interface: this provider satisfies the\n`LanguageModel` contract for the `google` namespace.\n\n# Supported Models\n\n- `gemini-2.5-pro` -- flagship model with full feature set\n- `gemini-2.5-flash` -- fast, cost-effective model\n- `gemini-2.0-flash` -- previous generation fast model\n- `gemini-1.5-pro`, `gemini-1.5-flash` -- legacy models\n\nAll models support tool calling, structured output, image input, and streaming.\n\n# API Differences from OpenAI/Anthropic\n\n- Authentication: API key as query parameter (`?key=...`), not an HTTP header.\n- Role mapping: Forge `Role::Assistant` maps to Gemini `\"model\"`.\n- System instructions: Sent as top-level `systemInstruction`, not as a message.\n- Tool format: `functionDeclarations` with `functionCall`/`functionResponse` parts.\n- Streaming: Server-Sent Events on `streamGenerateContent?alt=sse`.\n\n# Examples\n\n```no_run\nuse forge_provider_google::{GoogleLanguageModel, GoogleConfig};\nuse forge_core::model::LanguageModel;\nuse forge_core::message::{ModelMessage, Role};\nuse forge_core::config::GenerateOptions;\n\n# async fn example() -> Result<(), Box<dyn std::error::Error>> {\nlet config = GoogleConfig::builder(\"your-api-key\")\n    .build();\n\nlet model = GoogleLanguageModel::new(\"gemini-2.5-pro\".to_string(), config)?;\n\nlet messages = vec![\n    ModelMessage::text(Role::System, \"You are a helpful assistant.\"),\n    ModelMessage::text(Role::User, \"What is 2+2?\"),\n];\n\nlet result = model.generate(&messages, &[], &GenerateOptions::default()).await?;\nprintln!(\"{}\", result.text());\n# Ok(())\n# }\n```\n\n# Security\n\n- API keys are **never** logged. The `Debug` implementation for [`GoogleConfig`]\n  redacts the key.\n- All HTTP communication uses TLS via `hyper-tls`.\n- No `unsafe` code -- enforced via `#![forbid(unsafe_code)]`."
        },
        {
          "name": "config",
          "line": 71,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod config;",
          "documentation": ""
        },
        {
          "name": "error",
          "line": 72,
          "signature": "pub mod error;",
          "documentation": ""
        },
        {
          "name": "model",
          "line": 74,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod model;",
          "documentation": ""
        },
        {
          "name": "sse",
          "line": 76,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod sse;",
          "documentation": ""
        },
        {
          "name": "types",
          "line": 77,
          "signature": "pub mod types;",
          "documentation": ""
        },
        {
          "name": "pub use config::{GoogleConfig, GoogleConfigBuilder};",
          "line": 80,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub use config::{GoogleConfig, GoogleConfigBuilder};",
          "documentation": ""
        },
        {
          "name": "pub use error::GoogleError;",
          "line": 81,
          "signature": "pub use error::GoogleError;",
          "documentation": ""
        },
        {
          "name": "pub use model::GoogleLanguageModel;",
          "line": 83,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub use model::GoogleLanguageModel;",
          "documentation": ""
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/model.rs",
      "sha256": "ba8ecb6a2090afb2513f7d2173a14e70e12cdba91bdcec81800aa713d5e0cfcb",
      "artifactSha256": "9777ed80663e9a7d93d1bf4b8e2348619b9136b04f23ea4dd89a2ace7b4bdd79",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/model.rs.txt",
      "declarations": [
        {
          "name": "::GoogleLanguageModel",
          "line": 83,
          "signature": "pub struct GoogleLanguageModel {\n\n}",
          "documentation": "Google Gemini language model implementing the Forge [`LanguageModel`] trait.\n\nTranslates Forge messages, tools, and options into Gemini API calls and\nconverts responses back to Forge types. Supports both synchronous (buffered)\nand streaming inference.\n\n# Supported Models\n\n| Model | Features |\n|-------|----------|\n| `gemini-2.5-pro` | Full: tools, images, streaming, structured output |\n| `gemini-2.5-flash` | Full: tools, images, streaming, structured output |\n| `gemini-2.0-flash` | Full: tools, images, streaming, structured output |\n| `gemini-1.5-pro` | Full: tools, images, streaming, structured output |\n| `gemini-1.5-flash` | Full: tools, images, streaming, structured output |\n\n# Examples\n\n```no_run\nuse forge_provider_google::{GoogleLanguageModel, GoogleConfig};\nuse forge_core::model::LanguageModel;\nuse forge_core::message::{ModelMessage, Role};\nuse forge_core::config::GenerateOptions;\n\n# async fn example() -> Result<(), Box<dyn std::error::Error>> {\nlet config = GoogleConfig::builder(\"your-api-key\").build();\nlet model = GoogleLanguageModel::new(\"gemini-2.5-pro\".to_string(), config)?;\n\nassert_eq!(model.provider(), \"google\");\nassert_eq!(model.model_id(), \"gemini-2.5-pro\");\nassert!(model.supports_tool_calling());\nassert!(model.supports_image_input());\n# Ok(())\n# }\n```"
        },
        {
          "name": "::GoogleLanguageModel::new",
          "line": 116,
          "signature": "pub fn new(model_id: String, config: GoogleConfig) -> Result<Self, GoogleError>;",
          "documentation": "Creates a new Google Gemini language model instance.\n\n# Arguments\n\n* `model_id` - The Gemini model identifier (e.g., `\"gemini-2.5-pro\"`).\n* `config` - The Google provider configuration with API key and settings.\n\n# Returns\n\nA configured language model instance, or an error if configuration is invalid.\n\n# Errors\n\n- [`GoogleError::InvalidModelId`] if the model ID is empty.\n- [`GoogleError::MissingApiKey`] if the API key is empty.\n\n# Examples\n\n```no_run\nuse forge_provider_google::{GoogleLanguageModel, GoogleConfig};\n\nlet config = GoogleConfig::builder(\"your-key\").build();\nlet model = GoogleLanguageModel::new(\"gemini-2.5-flash\".to_string(), config);\nassert!(model.is_ok());\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/sse.rs",
      "sha256": "870913569b27e96d1ea787ecbb1a4bfbb1f5e9c128b7f24c83698c01e4ba0003",
      "artifactSha256": "971dba0f6c7974283ede176f00bd3f75c1f58581fe938f6ff246695bf1408bac",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/sse.rs.txt",
      "declarations": [
        {
          "name": "::parse_sse_stream",
          "line": 48,
          "signature": "pub fn parse_sse_stream(raw: &[u8]) -> Result<Vec<GenerateContentResponse>, GoogleError>;",
          "documentation": "Parses SSE-formatted bytes into a sequence of [`GenerateContentResponse`] objects.\n\nThe Gemini streaming API returns `data: {json}\\n\\n` formatted events.\nThis function extracts each JSON payload and deserializes it.\n\n# Arguments\n\n* `raw` - The raw SSE response bytes from the streaming endpoint.\n\n# Returns\n\nA vector of parsed responses (one per SSE event), or an error if parsing fails.\n\n# Errors\n\nReturns [`GoogleError::SseParseError`] if an SSE `data:` line contains\ninvalid JSON that cannot be deserialized into a [`GenerateContentResponse`].\n\n# Examples\n\n```\nuse forge_provider_google::sse::parse_sse_stream;\n\nlet raw = b\"data: {\\\"candidates\\\": [], \\\"usageMetadata\\\": {\\\"promptTokenCount\\\": 0, \\\"candidatesTokenCount\\\": 0, \\\"totalTokenCount\\\": 0}}\\n\\n\";\nlet events = parse_sse_stream(raw);\nassert!(events.is_ok());\n```"
        },
        {
          "name": "::GoogleSseDecoder",
          "line": 129,
          "signature": "pub struct GoogleSseDecoder {\n\n}",
          "documentation": "Stateful SSE decoder for incremental Gemini streams.\n\nBuffers partial events across `feed(&[u8])` calls and yields complete\n[`GenerateContentResponse`] values via `drain()`.\n\n# Examples\n\n```\nuse forge_provider_google::sse::GoogleSseDecoder;\n\nlet mut decoder = GoogleSseDecoder::new();\ndecoder\n    .feed(b\"data: {\\\"candidates\\\": []}\\n\\n\")\n    .unwrap();\nlet events = decoder.drain();\nassert_eq!(events.len(), 1);\n```"
        },
        {
          "name": "::GoogleSseDecoder::new",
          "line": 138,
          "signature": "pub fn new() -> Self;",
          "documentation": "Creates a new, empty decoder."
        },
        {
          "name": "::GoogleSseDecoder::feed",
          "line": 147,
          "signature": "pub fn feed(&mut self, bytes: &[u8]) -> Result<(), GoogleError>;",
          "documentation": "Feeds raw bytes into the decoder. Any complete events that become\navailable are queued; call [`drain`](Self::drain) to take them."
        },
        {
          "name": "::GoogleSseDecoder::drain",
          "line": 189,
          "signature": "pub fn drain(&mut self) -> Vec<GenerateContentResponse>;",
          "documentation": "Drains all events ready to be consumed."
        },
        {
          "name": "::GoogleSseDecoder::finish",
          "line": 195,
          "signature": "pub fn finish(&mut self) -> Result<Vec<GenerateContentResponse>, GoogleError>;",
          "documentation": "Signals end-of-stream, processing any leftover unterminated bytes\nas a best-effort final line."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-provider-google/src/types.rs",
      "sha256": "bdbc0f5edcf667b3dbb6feb334ad7e3b3ff5a17992fa9fe2258bb479ec5f6ef6",
      "artifactSha256": "95b3bb6e9f139fc98f073047224846a3c1ec38f90b5d92ab188d3516728a530b",
      "url": "/reference/source/forge-rs/crates/forge-provider-google/src/types.rs.txt",
      "declarations": [
        {
          "name": "::GenerateContentRequest",
          "line": 26,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct GenerateContentRequest {\n/// The conversation contents (user and model turns).\n\npub contents: Vec<GeminiContent>,\n/// System-level instructions, sent outside the conversation turns.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub system_instruction: Option<GeminiContent>,\n/// Tool configurations (function declarations).\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub tools: Option<Vec<GeminiToolConfig>>,\n/// Generation parameters (temperature, max tokens, etc.).\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub generation_config: Option<GenerationConfig>\n}",
          "documentation": "Top-level request body for the `generateContent` endpoint.\n\nSee: <https://ai.google.dev/api/generate-content#v1beta.models.generateContent>"
        },
        {
          "name": "::GeminiContent",
          "line": 48,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct GeminiContent {\n/// The role of this content block: `\"user\"` or `\"model\"`.\n\n/// System instructions may omit the role.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub role: Option<String>,\n/// The content parts (text, function calls, function responses, images).\n\npub parts: Vec<GeminiPart>\n}",
          "documentation": "A single content block in the Gemini conversation.\n\nEach content block has an optional role (`\"user\"` or `\"model\"`) and\none or more parts. System instructions omit the role."
        },
        {
          "name": "::GeminiPart",
          "line": 74,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(untagged)]\npub enum GeminiPart {\n    /// A text part: `{\"text\": \"...\"}`.\n    Text {\n        /// The text content.\n        text: String,\n    },\n\n    /// A function call emitted by the model: `{\"functionCall\": {...}}`.\n    FunctionCall {\n        /// The function call details.\n        #[serde(rename = \"functionCall\")]\n        function_call: FnCall,\n    },\n\n    /// A function response provided by the client: `{\"functionResponse\": {...}}`.\n    FunctionResponse {\n        /// The function response details.\n        #[serde(rename = \"functionResponse\")]\n        function_response: FnResponse,\n    },\n\n    /// Inline binary data (images, etc.): `{\"inlineData\": {...}}`.\n    InlineData {\n        /// The binary data with MIME type.\n        #[serde(rename = \"inlineData\")]\n        inline_data: Blob,\n    },\n}",
          "documentation": "A single part within a [`GeminiContent`] block.\n\nParts use `#[serde(untagged)]` to match the Gemini API wire format where\neach part is a flat JSON object with exactly one identifying field:\n`\"text\"`, `\"functionCall\"`, `\"functionResponse\"`, or `\"inlineData\"`.\n\n# Wire Format Examples\n\n```json\n{\"text\": \"Hello, world!\"}\n{\"functionCall\": {\"name\": \"get_weather\", \"args\": {\"city\": \"NYC\"}}}\n{\"functionResponse\": {\"name\": \"get_weather\", \"response\": {...}}}\n{\"inlineData\": {\"mimeType\": \"image/png\", \"data\": \"iVBOR...\"}}\n```"
        },
        {
          "name": "::GeminiPart::text",
          "line": 109,
          "signature": "pub fn text(text: impl Into<String>) -> Self;",
          "documentation": "Creates a text part.\n\n# Arguments\n\n* `text` - The text content."
        },
        {
          "name": "::GeminiPart::function_call",
          "line": 119,
          "signature": "pub fn function_call(name: impl Into<String>, args: serde_json::Value) -> Self;",
          "documentation": "Creates a function call part.\n\n# Arguments\n\n* `name` - The function name.\n* `args` - The function arguments as a JSON value."
        },
        {
          "name": "::GeminiPart::function_response",
          "line": 134,
          "signature": "pub fn function_response(name: impl Into<String>, response: serde_json::Value) -> Self;",
          "documentation": "Creates a function response part.\n\n# Arguments\n\n* `name` - The function name this response corresponds to.\n* `response` - The function output as a JSON value."
        },
        {
          "name": "::GeminiPart::inline_data",
          "line": 149,
          "signature": "pub fn inline_data(mime_type: impl Into<String>, data: impl Into<String>) -> Self;",
          "documentation": "Creates an inline data part (for images).\n\n# Arguments\n\n* `mime_type` - The MIME type (e.g., `\"image/png\"`).\n* `data` - Base64-encoded binary data."
        },
        {
          "name": "::FnCall",
          "line": 161,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct FnCall {\n/// The function name to invoke.\n\npub name: String,\n/// The arguments as a JSON object.\n\npub args: serde_json::Value\n}",
          "documentation": "A function call from the model."
        },
        {
          "name": "::FnResponse",
          "line": 170,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct FnResponse {\n/// The function name this response corresponds to.\n\npub name: String,\n/// The function output as a JSON value.\n\npub response: serde_json::Value\n}",
          "documentation": "A function response to feed back to the model."
        },
        {
          "name": "::Blob",
          "line": 180,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct Blob {\n/// The MIME type (e.g., `\"image/png\"`, `\"image/jpeg\"`).\n\npub mime_type: String,\n/// Base64-encoded binary data.\n\npub data: String\n}",
          "documentation": "Inline binary data (e.g., images) with a MIME type."
        },
        {
          "name": "::GeminiToolConfig",
          "line": 190,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct GeminiToolConfig {\n/// The function declarations available to the model.\n\npub function_declarations: Vec<FunctionDeclaration>\n}",
          "documentation": "Tool configuration containing function declarations."
        },
        {
          "name": "::FunctionDeclaration",
          "line": 197,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct FunctionDeclaration {\n/// The function name.\n\npub name: String,\n/// A description of what the function does.\n\npub description: String,\n/// The parameter schema as a JSON Schema object.\n\npub parameters: serde_json::Value\n}",
          "documentation": "A single function declaration (tool definition in Gemini format)."
        },
        {
          "name": "::GenerationConfig",
          "line": 209,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct GenerationConfig {\n/// Sampling temperature (0.0 to 2.0).\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub temperature: Option<f64>,\n/// Maximum number of tokens to generate.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub max_output_tokens: Option<u32>,\n/// Top-p (nucleus) sampling threshold.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub top_p: Option<f64>,\n/// Stop sequences -- generation stops when any of these appear.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub stop_sequences: Option<Vec<String>>\n}",
          "documentation": "Generation parameters controlling model output."
        },
        {
          "name": "::GenerateContentResponse",
          "line": 236,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct GenerateContentResponse {\n/// The generated candidates (typically one).\n\n#[serde(default)]\npub candidates: Vec<Candidate>,\n/// Token usage metadata.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub usage_metadata: Option<UsageMetadata>\n}",
          "documentation": "Top-level response from the `generateContent` endpoint.\n\nSee: <https://ai.google.dev/api/generate-content#v1beta.GenerateContentResponse>"
        },
        {
          "name": "::Candidate",
          "line": 249,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct Candidate {\n/// The generated content.\n\npub content: GeminiContent,\n/// The reason generation stopped for this candidate.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub finish_reason: Option<String>\n}",
          "documentation": "A single generation candidate."
        },
        {
          "name": "::UsageMetadata",
          "line": 261,
          "signature": "#[derive(Debug, Clone, Copy, Serialize, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct UsageMetadata {\n/// Number of tokens in the input prompt.\n\n#[serde(default)]\npub prompt_token_count: u64,\n/// Number of tokens in the generated candidates.\n\n#[serde(default)]\npub candidates_token_count: u64,\n/// Total token count (prompt + candidates).\n\n#[serde(default)]\npub total_token_count: u64\n}",
          "documentation": "Token usage metadata from the API response."
        },
        {
          "name": "::GoogleApiErrorResponse",
          "line": 277,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct GoogleApiErrorResponse {\n/// The error details.\n\npub error: GoogleApiErrorDetail\n}",
          "documentation": "Google API error response format."
        },
        {
          "name": "::GoogleApiErrorDetail",
          "line": 284,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct GoogleApiErrorDetail {\n/// HTTP status code.\n\npub code: u16,\n/// Error message.\n\npub message: String,\n/// Error status string (e.g., \"INVALID_ARGUMENT\").\n\n#[serde(default)]\npub status: String\n}",
          "documentation": "Error detail within a Google API error response."
        }
      ]
    }
  ]
}
