docs.rs failed to build lnmp-sfe-0.5.16
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
lnmp-sfe-0.5.13
lnmp-sfe
Semantic Fidelity Engine for LNMP (LLM Native Minimal Protocol).
FID Registry: All examples use official Field IDs from
registry/fids.yaml.
This crate provides the semantic dictionary system that maps field IDs to human-readable names and provides equivalence mappings for semantic normalization.
Features
- Semantic Dictionary: Maps field IDs to human-readable names
- Equivalence Mappings: Define synonym relationships for semantic normalization
- YAML Support: Load dictionaries from YAML files
Usage
use SemanticDictionary;
// Load dictionary from YAML file
let dict = load_from_file?;
// Get field name
if let Some = dict.get_field_name
// Get equivalence mapping
if let Some = dict.get_equivalence
Dictionary Format
fields:
12:
name: user_id
type: integer
7:
name: is_active
type: boolean
equivalences:
yes: "1"
true: "1"
no: "0"
false: "0"
23:
name: roles
type: string_array
equivalences:
admin: administrator
dev: developer
Context Profiling
The Semantic Fidelity Engine includes context profiling capabilities to help LLMs prioritize which records to use in RAG (Retrieval-Augmented Generation) systems and other applications.
Quick Start
use ;
use EnvelopeBuilder;
// Create scorer
let scorer = new;
// Score an envelope
let now = current_timestamp_ms;
let profile = scorer.score_envelope;
println!;
println!;
println!;
println!;
Scoring Components
- Freshness (0.0-1.0): Exponential decay based on timestamp age (default: 24h decay)
- Importance (0-255): Field-level priority from dictionary or default
- Risk Level: Low/Medium/High/Critical based on source trustworthiness
- Confidence (0.0-1.0): Data reliability (+0.2 boost for trusted sources)
RAG Use Cases
// Select top-K contexts for LLM prompt
let weights = new; // 80% freshness
let top_5 = select_top_k;
// Filter by criteria
let high_quality = filter_by_threshold;
let very_fresh = filter_by_freshness;
// Rank all contexts
let ranked = rank_for_llm;
Dictionary Integration
Add importance levels to YAML:
fields:
12:
name: user_id
type: integer
importance: 200 # High importance (0-255)
Examples
context_scoring.rs- Basic context scoringrag_prioritization.rs- RAG system prioritization
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.