MCPcopy Create free account
hub / github.com/Autoparallel/learner / init

Method init

crates/learner/src/lib.rs:403–416  ·  view source on GitHub ↗

Creates new configuration with example retriever configurations. Initializes configuration with defaults and creates example configurations for arXiv and DOI retrievers. # Errors Returns error if: - Configuration save fails - Retriever directory creation fails - Example config writes fail

()

Source from the content-addressed store, hash-verified

401 /// - Retriever directory creation fails
402 /// - Example config writes fail
403 pub fn init() -> Result<Self> {
404 let config = Self::default();
405 config.save()?;
406
407 // Write example retriever configs
408 let retrievers_dir = &config.retrievers_path;
409 std::fs::create_dir_all(retrievers_dir)?;
410
411 std::fs::write(retrievers_dir.join("arxiv.toml"), ARXIV_CONFIG)?;
412 std::fs::write(retrievers_dir.join("doi.toml"), DOI_CONFIG)?;
413 std::fs::write(retrievers_dir.join("iacr.toml"), IACR_CONFIG)?;
414
415 Ok(config)
416 }
417
418 /// Sets the database file path.
419 ///

Callers 2

setup_loggingFunction · 0.80
startMethod · 0.80

Calls 2

initFunction · 0.85
saveMethod · 0.80

Tested by

no test coverage detected