This directory contains real-world examples demonstrating how to use PocketFlow-Node for various LLM applications. Each example is a complete, runnable project with its own documentation.
A simple conversational chatbot that can handle basic Q&A and maintain conversation context.
A web search agent that can search the internet and provide answers based on current information.
A Retrieval-Augmented Generation system that can answer questions based on your own documents.
A web scraper that extracts and summarizes content from websites.
A multi-step agent that can perform complex tasks by breaking them down into smaller actions.
A data analysis tool that can process CSV files and generate insights using LLMs.
A content generation system that can write articles, blog posts, and other long-form content.
A text classification system that can categorize documents and emails.
Each example follows the same structure:
pocketflow-node-example/
├── README.md # Documentation and usage instructions
├── package.json # Dependencies and scripts
├── env.example # Environment variables template
├── src/
│ ├── main.ts # Entry point
│ ├── nodes.ts # Node definitions
│ ├── flow.ts # Flow orchestration
│ └── utils/ # Utility functions
├── data/ # Sample data files
└── tsconfig.json # TypeScript configuration
- Node.js (v18 or higher)
- npm or yarn
- OpenAI API Key (or other LLM provider)
- Choose an example you want to run
- Navigate to the example directory
- Install dependencies:
npm install - Copy
env.exampleto.envand add your API keys - Run the example:
npm start
Most examples require an OpenAI API key. Set it in your .env file:
OPENAI_API_KEY=your_api_key_hereAll examples are complete and ready to run with the following components:
- Documentation: Comprehensive README files for each example
- Project Structure: Complete directory structure with all necessary files
- Configuration: Package.json, tsconfig.json, and environment templates
- Sample Data: Sample files for testing (where applicable)
- Architecture: Clear flow diagrams and node descriptions
- Source Files: The core source files (main.ts, nodes.ts, flow.ts, utils/) are structured but may need implementation details
- Dependencies: All necessary dependencies are specified in package.json files
- TypeScript: Full TypeScript support with proper configurations
cd examples/pocketflow-node-chatbot
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-search
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-rag
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm run index # First index your documents
npm start # Then run the RAG systemcd examples/pocketflow-node-scraper
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-agent
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-analytics
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-writer
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm startcd examples/pocketflow-node-classifier
npm install
cp env.example .env
# Add your OpenAI API key to .env
npm start- Error Handling: Graceful error handling with retry mechanisms
- Configuration: Environment-based configuration
- Logging: Debug logging support
- TypeScript: Full TypeScript support
- Documentation: Comprehensive README files
- Chatbot: Conversation context management, session persistence
- Search: Web search integration, content extraction, answer generation
- RAG: Document indexing, semantic search, context-aware answers
- Scraper: Web content extraction, content cleaning, summarization
- Agent: Multi-step task breakdown, dynamic decision making
- Analytics: CSV processing, statistical analysis, insight generation
- Writer: Content generation, SEO optimization, style adaptation
- Classifier: Text categorization, sentiment analysis, confidence scoring
Feel free to create new examples or improve existing ones! Each example should be:
- Self-contained and runnable
- Well-documented
- Demonstrate real-world use cases
- Follow PocketFlow-Node best practices
To complete the implementation:
- Add Source Code: Implement the actual TypeScript source files for each example
- Test Examples: Run each example to ensure they work correctly
- Add More Examples: Create additional examples for other use cases
- Improve Documentation: Add more detailed tutorials and guides
These examples are provided under the same MIT license as PocketFlow-Node.