Repository navigation
π FractoP v0.3.1 - First Official Release
FractoP (Fractal Processor) is a production-ready library for processing infinite-length text with LLMs using fractal architecture.
β¨ Key Features
- UnillM Integration: Seamless integration with @aid-on/unillm for unified LLM access
- Infinite Length Support: Process documents of any size through intelligent chunking
- Type-Safe: Full TypeScript support without using
anytypes - Enterprise-Grade: Built-in timeouts, retries, and circuit breaker pattern
- Flexible: Support for any LLM provider through adapters
π¦ Installation
npm install @aid-on/fractopπ Quick Start
With UnillM (Recommended)
import { createWithUnillM } from '@aid-on/fractop';
import { generate } from '@aid-on/unillm';
const processor = createWithUnillM(
async (chunk) => {
const result = await generate(
'groq:llama-3.1-8b-instant',
[
{ role: 'system', content: 'Summarize this text.' },
{ role: 'user', content: chunk }
],
{ groqApiKey: process.env.GROQ_API_KEY }
);
return result.text;
},
{ chunkSize: 3000, overlapSize: 300 }
);
const summary = await processor.process(longText);With Custom LLM
import { createLLMAdapter, FractalProcessor } from '@aid-on/fractop';
const adapter = createLLMAdapter(async (text) => {
return await yourLLM.complete(text);
});
const processor = new FractalProcessor(adapter, {
chunkSize: 3000,
overlapSize: 300
});π API Reference
createWithUnillM()- Create processor optimized for UnillMcreateLLMAdapter()- Convert async functions to LLMProvidercreateUnillMProcessor()- Advanced metadata-based processorFractalProcessor- Core processor classsimpleMerge()- Simple result merging utilityweightedMerge()- Weighted result merging
π§ͺ Tested With
- GROQ API (Llama 3.1)
- Full TypeScript type checking
- Comprehensive test coverage
- Real-world usage scenarios
π Documentation
See the README for complete documentation and examples.
π Credits
Built with β€οΈ by the Aid-On Team