Skip to content
sysout.dev

Shared model-core integration

In My Head consumes dev.sysout:model-core:0.1.0 from local Maven. The shared module owns model-artifact mechanics and the Android LiteRT-LM runtime seam; In My Head owns model selection, prompts, transcript cleanup policy, and the Settings/Record UI.

Adding another model

To add a model such as Phi-4:

  1. Add a ModelSpec to the feature’s model catalog. Set a stable app-specific id, display name, compatible .litertlm filename, download URL, optional minimum size, and preferably a SHA-256 checksum.

  2. Choose an app-private destination and construct ModelDownloadManager(spec, path).

  3. Expose manager.state() to the feature UI. The UI can call startDownload() and cancelDownload() and map NotStarted, Downloading, Completed, Failed, and Cancelled to its own controls.

  4. Create the runtime with createTextGenerationModel(path), call initialize(), create a session with the app-specific system instruction, and close the session/runtime when finished.

The manager downloads to a .part file, supports HTTP range resume, and only promotes the final file after validation. A consumer may use the optional ModelDownloadCard or provide its own row-based Settings UI. In My Head uses its own Settings controls so Whisper and Gemma can be presented as separate models while sharing the same manager behavior.

The model runtime is deliberately not a categorizer, cleaner, or speech engine. Prompts and response parsing stay in the consuming feature. See the model-core README in the Money O Money repository for the complete API example and dependency setup.