Skip to main content
API Reference
Python SDK Reference
Python SDK

Python API Reference

Integrate MoroAI directly into custom pipelines, automated scripts, and Jupyter notebooks.

Core Classes

moro.core.compiler.EpistemicDataCompiler

from moro.core.compiler import EpistemicDataCompiler

compiler = EpistemicDataCompiler(
    source="./data.jsonl",
    mi_guard_threshold=0.85,
    dedup_threshold=0.88,
    pii_scan=True
)
compiled_dataset = compiler.compile(output_dir="./data/compiled/")
  

moro.core.recipe.RecipePredictor

from moro.core.recipe import RecipePredictor

predictor = RecipePredictor(model_id="Qwen/Qwen2.5-1.5B")
recipe = predictor.simulate_and_generate(device="cuda:0")
print(f"Optimal LoRA rank: {recipe.lora_r}, Safe batch: {recipe.micro_batch_size}")
  

moro.engine.trainer.SelfHealingTrainer

from moro.engine.trainer import SelfHealingTrainer

trainer = SelfHealingTrainer(
    recipe=recipe,
    dataset=compiled_dataset,
    auto_heal=True
)
run_result = trainer.fit()