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.29f1.
Package Manager
OpenUPM
https://package.openupm.com
com.uralstech
com.utilities
*Window
-> Package Manager
)Unity
to My Registries
UGemini
, Utilities.Async
and Utilities.Encoder.Wav
packagesWindow
-> Package Manager
)+
icon and Add package from git URL...
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.
UGemini/UGemini/Packages/com.uralstech.ugemini
into your Unity project's Packages
folderPackages
folder of your project, add the following line to the list in manifest.json
:
"com.uralstech.ugemini": "2.x.x",
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.
Do not use preview versions (i.e. versions that end with "-preview") for production use as they are unstable and untested.
[x] models
endpoint
batchEmbedContents
methodcountTokens
methodembedContent
methodgenerateAnswer
method 🧪generateContent
methodget
methodlist
methodstreamGenerateContent
method[x] cachedContents
endpoint 🧪
create
methoddelete
methodget
methodlist
methodpatch
method[ ] corpora
endpoint 🧪
[x] files
endpoint 🧪
delete
methodget
methodlist
method[x] media
endpoint 🧪
upload
method[x] tunedModels
endpoint ⚠️
generateContent
method⚠️ - Not all methods/features are supported
🧪 - Using the v1beta API
See https://uralstech.github.io/UGemini/ or refman.pdf
in the package documentation for reference manual w/ tutorial.