Skip to content

A C# wrapper for the Google Gemini API.

License

Notifications You must be signed in to change notification settings

Uralstech/UGemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UGemini

A C# wrapper for the Google Gemini API.

openupm openupm

Installation

This should work on any reasonably modern Unity version. Built and tested in Unity 2022.3.29f1.

From OpenUPM Through Unity Package Manager

  1. Open project settings
  2. Select Package Manager
  3. Add the OpenUPM package registry:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s)
      • com.uralstech
      • *com.utilities
  4. Open the Unity Package Manager window (Window -> Package Manager)
  5. Change the registry from Unity to My Registries
  6. Add the UGemini, *Utilities.Async and *Utilities.Encoder.Wav packages

From GitHub Through Unity Package Manager

  1. Open the Unity Package Manager window (Window -> Package Manager)
  2. Select the + icon and Add package from git URL...
  3. Paste the UPM branch URL and press enter:
    • https://github.com/Uralstech/UGemini.git#upm

Adding additional dependencies:
Follow the steps detailed in the OpenUPM installation method and only install the *Utilities.Async and *Utilities.Encoder.Wav packages.

From GitHub Clone/Download

  1. Clone or download the repository from the desired branch (master, preview/unstable)
  2. Drag the package folder UGemini/UGemini/Packages/com.uralstech.ugemini into your Unity project's Packages folder
  3. In the Packages folder of your project, add the following line to the list in manifest.json: "com.uralstech.ugemini": "1.0.1",

Adding additional dependencies:
Follow the steps detailed in the OpenUPM installation method and only install the *Utilities.Async and *Utilities.Encoder.Wav packages.

*Optional, but Utilities.Async is required for streaming content and Utilities.Encoder.Wav is recommended if you don't want to bother with encoding your AudioClips into Base64 strings manually.

Gemini API Support

  • models endpoint ⚠️

    • batchEmbedContents method

    • countTokens method

    • embedContent method

    • generateAnswer method 🧪

    • generateContent method

      • JSON output 🧪
      • System instructions 🧪
      • Text generation
      • Vision
      • Function calling 🧪
      • Safety settings
    • get method

    • list method

    • streamGenerateContent method

  • cachedContents endpoint 🧪

  • corpora endpoint 🧪

  • files endpoint 🧪

    • delete method
    • get method
    • list method
  • media endpoint 🧪

    • upload method 🚧
  • tunedModels endpoint

  • operations endpoint 🚧

⚠️ - Not all methods/features are supported
🚧 - The feature is being worked on and is unstable
🧪 - Using the v1beta API

Documentation

See https://github.com/Uralstech/UGemini/blob/master/UGemini/Packages/com.uralstech.ugemini/Documentation~/README.md.