| Crates.io | lnmp-embedding |
| lib.rs | lnmp-embedding |
| version | 0.5.16 |
| created_at | 2025-11-20 23:23:35.019035+00 |
| updated_at | 2025-12-19 10:02:04.26341+00 |
| description | Vector embedding support for LNMP (LLM Native Minimal Protocol) with similarity calculations and delta encoding |
| homepage | |
| repository | https://github.com/lnmplang/lnmp-protocol |
| max_upload_size | |
| id | 1942732 |
| size | 93,597 |
Native vector embedding support for the LNMP protocol.
FID Registry: Embedding FIDs are defined in the Standard range (512-767) in
registry/fids.yaml.
This crate provides the core data structures and logic for handling vector embeddings within LNMP, enabling efficient storage, transport, and processing of high-dimensional vectors for AI and ML applications.
F32, F16, I8, U8, and Binary embeddings.use lnmp_embedding::{Vector, EmbeddingType, SimilarityMetric};
// Create a vector from f32 data
let v1 = Vector::from_f32(vec![1.0, 0.0, 0.0]);
let v2 = Vector::from_f32(vec![0.0, 1.0, 0.0]);
// Calculate similarity
let similarity = v1.similarity(&v2, SimilarityMetric::Cosine).unwrap();
assert_eq!(similarity, 0.0);
This crate includes several examples in the examples/ directory:
Run examples with:
cargo run --example delta_compute -p lnmp-embedding
cargo run --example batch_ops -p lnmp-embedding
This crate is designed to be used with lnmp-core and the LNMP SDKs. It is the underlying implementation for the Embedding mode (0x06) and LnmpValue::Embedding variant.