from aiforge.core.pipeline import Pipeline
from aiforge.core.plugin_loader import load_plugin

def main():
    print("Loading AIForge plugins...")
    
    # 1. Load the plugins required for our cross-domain pipeline
    load_plugin("yolo")
    load_plugin("nlp")
    load_plugin("ml")
    
    print("\nBuilding Cross-Domain Integration Pipeline...")
    print("Flow: Image -> [YOLO Object Detection] -> [NLP Text Extraction] -> [ML Vectorization]")
    
    pipe = Pipeline()
    
    # STEP 1: YOLO Plugin Operator (Takes Image, Outputs YOLO Bounding Boxes/Objects)
    pipe.add("detect_yolo", model_name="yolov8n.pt")
    
    # STEP 2: Bridge Operator (Takes YOLO objects, Outputs List of String Labels)
    pipe.add("yolo_extract_labels")
    
    # STEP 3: NLP Plugin Operator (Takes List of Strings, Outputs Single String)
    pipe.add("join_strings", separator=", ")
    
    # STEP 4: NLP->ML Bridge Operator (Takes String, Outputs Numerical Sparse Features dict)
    pipe.add("tfidf_vectorize", max_features=10)
    
    print(f"\nPipeline successfully created with {len(pipe.steps)} connected operators.")
    print("Data can now seamlessly flow across completely different ML domains!")
    print("\nTo run this (requires YOLO/Scikit-Learn installed):")
    print("result = pipe.run('path_to_image.jpg')")

if __name__ == "__main__":
    main()
