2.6 KiB
2.6 KiB
| layout | title | nav_order |
|---|---|---|
| default | Home | 1 |
Pocket Flow
A 100-line minimalist LLM framework for Agents, Task Decomposition, RAG, etc.
- Expressive: Everything you love from larger frameworks—(Multi-)Agents, Workflow, RAG, and more.
- Lightweight: Just the core graph abstraction in 100 lines. ZERO dependencies, and vendor lock-in.
- Principled: Built with modularity and clear separation of concerns at its heart.
- AI-Friendly: Intuitive enough for AI agents to assist humans in building complex LLM applications.
Core Abstraction
We model the LLM workflow as a Graph + Shared Store:
- Node handles simple (LLM) tasks.
- Flow connects nodes through Actions (labeled edges).
- Shared Store enables communication between nodes within flows.
- Batch nodes/flows allow for data-intensive tasks.
- (Advanced) Async nodes/flows allow waiting for asynchronous tasks.
- (Advanced) Parallel nodes/flows handle I/O-bound tasks.
Design Pattern
From there, it’s easy to implement popular design patterns:
- Agent autonomously makes decisions.
- Workflow chains multiple tasks into pipelines.
- RAG integrates data retrieval with generation.
- Map Reduce splits data tasks into Map and Reduce steps.
- Structured Output formats outputs consistently.
- (Advanced) Multi-Agents coordinate multiple agents.
Utility Function
We provide utility functions not in codes, but in docs:
- LLM Wrapper
- Tool
- (Optional) Viz and Debug
- (Optional) Web Search
- (Optional) Chunking
- (Optional) Embedding
- (Optional) Vector Databases
- (Optional) Text-to-Speech