Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
feat: configurable embedding model via config.toml (closes #4)
FABIOTESS9358c6a1fae6
diff --git a/src/config.rs b/src/config.rsindex 9284a3d6..36560aaf 100644--- a/src/config.rs+++ b/src/config.rs@@ -42,6 +42,12 @@ pub struct EmbeddingsConfig {pub model_path: Option<String>,/// Path to the tokenizer.json file. Default: ~/.open-ontologies/models/tokenizer.jsonpub tokenizer_path: Option<String>,+ /// URL to download the ONNX model from. Default: BGE-small-en-v1.5 from Hugging Face+ pub model_url: Option<String>,+ /// URL to download the tokenizer from. Default: BGE-small-en-v1.5 tokenizer from Hugging Face+ pub tokenizer_url: Option<String>,+ /// Filename for the downloaded model. Default: bge-small-en-v1.5.onnx+ pub model_name: Option<String>,}/// Expand a leading `~` in a path to the user's home directory.diff --git a/src/main.rs b/src/main.rsindex be8ab269..d71324bc 100644--- a/src/main.rs+++ b/src/main.rs@@ -11,8 +11,16 @@ const DEFAULT_CONFIG: &str = r#"[general]data_dir = "~/.open-ontologies"# [embeddings]+# Paths to a local ONNX model and tokenizer (loaded at runtime)# model_path = "~/.open-ontologies/models/bge-small-en-v1.5.onnx"# tokenizer_path = "~/.open-ontologies/models/tokenizer.json"+#+# URLs used by `open-ontologies init` to download the model.+# Override these to use a different sentence-transformer model (e.g. for non-English text).+# The model must be exported to ONNX and use a Hugging Face tokenizer.json.+# model_url = "https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/onnx/model.onnx"+# tokenizer_url = "https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/tokenizer.json"+# model_name = "bge-small-en-v1.5.onnx""#;#[derive(Parser)]@@ -380,11 +388,19 @@ async fn main() -> anyhow::Result<()> {let models_dir = data_path.join("models");std::fs::create_dir_all(&models_dir)?;+ // CLI flags > config.toml > defaults+ let cfg = open_ontologies::config::Config::load(&config_path)+ .map(|c| c.embeddings)+ .unwrap_or_default();+let onnx_url = _model_url.as_deref()+ .or(cfg.model_url.as_deref()).unwrap_or(open_ontologies::embed::BGE_SMALL_ONNX_URL);let tok_url = _tokenizer_url.as_deref()+ .or(cfg.tokenizer_url.as_deref()).unwrap_or(open_ontologies::embed::BGE_SMALL_TOKENIZER_URL);let onnx_filename = _model_name.as_deref()+ .or(cfg.model_name.as_deref()).unwrap_or("bge-small-en-v1.5.onnx");let model_path = models_dir.join(onnx_filename);