Table of Contents

Namespace GenerativeAI

Entry points of the core SDK (Google_GenerativeAI package): the GoogleAi (Gemini API) and VertexAI platforms and their adapters, GenerativeModel, ChatSession, EmbeddingModel, VideoGenerationModel, the model constants (GoogleAIModels, VertexAIModels) and the extension methods for building requests and reading responses.

Classes

ApiVersions

Represents a static class containing string constants for different versions of the API. These versions are to be used across the application for interacting with services or constructing API request URLs where versioning is required.

BaseModel

The BaseModel class is an abstract representation of the model interactions in the GenerativeAI library. It serves as a foundational implementation that enables derived classes to interact with the GenerativeAI platform. This class inherits from BaseClient. It provides protected methods for use by derived classes, allowing them to handle content generation, token management, and content embedding functionalities. BaseModel is designed for flexible extension, enabling the development of specific AI model implementations.

BaseUrls

Provides constant URLs used as base endpoints for various AI platform services in the GenerativeAI namespace. This class contains static members that define the foundational endpoints required for API calls in services implementing generative and AI capabilities.

ChatSession
ContentExtensions

Provides extension methods for the Content class, allowing operations such as adding parts, handling inline and remote files, adding text, and extracting code or JSON blocks.

ContentRequestExtensions

Contains extension methods for working with objects implementing IContentsRequest.

DefaultSerializerOptions

Represents a class providing default JSON serializer options for consistent serialization and deserialization behavior across the application.

EmbeddingModel

Represents a machine learning model for generating embeddings from input text or content. This model allows handling of single or batch embedding operations using various input types or formats. Inherits from the BaseModel class.

EnvironmentVariables

The EnvironmentVariables class provides access to various environment variables used for configuring Google AI services. These variables store information such as project ID, region, API keys, and authentication credentials. Default values are used for certain variables if they are not set.

FilesConstants

Defines a collection of constants representing supported MIME types for various file operations within the API.

FunctionCallExtensions

Provides extension methods for working with function call-related types.

GeminiModel

The GeminiModel class is a specialized implementation of the GenerativeModel, designed to provide capabilities for generative AI tasks. It supports multiple constructors for flexibility, allowing users to configure the model according to their specific requirements, including platform, API key, configuration, safety settings, and various other parameters.

GenAI

Represents the base class for generative AI services. This class provides a framework for generative AI capabilities, including the management of AI models, creation of generative and embedding models, and interacting with generative AI infrastructure.

GenerateAnswerResponseExtension

Provides extension methods for GenerateAnswerResponse objects.

GenerateContentRequestExtensions

Provides extension methods for enhancing the functionality of the GenerateContentRequest class.

GenerateContentResponseExtensions

Provides extension methods for the GenerateContentResponse type in the GenerativeAI.Types namespace.

GenerateImageRequestExtensions

Provides extension methods for the GenerateImageRequest class.

GenerativeModel

A Generative AI Model that extends BaseModel

GenerativeModelTasks

The GenerativeModelTasks class defines a set of constant task names used to interact with generative AI models. These tasks are used across various operations for processing and generating content, embeddings, and token analysis.

GoogleAICredentials

Represents the credentials required to authenticate with Google AI Generative APIs. This class encapsulates the API key and an optional access token necessary for making authorized API calls.

GoogleAIModels

Provides constants for Gemini model variations and related information.

GoogleAIModels.Agents

Provides constants for Gemini agent models.

GoogleAIModels.Experimental

Provides constants for experimental Gemini model variations.

GoogleAIModels.Imagen

Provides constants for Imagen model variations.

GoogleAIModels.Music

Provides constants for Lyria music generation models.

GoogleAIModels.Video

Provides constants for video generation model variations.

GoogleAIPlatformAdapter

The GoogleAIPlatformAdapter class provides an implementation of the IPlatformAdapter interface to integrate with Google AI Generative API. It handles authorization, URL generation, and credential management for making requests to the Google AI platform.

GoogleAi

The GoogleAI class serves as the main entry point for interacting with Google's AI models. It provides methods to create generative and embedding models, as well as manage and retrieve model details. This class integrates Google's AI platform capabilities by utilizing appropriate models and configurations to handle generative AI tasks, embeddings, and other related operations.

ImageCaptioningRequestExtensions

Extension methods for configuring ImageCaptioningRequest objects with image data.

ImageConfigValues

Provides common values for image generation configuration. These constants are provided for convenience and discoverability but are not restrictive; any valid string value accepted by the API can be used.

ImageConfigValues.AspectRatios

Common aspect ratios for image generation.

ImageConfigValues.ImageSizes

Output resolutions for image generation. Only supported on certain models like gemini-3-pro-image-preview.

ImageConfigValues.OutputMimeTypes

Output MIME types for generated images.

ImportRagFilesRequestExtensions

Extension methods for adding various data sources to an ImportRagFilesRequest.

InlineMimeTypes

Contains constants and configurations for inline file handling, including file size limitations and allowed MIME types.

JsonElementExtensions

Provides extension methods for JsonElement objects.

MarkdownCodeExtractorExtension

Provides extension methods for extracting structured data, such as code blocks and JSON blocks, from markdown strings.

ObjectExtensions

Provides extension methods for working with objects in the GenerativeAI library. Includes utilities for converting objects into schema representations.

RagCorpusExtensions

Extension methods for configuring the RagCorpus with different vector database configurations.

RequestExtensions

A static class providing extension methods for formatting request contents used in generative AI models.

Roles

Defines constant role identifiers used in the Generative AI system.

SemanticRetrieverChatSession

Represents a chat session that interacts with a semantic retriever model to generate answers based on user queries. Includes functionality for maintaining session history, managing configurations, and handling responses from the model.

SemanticRetrieverModel

Represents a semantic retriever model used for working with documents, corpora, chunks, and corpus permissions. This model requires a platform adapter with authentication for initialization.

StringExtensions

Provides extension methods for string-related model manipulations.

SupportedEmbedingModels

Provides a centralized collection of supported embedding model identifiers for use in the GenerativeAI namespace.

VertexAI

Represents the Vertex AI implementation of the generative AI platform.

VertexAIModel

VertexAIModel is a specialized class for interacting with Google's Vertex AI generative models. It extends the functionality of the GenerativeModel class and serves as a concrete implementation for initializing and utilizing Vertex AI's capabilities for content generation tasks.

VertexAIModels

Provides constants for Vertex AI model variations and related information.

VertexAIModels.Codey

Provides constants for Codey model variations.

VertexAIModels.Embeddings

Provides constants for Embeddings model variations.

VertexAIModels.Gemini

Provides constants for Gemini model variations.

VertexAIModels.Gemma

Provides constants for Gemma model variations.

VertexAIModels.Imagen

Provides constants for Imagen model variations.

VertexAIModels.MedLM

Provides constants for MedLM model variations.

VertexAIModels.Video

Provides constants for video generation model names.

VertextPlatformAdapter

The VertextPlatformAdapter class provides authentication, configuration, and utility methods for interacting with Vertex AI.

VideoGenerationModel

A client for interacting with the Gemini API for video generation tasks. Note: Video generation capabilities might be specific to certain API versions or platforms (e.g., Vertex AI).

VqaRequestExtensions

Extension methods for adding image data to a VqaRequest object.

Interfaces

IGenerativeAI

Represents an interface defining operations for generative AI systems, including initializing models, retrieving model details, listing available models, and accessing platform-specific adapters.

IGenerativeModel

Defines the contract for a generative AI model. This interface provides methods for generating answers and content, streaming content, and counting tokens within inputs or outputs. It also includes properties for configuring behavior related to grounding, external tools, and advanced options such as JSON mode or function calling.