Building Custom Document Loaders
Learn how to build custom document loaders to integrate any data source into BoxLang AI workflows.
🎯 Why Custom Loaders?
🏗️ Loader Architecture
📝 IDocumentLoader Interface
interface {
/**
* Load documents from the source
* @return Array of Document objects
*/
public array function load();
/**
* Load documents asynchronously
* @return BoxLang Future resolving to array of Documents
*/
public any function loadAsync();
/**
* Get the source being loaded
* @return string
*/
public string function getSource();
/**
* Configure the loader
* @param config Configuration struct
* @return this (for fluent API)
*/
public any function configure( required struct config );
}🚀 Quick Start: Simple Custom Loader
🎨 Extending BaseDocumentLoader
Inherited Methods
Fluent API Pattern
💡 Advanced Example: Database Loader
🔌 Registering Custom Loaders
Module Registration
Usage After Registration
✅ Best Practices
1. Error Handling
2. Resource Cleanup
3. Metadata Enrichment
4. Performance Optimization
📚 Next Steps
🎓 Summary
Last updated