Skip to main content

ailake_core/
lib.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! ailake-core — shared type system
3//!
4//! No I/O, no async, no external deps beyond serde/uuid/thiserror/half.
5//! Every other crate depends on this one. This crate depends on nothing internal.
6
7pub mod episodic;
8pub mod error;
9pub mod filter;
10pub mod schema;
11pub mod types;
12
13/// Upper bound on `top_k` accepted anywhere a search request enters the system (JNI C-ABI,
14/// `ailake-query::scanner`, CLI, Python bindings). `top_k` flows into `ef.max(top_k * 10)` in
15/// `ailake-index`'s HNSW search and then a `BinaryHeap::with_capacity` sized off that — an
16/// unvalidated huge `top_k` requests a multi-GB allocation whose failure aborts the process.
17/// Single source of truth so every entry point enforces the same limit.
18pub const MAX_TOP_K: usize = 100_000;
19
20pub use episodic::{
21    episodic_columns, hybrid_score, recency_weight, EpisodicMemorySchema, RecencyConfig,
22};
23pub use error::{AilakeError, AilakeResult};
24pub use filter::{ColumnFilter, FilterOp, FilterValue};
25pub use schema::{
26    llm_columns, multimodal_columns, now_ns, tool_call_columns, LlmContextSchema,
27    MultimodalContextSchema, PQConfig, PartitionDef, ToolCallOutcome, ToolCallSchema,
28    VectorStoragePolicy,
29};
30pub use types::{
31    ByteLen, ByteOffset, Centroid, Dim, EmbeddingModelInfo, RowId, VectorColSpec, VectorMetric,
32    VectorModality, VectorPrecision,
33};