A Unity C# wrapper for the Google Gemini API.
This should work on any reasonably modern Unity version. Built and tested in Unity 2022.3.
- Open project settings
- Select
Package Manager - Add the OpenUPM package registry:
- Name:
OpenUPM - URL:
https://package.openupm.com - Scope(s)
com.uralstechcom.utilities*
- Name:
- Open the Unity Package Manager window (
Window->Package Manager) - Change the registry from
UnitytoMy Registries - Add the
UGemini,Utilities.Async* andUtilities.Encoder.Wav* packages
- Open the Unity Package Manager window (
Window->Package Manager) - Select the
+icon andAdd package from git URL... - Paste the UPM branch URL and press enter:
https://github.com/Uralstech/UGemini.git#upm
- Check the instructions for
UCloud.OperationsandUtils.Singletonto install the dependencies.
Adding additional dependencies:
See the installation steps for the Utilities.Async* and Utilities.Encoder.Wav* packages.
- Clone or download the repository from the desired branch (master, preview/unstable)
- Drag the package folder
UGemini/UGemini/Packages/com.uralstech.ugeminiinto your Unity project'sPackagesfolder - In the
Packagesfolder of your project, add the following line to the list inmanifest.json:"com.uralstech.ugemini": "2.x.x", - Check the instructions for
UCloud.OperationsandUtils.Singletonto install the dependencies.
Adding additional dependencies:
See the installation steps for 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.
Do not use preview versions (i.e. versions that end with "-preview") for production use as they are unstable and untested.
-
modelsendpoint-
batchEmbedContentsmethod -
countTokensmethod -
embedContentmethod -
generateAnswermethod 🧪 -
generateContentmethod -
getmethod -
listmethod -
streamGenerateContentmethod
-
-
cachedContentsendpoint 🧪-
createmethod -
deletemethod -
getmethod -
listmethod -
patchmethod
-
-
corporaendpoint 🧪 -
filesendpoint 🧪-
deletemethod -
getmethod -
listmethod
-
-
mediaendpoint 🧪-
uploadmethod
-
-
tunedModelsendpoint 🧪-
createmethod -
deletemethod -
generateContentmethod -
getmethod -
listmethod -
patchmethod -
transferOwnershipmethod
-
-
tunedModels.operationsendpoint*-
cancelmethod -
getmethod -
listmethod
-
-
operationsendpoint*-
listmethod
-
🧪 - Using the v1beta API
*Through package dependency UCloud.Operations.
See https://uralstech.github.io/UGemini/DocSource/QuickStart.html or APIReferenceManual.pdf and Documentation.pdf in the package documentation for the reference manual and tutorial.