Home - gunpal5/Google_GenerativeAI GitHub Wiki

Google Generative AI C# SDK

Welcome to the documentation for the unofficial C# SDK for Google Generative AI (Google Gemini) REST APIs. This SDK provides a comprehensive and easy-to-use interface for interacting with Gemini models, including support for JSON mode, function calling, and multi-modal functionalities. This version is a complete rewrite, offering significant improvements in performance, flexibility, and maintainability. It also seamlessly integrates with LangChain.net, expanding its capabilities within complex AI workflows.

Key Features

This SDK empowers developers to leverage the full potential of Google Gemini with features like:

  • Complete Rewrite: The SDK has been entirely rebuilt from the ground up, resulting in a more robust, reliable, and maintainable codebase.
  • LangChain.net Support: Seamlessly integrate this SDK into your LangChain.net projects, unlocking powerful orchestration and workflow capabilities.
  • Enhanced JSON Mode: Simplified methods for interacting with Google Gemini's JSON mode, making structured data exchange effortless.
  • Function Calling with Code Generator: Effortlessly define and call functions using a source generator that automatically creates argument classes and extension methods. This significantly reduces boilerplate and simplifies complex interactions.
  • Multi-Modal Functionality: Easily incorporate text, images, and other data types for multi-modal interactions with Google Gemini, opening up a wide range of applications.
  • Vertex AI Support: Direct support for Vertex AI, including multiple authentication methods: OAuth, Service Account, and Application Default Credentials (ADC), ensuring secure and flexible access.

Modular Packages

The SDK is divided into modular packages, allowing you to include only the components you need for your project:

Package Version Description
GenerativeAI.Tools NuGet version Provides function tooling and code generation using tryAgi CSharpToJsonSchema. Ideal for defining functions and automating their JSON schema generation.
GenerativeAI.Auth NuGet version Offers various Google authentication mechanisms, including OAuth, Service Account, and Application Default Credentials (ADC). Streamlines credential management.
GenerativeAI.Microsoft NuGet version Implements the IChatClient interface from Microsoft.Extensions.AI, enabling seamless integration with Microsoft’s AI ecosystem and services.
GenerativeAI.Web NuGet version Contains extension methods to integrate GenerativeAI into .NET web applications, simplifying setup for web projects that utilize Gemini models.

Getting Started

To begin using the SDK, the best place to start is the README file for the specific package you are interested in. Each package's README provides detailed instructions on installation, basic usage, and examples. You can find the README files within the GitHub repository. After reviewing the README, you can then explore the more detailed documentation below.

Documentation

The following sections provide detailed information about the SDK's features and usage:

Contributing

Contributions are welcome! Please create issues or pull request.

License

This SDK is licensed under the MIT License.

Feedback

If you have any questions, feedback, or bug reports, please open an issue on the GitHub repository.