rename as mini llm flow is poor
This commit is contained in:
parent
0cd73ec29b
commit
ad18a25dfc
|
|
@ -3,9 +3,9 @@
|
|||

|
||||
[](https://minillmflow.github.io/PocketFlow/)
|
||||
|
||||
A [100-line](packetflow/__init__.py) minimalist LLM framework for ([Multi-](https://minillmflow.github.io/PocketFlow/multi_agent.html))[Agents](https://minillmflow.github.io/PocketFlow/agent.html), [task decomposition](https://minillmflow.github.io/PocketFlow/decomp.html), [RAG](https://minillmflow.github.io/PocketFlow/rag.html), etc.
|
||||
A [100-line](pocketflow/__init__.py) minimalist LLM framework for ([Multi-](https://minillmflow.github.io/PocketFlow/multi_agent.html))[Agents](https://minillmflow.github.io/PocketFlow/agent.html), [task decomposition](https://minillmflow.github.io/PocketFlow/decomp.html), [RAG](https://minillmflow.github.io/PocketFlow/rag.html), etc.
|
||||
|
||||
- Install via ```pip install packetflow```, or just copy the [source codes](packetflow/__init__.py) (only 100 lines)
|
||||
- Install via ```pip install pocketflow```, or just copy the [source codes](pocketflow/__init__.py) (only 100 lines)
|
||||
|
||||
- **💡 Pro tip!!** Build LLM apps with LLMs assistants (ChatGPT, Claude, Cursor.ai, etc.)
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -8,7 +8,7 @@ nav_order: 1
|
|||
# Summarization + QA agent for Paul Graham Essay
|
||||
|
||||
```python
|
||||
from minillmflow import *
|
||||
from pocketflow import *
|
||||
import openai, os, yaml
|
||||
|
||||
# Minimal LLM wrapper
|
||||
|
|
@ -25,7 +25,7 @@ shared = {"data": {}, "summary": {}}
|
|||
# Load data into shared['data']
|
||||
class LoadData(Node):
|
||||
def prep(self, shared):
|
||||
path = "./miniLLMFlow/data/PaulGrahamEssaysLarge"
|
||||
path = "./PocketFlow/data/PaulGrahamEssaysLarge"
|
||||
for fn in os.listdir(path):
|
||||
with open(os.path.join(path, fn), 'r') as f:
|
||||
shared['data'][fn] = f.read()
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ title: "Home"
|
|||
nav_order: 1
|
||||
---
|
||||
|
||||
# Mini LLM Flow
|
||||
# Pocke tFlow
|
||||
|
||||
A [100-line](https://github.com/zachary62/miniLLMFlow/blob/main/minillmflow/__init__.py) minimalist LLM framework for *Agents, Task Decomposition, RAG, etc*.
|
||||
A [100-line](https://github.com/miniLLMFlow/PocketFlow/blob/main/packetflow/__init__.py) minimalist LLM framework for *Agents, Task Decomposition, RAG, etc*.
|
||||
|
||||
|
||||
We model the LLM workflow as a **Nested Directed Graph**:
|
||||
|
|
@ -19,7 +19,7 @@ We model the LLM workflow as a **Nested Directed Graph**:
|
|||
|
||||
|
||||
<div align="center">
|
||||
<img src="https://github.com/zachary62/miniLLMFlow/blob/main/assets/minillmflow.jpg?raw=true" width="400"/>
|
||||
<img src="https://github.com/miniLLMFlow/PocketFlow/raw/main/assets/minillmflow.jpg?raw=true" width="400"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ nav_order: 1
|
|||
|
||||
# Node
|
||||
|
||||
A **Node** is the smallest building block of Mini LLM Flow. Each Node has 3 steps:
|
||||
A **Node** is the smallest building block. Each Node has 3 steps:
|
||||
|
||||
1. `prep(shared)`
|
||||
- A reliable step for preprocessing data from the `shared` store.
|
||||
|
|
@ -31,7 +31,7 @@ A **Node** is the smallest building block of Mini LLM Flow. Each Node has 3 step
|
|||
|
||||
## Fault Tolerance & Retries
|
||||
|
||||
Nodes in Mini LLM Flow can **retry** execution if `exec()` raises an exception. You control this via two parameters when you create the Node:
|
||||
Nodes can **retry** execution if `exec()` raises an exception. You control this via two parameters when you create the Node:
|
||||
|
||||
- `max_retries` (int): How many times to try running `exec()`. The default is `1`, which means **no** retry.
|
||||
- `wait` (int): The time to wait (in **seconds**) before each retry attempt. By default, `wait=0` (i.e., no waiting). Increasing this is helpful when you encounter rate-limits or quota errors from your LLM provider and need to back off.
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -1,7 +1,7 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="packetflow",
|
||||
name="pocketflow",
|
||||
version="0.0.0",
|
||||
packages=find_packages(),
|
||||
author="Zachary Huang",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import AsyncNode, AsyncBatchFlow
|
||||
from pocketflow import AsyncNode, AsyncBatchFlow
|
||||
|
||||
class AsyncDataProcessNode(AsyncNode):
|
||||
async def prep_async(self, shared_storage):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import AsyncNode, AsyncBatchNode, AsyncFlow
|
||||
from pocketflow import AsyncNode, AsyncBatchNode, AsyncFlow
|
||||
|
||||
class AsyncArrayChunkNode(AsyncBatchNode):
|
||||
def __init__(self, chunk_size=10):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, AsyncNode, AsyncFlow
|
||||
from pocketflow import Node, AsyncNode, AsyncFlow
|
||||
|
||||
|
||||
class AsyncNumberNode(AsyncNode):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import AsyncNode, AsyncParallelBatchNode, AsyncParallelBatchFlow
|
||||
from pocketflow import AsyncNode, AsyncParallelBatchNode, AsyncParallelBatchFlow
|
||||
|
||||
class AsyncParallelNumberProcessor(AsyncParallelBatchNode):
|
||||
def __init__(self, delay=0.1):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import AsyncParallelBatchNode, AsyncParallelBatchFlow
|
||||
from pocketflow import AsyncParallelBatchNode, AsyncParallelBatchFlow
|
||||
|
||||
class AsyncParallelNumberProcessor(AsyncParallelBatchNode):
|
||||
def __init__(self, delay=0.1):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, BatchFlow, Flow
|
||||
from pocketflow import Node, BatchFlow, Flow
|
||||
|
||||
class DataProcessNode(Node):
|
||||
def prep(self, shared_storage):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, BatchNode, Flow
|
||||
from pocketflow import Node, BatchNode, Flow
|
||||
|
||||
class ArrayChunkNode(BatchNode):
|
||||
def __init__(self, chunk_size=10):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, AsyncNode, Flow, AsyncFlow
|
||||
from pocketflow import Node, AsyncNode, Flow, AsyncFlow
|
||||
|
||||
class FallbackNode(Node):
|
||||
def __init__(self, should_fail=True, max_retries=1):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, Flow
|
||||
from pocketflow import Node, Flow
|
||||
|
||||
class NumberNode(Node):
|
||||
def __init__(self, number):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from pathlib import Path
|
|||
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from minillmflow import Node, Flow
|
||||
from pocketflow import Node, Flow
|
||||
|
||||
# Simple example Nodes
|
||||
class NumberNode(Node):
|
||||
|
|
|
|||
Loading…
Reference in New Issue