Repository navigation
Moss Android SDK v0.33.0
·
4 commits
to main
since this release
Moss Android SDK v0.33.0.
AAR: moss-android-0.33.0.aar (arm64-v8a, minSdk 24, namespace dev.usemoss.moss).
SHA-256: a535bb8675ec4544fab24f016ff3e625bd45e394272dd6cc112e885a68738c08
Added
ClientOptions, the new last argument of bothMossClientconstructors,
haskeepModels, off by default. With it on, each embedding model the client
loads that the project's clients share stays loaded after the client closes,
so the next client of the project in the app loads a cached index without
opening the model again, once its own grant for the same artifact arrives,
until the grant the model was opened under is within 30 seconds of expiring,
at most about four and a half minutes after it was opened. A private copy,
which a client opens while another client is still opening the same model,
is not kept. Kotlin code compiled against an earlier release that calls the
authenticator constructor withoutbaseUrlmust be compiled again, with no
change to its source.releaseMemoryon an open client and the app's trim callbacks free at once
each kept model that no client or session holds. The first client built with
keepModelsregisters trim callbacks for the process that stay after every
client closes, so a trim frees kept models while no client is open too.
Changed
- Breaking change:
MossClient.sessionthrows theMossExceptionof
its load of the cloud index of the same name when that load fails, for
example codeNETWORKwhen the Moss cloud cannot be reached or
DESERIALIZATIONwhen the index's model artifact provenance does not
match. It used to return an empty session, which a laterpushIndexcould
push over the cloud index. An index that does not exist yet, or a name the
cloud cannot address, still opens an empty session, and
SessionOptions(autoLoadOnInit = false)skips the load. A foundation model
such as the defaultmoss-litelmstill checks the credentials when the
session opens, over the network for a client with a project key, so only
modelId = "custom"opens with no network. Requires a packed
libmoss_jni.sobuilt from the matching libmoss. - A client or session that reuses an embedding model another client of the
project holds, or one thatkeepModelskept, now asks the issuer for its own
grant first. That adds one round trip and still skips the decrypt and session
start. A client the issuer refuses now fails to load the model instead of
using one another client opened.
Fixed
- A session keeps its saved snapshot to itself while it serves vectors from
it, also aftersaveToDiskwrites a new generation.loadFromDiskand
saveToDiskof the same session name and cache path in a second session,
in this app or another process, throwMossExceptionwith codeINTERNAL
and the message "The saved session snapshot is open in another session."
until the first session's native teardown finishes.close()returns at
once and queues that teardown, which also sends the session's final
telemetry, for up to 2 seconds, so a load or save right afterclose()
can still throw. A save used to replace the file that held the lock, so
after one save a second session could load and save the same snapshot
beside the first and overwrite its saves. The lock is the file
session.lockin the session's directory. Loading from a directory the
app cannot write works when the snapshot already has itssession.lock,
which every save writes, and fails otherwise. A snapshot that an earlier
version saved has none. Add an emptysession.lockfile to its directory,
or load a copy: while nothing saves to the snapshot, copy its directory
under the same name into another directory, make the copy writable by the
app, and pass that other directory as the cache path. A.mossvecthat
loadIndexmaps fromcachePathis locked through a.lockfile beside
it. A second client that loads the same index from the samecachePath
while the first holds it does not throw: it keeps that index's vectors in
memory instead of mapping the file. Earlier versions take neither lock
file, so a process on one of them and a process on this version do not
lock each other out. Keep every process on an earlier version stopped
while a process on this version has the same cache path open. Requires a
packedlibmoss_jni.sobuilt from the matching libmoss.
Add it to an app module with implementation(files(...)). It is a file AAR, not a Maven Central package.
License
The AAR is licensed under the PolyForm Shield License 1.0.0, not under this repository's BSD 2-Clause License. LICENSE.txt holds the terms. The AAR carries it at META-INF/LICENSE.txt, and at assets/moss/LICENSE.txt beside the licenses of the third-party code it links.
Required Notice: Copyright InferEdge Inc. (https://inferedge.dev)