rename as mini llm flow is poor

This commit is contained in:
zachary62 2025-01-09 03:01:25 +00:00
parent 0cd73ec29b
commit ad18a25dfc
17 changed files with 35 additions and 35 deletions

View File

@ -3,9 +3,9 @@
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg) ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
[![Docs](https://img.shields.io/badge/docs-latest-blue)](https://minillmflow.github.io/PocketFlow/) [![Docs](https://img.shields.io/badge/docs-latest-blue)](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.) - **💡 Pro tip!!** Build LLM apps with LLMs assistants (ChatGPT, Claude, Cursor.ai, etc.)

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ nav_order: 1
# Summarization + QA agent for Paul Graham Essay # Summarization + QA agent for Paul Graham Essay
```python ```python
from minillmflow import * from pocketflow import *
import openai, os, yaml import openai, os, yaml
# Minimal LLM wrapper # Minimal LLM wrapper
@ -25,7 +25,7 @@ shared = {"data": {}, "summary": {}}
# Load data into shared['data'] # Load data into shared['data']
class LoadData(Node): class LoadData(Node):
def prep(self, shared): def prep(self, shared):
path = "./miniLLMFlow/data/PaulGrahamEssaysLarge" path = "./PocketFlow/data/PaulGrahamEssaysLarge"
for fn in os.listdir(path): for fn in os.listdir(path):
with open(os.path.join(path, fn), 'r') as f: with open(os.path.join(path, fn), 'r') as f:
shared['data'][fn] = f.read() shared['data'][fn] = f.read()

View File

@ -4,9 +4,9 @@ title: "Home"
nav_order: 1 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**: 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"> <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> </div>

View File

@ -7,7 +7,7 @@ nav_order: 1
# Node # 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)` 1. `prep(shared)`
- A reliable step for preprocessing data from the `shared` store. - 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 ## 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. - `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. - `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.

View File

@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup( setup(
name="packetflow", name="pocketflow",
version="0.0.0", version="0.0.0",
packages=find_packages(), packages=find_packages(),
author="Zachary Huang", author="Zachary Huang",

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import AsyncNode, AsyncBatchFlow from pocketflow import AsyncNode, AsyncBatchFlow
class AsyncDataProcessNode(AsyncNode): class AsyncDataProcessNode(AsyncNode):
async def prep_async(self, shared_storage): async def prep_async(self, shared_storage):

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import AsyncNode, AsyncBatchNode, AsyncFlow from pocketflow import AsyncNode, AsyncBatchNode, AsyncFlow
class AsyncArrayChunkNode(AsyncBatchNode): class AsyncArrayChunkNode(AsyncBatchNode):
def __init__(self, chunk_size=10): def __init__(self, chunk_size=10):

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import Node, AsyncNode, AsyncFlow from pocketflow import Node, AsyncNode, AsyncFlow
class AsyncNumberNode(AsyncNode): class AsyncNumberNode(AsyncNode):

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import AsyncNode, AsyncParallelBatchNode, AsyncParallelBatchFlow from pocketflow import AsyncNode, AsyncParallelBatchNode, AsyncParallelBatchFlow
class AsyncParallelNumberProcessor(AsyncParallelBatchNode): class AsyncParallelNumberProcessor(AsyncParallelBatchNode):
def __init__(self, delay=0.1): def __init__(self, delay=0.1):

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import AsyncParallelBatchNode, AsyncParallelBatchFlow from pocketflow import AsyncParallelBatchNode, AsyncParallelBatchFlow
class AsyncParallelNumberProcessor(AsyncParallelBatchNode): class AsyncParallelNumberProcessor(AsyncParallelBatchNode):
def __init__(self, delay=0.1): def __init__(self, delay=0.1):

View File

@ -3,7 +3,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import Node, BatchFlow, Flow from pocketflow import Node, BatchFlow, Flow
class DataProcessNode(Node): class DataProcessNode(Node):
def prep(self, shared_storage): def prep(self, shared_storage):

View File

@ -3,7 +3,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import Node, BatchNode, Flow from pocketflow import Node, BatchNode, Flow
class ArrayChunkNode(BatchNode): class ArrayChunkNode(BatchNode):
def __init__(self, chunk_size=10): def __init__(self, chunk_size=10):

View File

@ -4,7 +4,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) 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): class FallbackNode(Node):
def __init__(self, should_fail=True, max_retries=1): def __init__(self, should_fail=True, max_retries=1):

View File

@ -3,7 +3,7 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import Node, Flow from pocketflow import Node, Flow
class NumberNode(Node): class NumberNode(Node):
def __init__(self, number): def __init__(self, number):

View File

@ -5,7 +5,7 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent)) sys.path.insert(0, str(Path(__file__).parent.parent))
from minillmflow import Node, Flow from pocketflow import Node, Flow
# Simple example Nodes # Simple example Nodes
class NumberNode(Node): class NumberNode(Node):