|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: "Home" |
| 4 | +nav_order: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +# Pocket Flow |
| 8 | + |
| 9 | +A [100-line](https://github.com/the-pocket/PocketFlow/blob/main/pocketflow/__init__.py) minimalist LLM framework for *Agents, Task Decomposition, RAG, etc*. |
| 10 | + |
| 11 | +- **Lightweight**: Just the core graph abstraction in 100 lines. ZERO dependencies, and vendor lock-in. |
| 12 | +- **Expressive**: Everything you love from larger frameworks—([Multi-](./design_pattern/multi_agent.html))[Agents](./design_pattern/agent.html), [Workflow](./design_pattern/workflow.html), [RAG](./design_pattern/rag.html), and more. |
| 13 | +- **Agentic-Coding**: Intuitive enough for AI agents to help humans build complex LLM applications. |
| 14 | + |
| 15 | +<div align="center"> |
| 16 | + <img src="https://github.com/the-pocket/.github/raw/main/assets/meme.jpg?raw=true" width="400"/> |
| 17 | +</div> |
| 18 | + |
| 19 | + |
| 20 | +## Core Abstraction |
| 21 | + |
| 22 | +We model the LLM workflow as a **Graph + Shared Store**: |
| 23 | + |
| 24 | +- [Node](./core_abstraction/node.md) handles simple (LLM) tasks. |
| 25 | +- [Flow](./core_abstraction/flow.md) connects nodes through **Actions** (labeled edges). |
| 26 | +- [Shared Store](./core_abstraction/communication.md) enables communication between nodes within flows. |
| 27 | +- [Batch](./core_abstraction/batch.md) nodes/flows allow for data-intensive tasks. |
| 28 | +- [Async](./core_abstraction/async.md) nodes/flows allow waiting for asynchronous tasks. |
| 29 | +- [(Advanced) Parallel](./core_abstraction/parallel.md) nodes/flows handle I/O-bound tasks. |
| 30 | + |
| 31 | +<div align="center"> |
| 32 | + <img src="https://github.com/the-pocket/.github/raw/main/assets/abstraction.png" width="700"/> |
| 33 | +</div> |
| 34 | + |
| 35 | +## Design Pattern |
| 36 | + |
| 37 | +From there, it’s easy to implement popular design patterns: |
| 38 | + |
| 39 | +- [Agent](./design_pattern/agent.md) autonomously makes decisions. |
| 40 | +- [Workflow](./design_pattern/workflow.md) chains multiple tasks into pipelines. |
| 41 | +- [RAG](./design_pattern/rag.md) integrates data retrieval with generation. |
| 42 | +- [Map Reduce](./design_pattern/mapreduce.md) splits data tasks into Map and Reduce steps. |
| 43 | +- [Structured Output](./design_pattern/structure.md) formats outputs consistently. |
| 44 | +- [(Advanced) Multi-Agents](./design_pattern/multi_agent.md) coordinate multiple agents. |
| 45 | + |
| 46 | +<div align="center"> |
| 47 | + <img src="https://github.com/the-pocket/.github/raw/main/assets/design.png" width="700"/> |
| 48 | +</div> |
| 49 | + |
| 50 | +## Utility Function |
| 51 | + |
| 52 | +We **do not** provide built-in utilities. Instead, we offer *examples*—please *implement your own*: |
| 53 | + |
| 54 | +- [LLM Wrapper](./utility_function/llm.md) |
| 55 | +- [Viz and Debug](./utility_function/viz.md) |
| 56 | +- [Web Search](./utility_function/websearch.md) |
| 57 | +- [Chunking](./utility_function/chunking.md) |
| 58 | +- [Embedding](./utility_function/embedding.md) |
| 59 | +- [Vector Databases](./utility_function/vector.md) |
| 60 | +- [Text-to-Speech](./utility_function/text_to_speech.md) |
| 61 | + |
| 62 | +**Why not built-in?**: I believe it's a *bad practice* for vendor-specific APIs in a general framework: |
| 63 | +- *API Volatility*: Frequent changes lead to heavy maintenance for hardcoded APIs. |
| 64 | +- *Flexibility*: You may want to switch vendors, use fine-tuned models, or run them locally. |
| 65 | +- *Optimizations*: Prompt caching, batching, and streaming are easier without vendor lock-in. |
| 66 | + |
| 67 | +## Ready to build your Apps? |
| 68 | + |
| 69 | +Check out [Agentic Coding Guidance](./guide.md), the fastest way to develop LLM projects with Pocket Flow! |
0 commit comments