FunctionGemma Home (Unity package)
On-device function calling for Unity with FunctionGemma-270M running on Unity Sentis. The package contains the runtime generator and the model files.
Install
In Packages/manifest.json, add:
"com.sky-kim.functiongemma-home": "https://huggingface.co/Sky-Kim/com.sky.sentis.functiongemma.home.git"
Unity Sentis (com.unity.ai.inference 2.6.1) is installed automatically as a dependency.
Model files
The model ships in the package's Models~ folder, together with the tokenizer and the developer block:
Models~/
functiongemma_home_uint8.sentis # FunctionGemma-270M, uint8 weights (about 436 MB)
tokenizer.json
fg_dev_block_home.txt # system instruction + tool declarations, byte-identical to training
Unity does not import Models~, so the model is not duplicated as an asset. In the Editor, FunctionGemmaGenerator reads the files straight from the package cache. For a player build, the package copies them to Assets/StreamingAssets/FunctionGemmaHome/ before the build and removes the copy afterwards. Android keeps StreamingAssets inside the APK, so the first launch copies the files to Application.persistentDataPath (call WarmupRoutine from a coroutine).
Use
Add FunctionGemmaGenerator to a GameObject and call:
var gen = GetComponent<FunctionGemmaGenerator>();
yield return gen.WarmupRoutine(); // on Android, copies the model out of the APK first
yield return gen.GenerateCallRoutine("Turn on the living room light", raw => Debug.Log(raw));
// raw looks like: call:turn_on_light{room:<escape>living room<escape>}
Parse and validate the raw text in your own code. The output format is a flat call, call:NAME{key:<escape>value<escape>}.
Notes
- The model is a fine-tune of Gemma, so the Gemma terms of use apply. Training source: Sky-Kim/functiongemma-270m-finetune.
Models~/is not imported by Unity. The build copies its contents into StreamingAssets only for the player.- Code is MIT licensed (see
LICENSE).
Model tree for Sky-Kim/com.sky.sentis.functiongemma.home
Base model
google/functiongemma-270m-it