Repository navigation
libmoss v0.32.0
·
3 commits
to main
since this release
Precompiled C SDK binaries for the Moss SDK.
Added
- Each archive carries
LICENSE.txt, the PolyForm Shield License 1.0.0 terms of the library. The release notes name them too.
Changed
- A new client loads an index from
cache_pathin about one round trip to the Moss cloud when another client or session in the same process has the index's model loaded. Clients in one process share the project's token and each loaded embedding model, and on macOS, Linux and Windows also their connections to the cloud; every load still checks the cloud version of the index. Freeing the last client or session that uses a model still frees the model at once, on every platform, so a client created after that opens the model again. iOS and Android builds open connections per client. A cachedmoss_client_load_indexalso asks for the index metadata and its model provenance at once. From Europe, about 130 ms from the Moss cloud, a cached 960-document index loaded in the first client in a process in 1.9 to 2.2 s instead of 2.5 to 2.8 s, and in 200 to 290 ms instead of 2.5 to 2.8 s in a new client that found its model loaded; a cached 50,400-document index loaded in such a client in 0.8 to 1.4 s instead of 3.0 to 3.1 s. A client opened several idle minutes after the last one was freed reconnects and opens the model again, which took 1.6 to 1.7 s. moss_client_load_indexandmoss_client_load_indexesneed less memory. The index file, downloaded or read fromcache_path, is freed once it is parsed, and its vectors and documents move into the loaded index instead of being copied. A load that writes the download tocache_pathfrees the file once it is written and copies the documents into the index. On an Apple M2, loading 250,000 documents with 384-dimension vectors peaked at 943 MB instead of 1,550 MB, and at about 1,210 MB when the load writes the download tocache_path. Auto-refresh of an index loaded withoutcache_pathinstalls a newer version the same way. Search results and cache files are unchanged.- Queries with a metadata filter test it while they score the vectors, in parallel on large indexes, and skip the vectors of documents it rejects. The filter values of
$gt,$gte,$lt,$lteand$nearare parsed once per query instead of once per document. On an Apple M2, an embedding or hybrid query over 100,000 documents with 1,536-dimension vectors and a filter that keeps 5% of them ran about six times faster. Results are unchanged. - Creating an index whose name is taken returns
ERR_INVALID_ARGand the message "An index with this name already exists. Delete it or choose another name.", and a call the service refuses because a build for the index is still running, such as adding documents during a build, fails the same way with "A build is already running for this index. Wait for it to finish, then try again.", instead of the generic "The Moss service rejected the request as invalid.". The code is unchanged, andmoss_last_error_detail()still names the service's code.
Deprecated
- libmoss versions below 0.24.0 reach end of support on 2026-12-17 and will stop working then. Upgrade to this release or a later one.
Fixed
moss_client_query,moss_client_query_multi_indexandmoss_session_queryfail withERR_INVALID_ARGwhenfilter_jsonis not valid UTF-8. They used to drop the filter and return unfiltered results.moss_client_get_docs,moss_client_delete_docs,moss_session_get_docsandmoss_session_delete_docsfail withERR_NULL_POINTERfor a NULL id and withERR_INVALID_ARGfor one that is not valid UTF-8. They used to drop such ids, somoss_client_get_docsreturned every document of the index when no id was left.moss_client_delete_docsandmoss_session_delete_docsalso fail withERR_NULL_POINTERfor a NULLdoc_idswith a nonzero count, where they used to go ahead with an empty id list.moss_client_create_index,moss_client_add_docsandmoss_session_add_docsfail withERR_INVALID_ARGfor a metadata key or value that is NULL or not valid UTF-8, and for apayloadthat is not valid UTF-8. They used to drop the entry or the payload.moss_client_create_index,moss_client_create_index_from_files,moss_client_add_docsandmoss_client_delete_docscalls on one index run one at a time across everyMossClientthat uses the same loaded copy of the core. Each call keeps the index until it returns, the wait for its build included, so parallel writes to one index take as long as the same writes one after another.moss_session_push_indexwaits its turn with them, but keeps the index only until the service accepts the push, not through its build. Calls on different indexes still run in parallel.moss_client_delete_indexdoes not wait for them, since the service cancels a running build of the index it deletes. Calls on one index through separate clients used to reach the service together, which refused some of them and reported others as done without storing them: of three parallelmoss_client_add_docscalls with one new document each, only one document was stored. A call the service refuses because a build of the index is running, such as one started from another process, is sent again, with waits that grow from about one second to eight and add up to at most 60 seconds. If the service still refuses it after those waits, it returnsERR_INVALID_ARGand the message "A build is already running for this index. Wait for it to finish, then try again.", as it used to on the first refusal. Writes to one index from separate copies of the core, processes or hosts do not wait for each other. Such a write is sent again, with the same waits, only when the service refuses it withBUILD_IN_PROGRESS. The Moss cloud service refuses a write that overlaps a running build, but an index service without that refusal can accept the write and drop it.
Platforms
| Archive | OS | Arch |
|---|---|---|
libmoss-v0.32.0-aarch64-apple-darwin.tar.gz |
macOS | ARM64 (Apple Silicon) |
libmoss-v0.32.0-x86_64-unknown-linux-gnu.tar.gz |
Linux | x86_64 |
libmoss-v0.32.0-aarch64-unknown-linux-gnu.tar.gz |
Linux | ARM64 |
libmoss-v0.32.0-x86_64-pc-windows-msvc.tar.gz |
Windows | x86_64 |
Contents
Each archive contains:
include/libmoss.h- C headerlib/libmoss.dylib,lib/libmoss.soorlib/moss.dll- shared libraryLICENSE.txt- the license of the libraryLICENSE-THIRD-PARTY.txt- licenses of the third-party code the library links
Windows archives also contain the DLL import library lib/moss.dll.lib.
License
The library is licensed under the PolyForm Shield License 1.0.0, not under this repository's BSD 2-Clause License.
Required Notice: Copyright InferEdge Inc. (https://inferedge.dev)
Usage
Extract, then compile and link. The macOS dylib ships with an
@rpath/libmoss.dylib install name, so pass an -rpath that
resolves to lib/ or the binary aborts at launch with
"Library not loaded: @rpath/libmoss.dylib ... no LC_RPATH's found":
# macOS
clang your_app.c -o your_app -Iinclude -Llib -lmoss \
-Wl,-rpath,@loader_path/lib \
-framework Security -framework SystemConfiguration
# Linux
gcc your_app.c -o your_app -Iinclude -Llib -lmoss -lpthread -lm -ldl