How happyallday/pocketflow works
External dependencies (LLM vendors, databases, web frameworks)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Main components
• Core Library (pocketflow/__init__.py)
• Utility modules (docs/utility_function, .cursor/rules/*, utils/update_pocketflow_mdc.py)
• Design‐pattern docs (docs/design_pattern)
• Cookbook examples (cookbook/*)
• Tests (tests/*.py)
• Deployment/config (setup.py, requirements.txt in examples)
Relationships & data flows
• Core Library exports the Graph abstraction (Node, Flow classes).
– Indexed by setup.py for pip installation.
• Design‐pattern & utility docs reference Core Library APIs.
• Cookbook examples import pocketflow, define flows (flow.py), nodes (nodes.py), and launch via main.py.
– Some examples spin up a CLI (CLI‐HITL), FastAPI server (background tasks, WebSocket, HITL), Streamlit front‐end, Gradio, or interact with local files/databases.
– Each node typically calls an external service: LLM API (OpenAI/Anthropic, etc.), vector DB, Google Calendar, PDF vision, etc.
• Tests directly import pocketflow core to validate abstractions (async, batch, parallel flows, fallback, composition).
Call out architectural patterns
• Graph at heart: nodes represent LLM calls or data transforms; flows compose nodes.
• Design patterns layered on Graph: Agents (single & multi‐agent), Workflow, RAG, Map‐Reduce, Supervisor, Memory, Parallel & Batch processing.
• Utility functions pluggable: embedding, chunking, visualization, web search, text‐to‐speech.
• Examples showcase real‐world integrations:
– Web frameworks: FastAPI (SSE, WebSocket, background), Streamlit, Gradio
– CLI for HITL feedback
– Databases: SQLite for Text2SQL, ecommerce.db
– Audio: VAD, STT, TTS pipelines in voice‐chat
Technologies & frameworks
• Python 3.x
• LLM vendors via HTTP (OpenAI, self‐hosted)
• Web frameworks: FastAPI, Uvicorn, SSE, WebSocket
• Front‐ends: Streamlit, Gradio
• Databases: SQLite
• CI/test: pytest
• Packaging: setuptools
Detail & labeling
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––