Skip to main content

Crate orbok_models

Crate orbok_models 

Source
Expand description

§orbok-models

Local AI model vocabulary (RFC-012). Milestone M1–M6 only needs the shared types and the “what is available” summary the UI shows; the install/locate/validate workflow lands in M12.

Privacy rule carried from the requirements: model download is the only network operation orbok may ever perform, it is explicit, and it never involves document contents.

Re-exports§

pub use download_plan::DEFAULT_MODEL_DOWNLOAD_CONCURRENCY;
pub use download_plan::DownloadAction;
pub use download_plan::DownloadPlan;
pub use download_plan::DownloadPlanError;
pub use download_plan::FileDownloadProgress;
pub use download_plan::FileDownloadStatus;
pub use download_plan::FriendlyDownloadProblem;
pub use download_plan::ModelFilePlan;
pub use download_plan::OverallDownloadProgress;
pub use download_plan::build_download_plan;
pub use generation::GenerationTransitionError;
pub use generation::GenerationValueError;
pub use generation::ManagedGenerationId;
pub use generation::ManagedGenerationRecord;
pub use generation::ManagedGenerationSnapshot;
pub use generation::ManagedGenerationState;
pub use generation::ManagedProfileState;
pub use generation::ModelStoreProfileId;
pub use generation::StartupEpoch;
pub use generation::StartupValidationEvidence;
pub use model_store::ExclusiveAccess;
pub use model_store::MODEL_STORE_LOCK_FILE;
pub use model_store::ManagedModelStore;
pub use model_store::ModelStoreLockError;
pub use model_store::ModelStoreMutationGuard;
pub use model_store::SharedAccess;
pub use readiness::FileReadiness;
pub use readiness::LocalFileIntegrity;
pub use readiness::LocalFileStatus;
pub use readiness::ModelProvenance;
pub use readiness::ModelReadiness;
pub use readiness::ModelReadinessReport;
pub use readiness::check_app_managed_model_readiness;
pub use readiness::check_model_readiness;
pub use readiness::check_user_supplied_model_readiness;
pub use trust::DEFAULT_TRUSTED_MODEL;
pub use trust::HeaderDisposition;
pub use trust::HttpClientPolicy;
pub use trust::PRODUCTION_HTTP_CLIENT_POLICY;
pub use trust::TrustPolicyError;
pub use trust::TrustedModelFile;
pub use trust::TrustedModelIdentity;
pub use trust::TrustedModelManifest;
pub use trust::TrustedTransportPolicy;
pub use trust::redirect_header_disposition;
pub use trust::validate_initial_url;
pub use trust::validate_redirect_url;

Modules§

download_plan
Download plan: maps readiness → actions (RFC-043 §10).
generation
Typed managed-generation lifecycle state for RFC-050 §3B.
model_store
Cross-process serialization for the managed model store (RFC-050 §5).
readiness
Local model file readiness check (RFC-043 §7).
trust
Reviewed trust root and pure transport policy for RFC-050.

Structs§

EmbeddingBatchStats
Per-call batch statistics for measurement only (RFC-048 Task 011) — never consulted by embedding logic itself. padded_seq_len is what the backend’s padding strategy actually resolved to for this call; real_token_positions is the sum, across the whole batch, of each item’s non-padding token count (from its attention mask, where the backend has one). batch_size * padded_seq_len is the padded token-position count the call actually paid for.
EmbeddingModelConfig
Configuration for loading a real embedding model from disk.
MockEmbeddingModel
Deterministic 8-dimensional mock embedding model.
RerankCandidate
A candidate document passed to the reranker.
RerankScore
Per-candidate rerank score (higher = more relevant).
RerankerConfig
Configuration for a cross-encoder reranker model.
VectorCandidate
A vector search candidate (RFC-008 §13).

Enums§

InferenceBackend
The compute backend used for local inference.
ModelRole
Model roles (catalog models.role).
ModelStatus
Model availability (catalog models.status).
SearchCapability
Search capability derived from model availability. Keyword search never depends on models (RFC-007: works with zero models installed).

Traits§

CrossEncoderReranker
Cross-encoder reranker contract (RFC-010 §5).
EmbeddingModel
Local embedding model abstraction (RFC-008 §6).

Functions§

blob_to_vec
Deserialize from BLOB bytes; returns None on length mismatch.
cosine_similarity
Compute cosine similarity between two L2-normalized vectors.
cosine_similarity_i8
Compute approximate cosine similarity from INT8 vectors via FP32 conversion. For exact INT8 dot-product, a SIMD-optimised path would be preferable; this provides correct results at lower compute cost than full FP32.
dequantize_from_i8
Dequantize INT8 back to FP32 for similarity computation.
i8_blob_to_vec
Deserialize INT8 vector from BLOB bytes.
i8_vec_to_blob
Serialize INT8 vector to bytes for BLOB storage.
l2_normalize
L2-normalize a vector in-place. No-op for the zero vector.
quantize_to_i8
Quantize an L2-normalized FP32 vector to INT8.
vec_to_blob
Serialize a vector to little-endian bytes for BLOB storage (RFC-008 §12.1 “sqlite_blob with FP32”).