Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/uralstech/ugemini

A Unity C# wrapper for the Google Gemini API.
https://github.com/uralstech/ugemini

gemini gemini-ai gemini-api gemini-client gemini-pro-api integration openupm unity unity-integration unity-package unity-packages unity3d unity3d-plugin

Last synced: about 1 month ago
JSON representation

A Unity C# wrapper for the Google Gemini API.

Awesome Lists containing this project

README

        

## UGemini

A Unity C# wrapper for the Google Gemini API.

[![openupm](https://img.shields.io/npm/v/com.uralstech.ugemini?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.uralstech.ugemini/)
[![openupm](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=downloads&query=%24.downloads&suffix=%2Fmonth&url=https%3A%2F%2Fpackage.openupm.com%2Fdownloads%2Fpoint%2Flast-month%2Fcom.uralstech.ugemini)](https://openupm.com/packages/com.uralstech.ugemini/)

## Installation

This *should* work on any reasonably modern Unity version. Built and tested in Unity 2022.3.

### OpenUPM

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

### 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`
4. Check the instructions for [`UCloud.Operations`](https://uralstech.github.io/UCloud.Operations) and [`Utils.Singleton`](https://uralstech.github.io/Utils.Singleton) to install the dependencies.

*Adding additional dependencies:*

See the installation steps for the [Utilities.Async](https://github.com/rageAgainstThePixel/com.utilities.async)\* and [Utilities.Encoder.Wav](https://github.com/rageAgainstThePixel/com.utilities.encoder.wav)\* packages.

### GitHub Clone

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": "2.x.x",`
4. Check the instructions for [`UCloud.Operations`](https://uralstech.github.io/UCloud.Operations) and [`Utils.Singleton`](https://uralstech.github.io/Utils.Singleton) to install the dependencies.

*Adding additional dependencies:*

See the installation steps for the [Utilities.Async](https://github.com/rageAgainstThePixel/com.utilities.async)\* and [Utilities.Encoder.Wav](https://github.com/rageAgainstThePixel/com.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.

### Preview Versions

Do not use preview versions (i.e. versions that end with "-preview") for production use as they are unstable and untested.

### Gemini API Support

- [x] `models` endpoint
- [x] `batchEmbedContents` method
- [x] `countTokens` method
- [x] `embedContent` method
- [x] `generateAnswer` method 🧪
- [x] `generateContent` method
- [x] `get` method
- [x] `list` method
- [x] `streamGenerateContent` method

- [x] `cachedContents` endpoint 🧪
- [x] `create` method
- [x] `delete` method
- [x] `get` method
- [x] `list` method
- [x] `patch` method

- [ ] `corpora` endpoint 🧪
- [x] `files` endpoint 🧪
- [x] `delete` method
- [x] `get` method
- [x] `list` method

- [x] `media` endpoint 🧪
- [x] `upload` method

- [x] `tunedModels` endpoint 🧪
- [x] `create` method
- [x] `delete` method
- [x] `generateContent` method
- [x] `get` method
- [x] `list` method
- [x] `patch` method
- [x] `transferOwnership` method

- [x] `tunedModels.operations` endpoint\*
- [x] `cancel` method
- [x] `get` method
- [x] `list` method

- [x] `operations` endpoint\*
- [x] `list` method

🧪 - Using the v1beta API

\*Through package dependency [UCloud.Operations](https://github.com/Uralstech/UCloud.Operations).

### Documentation

See or `APIReferenceManual.pdf` and `Documentation.pdf` in the package documentation for the reference manual and tutorial.