[package]
name = "aprender-rag"
version.workspace = true
edition = "2021"
authors = ["Pragmatic AI Labs"]
description = "Pure-Rust Retrieval-Augmented Generation pipeline built on Trueno"
license = "MIT"
repository = "https://github.com/paiml/trueno-rag"
keywords = ["rag", "retrieval", "embeddings", "nlp", "vector-search"]
categories = ["text-processing", "science"]
readme = "README.md"
rust-version = "1.75"
exclude = [
    "target/",
    "book/",
    "docs/",
    "examples/",
    "tests/",
    ".pmat/",
    ".pmat-work/",
    ".pmat-tickets/",
    ".github/",
    ".vscode/",
    ".idea/",
    "*.profraw",
    "*.profdata",
    "proptest-regressions/",
]

[lib]
name = "aprender_rag"

[dependencies]
# Core compute
trueno = { workspace = true }
trueno-db = { workspace = true }

# Async runtime
tokio = { version = "1.49", features = ["full"] }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# Error handling
thiserror = "2.0"

# Utilities
uuid = { version = "1.11", features = ["v4", "serde"] }
async-trait = "0.1"

# Compression for index storage (GH-2) - via batuta-common shared module
batuta-common = { workspace = true }
lz4_flex = { version = "0.11", optional = true }
zstd = { version = "0.13", optional = true }
bincode = { version = "1.3", optional = true }  # Binary serialization for indices

# SQLite+FTS5 persistent index (sqlite-rag-integration spec)
# FTS5 is included in bundled SQLite by default (SQLITE_ENABLE_FTS5)
rusqlite = { version = "0.32", features = ["bundled"], optional = true }

# Real embeddings via fastembed (GH-1) - optional, adds ONNX Runtime dependency
fastembed = { version = "5", optional = true }

# NVIDIA Embed Nemotron 8B via realizar GGUF infrastructure (GH-3)
# Large model (~4-32GB depending on quantization), requires GGUF file
realizar = { version = "0.60.0", path = "../aprender-serve", package = "aprender-serve", default-features = false, optional = true }

# Speech-to-text via whisper-apr (Whisper ASR, .apr model format)
# Sovereign stack: whisper-apr + aprender + trueno for pure-Rust transcription
whisper-apr = { version = "0.2", optional = true, default-features = false, features = ["std", "symphonia"] }

# Eval: LLM-as-judge via Anthropic API (PMAT-015)
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false, optional = true }
sha2 = { version = "0.10", optional = true }
rand = { version = "0.9", optional = true }

[build-dependencies]
serde = { version = "1", features = ["derive"] }
serde_yaml_ng = "0.10"

[dev-dependencies]
tokio-test = "0.4"
proptest = "1.9"
criterion = { version = "0.6", features = ["html_reports"] }
# HELIX-IDEA-005 Phase 2 (FALSIFY-HYBRID-004): seedable PRNG for the
# 5k-doc deterministic synthetic corpus that the build-perf gate
# ingests. ChaCha8 is the same family aprender-core uses for the
# HNSW recall fixture.
rand = "0.9"
rand_chacha = "0.9"

[[bench]]
name = "retrieval"
harness = false

[features]
default = ["sqlite"]
# SQLite+FTS5 persistent BM25 index (sqlite-rag-integration spec)
sqlite = ["dep:rusqlite"]
# Compressed index serialization (GH-2)
compression = ["dep:lz4_flex", "dep:zstd", "dep:bincode"]
# Real semantic embeddings via fastembed (GH-1)
# Adds ONNX Runtime dependency for production-quality embeddings
embeddings = ["dep:fastembed"]
# NVIDIA Embed Nemotron 8B via realizar GGUF infrastructure (GH-3)
# Llama 3.1 8B-based embedding model with 4096-dim output
nemotron = ["dep:realizar"]
# ColBERT-style multi-vector retrieval with WARP algorithm (PMAT-003)
# Enables token-level late interaction scoring with residual quantization
multivector = []
# Speech-to-text via whisper-apr (Whisper ASR engine)
# Sovereign stack: whisper-apr + aprender + trueno for pure-Rust transcription
transcription = ["dep:whisper-apr"]
# LLM-as-judge evaluation via Anthropic API (PMAT-015)
eval = ["dep:reqwest", "dep:sha2", "dep:rand"]
# Image OCR via tesseract CLI (PMAT-023)
# Requires tesseract-ocr system package installed on $PATH
ocr = []

[lints]
workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition"]

[package.metadata.release]
shared-version = true

[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
search = "## \\[Unreleased\\]"
replace = "## [{{version}}] - {{date}}"

