Update README.md
This commit is contained in:
parent
1a6861801c
commit
a06d697537
|
|
@ -1,54 +1,21 @@
|
||||||
# PocketFlow Research Agent - Tutorial for Dummy
|
# PocketFlow Research Agent - Tutorial for Dummy
|
||||||
|
|
||||||
This project demonstrates a simple yet powerful LLM-powered research agent built with PocketFlow, a minimalist LLM framework in just 100 lines of code!
|
This project demonstrates a simple yet powerful LLM-powered research agent built with PocketFlow, a minimalist LLM framework in just 100 lines of code! This implementation is based directly on the tutorial post [LLM Agents are simply Graph — Tutorial For Dummies](https://zacharyhuang.substack.com/p/llm-agent-internal-as-a-graph-tutorial).
|
||||||
|
|
||||||
> 📝 **Note:** This implementation is based directly on the tutorial post [LLM Agents are simply Graph — Tutorial For Dummies](https://zacharyhuang.substack.com/p/llm-agent-internal-as-a-graph-tutorial). Check it out for a better understanding of the concepts!
|
## Getting Started
|
||||||
|
|
||||||
Want to learn more about PocketFlow and building cool LLM agents? Check out:
|
|
||||||
- [PocketFlow GitHub](https://github.com/the-pocket/PocketFlow)
|
|
||||||
- [PocketFlow Documentation](https://the-pocket.github.io/PocketFlow/)
|
|
||||||
|
|
||||||
## ✨ What Can This Agent Do?
|
|
||||||
|
|
||||||
This friendly little agent can:
|
|
||||||
1. 🔎 Search the web for information when it needs more context
|
|
||||||
2. 🧠 Decide intelligently when to search and when it has enough info to answer
|
|
||||||
3. 📝 Generate helpful, informative responses based on its research
|
|
||||||
|
|
||||||
## 🚀 Getting Started
|
|
||||||
|
|
||||||
### What You'll Need
|
|
||||||
- Python 3.8 or newer
|
|
||||||
- An OpenAI API key (don't worry, we'll help you set this up!)
|
|
||||||
|
|
||||||
### Easy Installation
|
|
||||||
|
|
||||||
1. Install the packages you need with this simple command:
|
1. Install the packages you need with this simple command:
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
## 📂 Project Structure
|
2. Let's get your OpenAI API key ready:
|
||||||
|
|
||||||
Here's what's in each file:
|
|
||||||
- [`main.py`](./main.py): The starting point - runs the whole show!
|
|
||||||
- [`flow.py`](./flow.py): Connects everything together into a smart agent
|
|
||||||
- [`nodes.py`](./nodes.py): The building blocks that make decisions and take actions
|
|
||||||
- [`utils.py`](./utils.py): Helper functions for talking to the LLM and searching the web
|
|
||||||
|
|
||||||
## 🏃♂️ Quick Start Guide
|
|
||||||
|
|
||||||
### Step 1: Set Up Your API Key
|
|
||||||
|
|
||||||
First, let's get your OpenAI API key ready:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENAI_API_KEY="your-api-key-here"
|
export OPENAI_API_KEY="your-api-key-here"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Make Sure Everything Works
|
3. Let's do a quick check to make sure your API key is working properly:
|
||||||
|
|
||||||
Let's do a quick check to make sure your API key is working properly:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python utils.py
|
python utils.py
|
||||||
|
|
@ -56,23 +23,19 @@ python utils.py
|
||||||
|
|
||||||
This will test both the LLM call and web search features. If you see responses, you're good to go!
|
This will test both the LLM call and web search features. If you see responses, you're good to go!
|
||||||
|
|
||||||
### Step 3: Run Your Agent
|
4. Try out the agent with the default question (about Nobel Prize winners):
|
||||||
|
|
||||||
Try out the agent with the default question (about Nobel Prize winners):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python main.py
|
python main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Ask Your Own Questions
|
5. Got a burning question? Ask anything you want by using the `--` prefix:
|
||||||
|
|
||||||
Got a burning question? Ask anything you want by using the `--` prefix:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python main.py --"What is quantum computing?"
|
python main.py --"What is quantum computing?"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🧩 How It Works
|
## How It Works?
|
||||||
|
|
||||||
The magic happens through a simple but powerful graph structure with three main parts:
|
The magic happens through a simple but powerful graph structure with three main parts:
|
||||||
|
|
||||||
|
|
@ -87,3 +50,9 @@ Here's what each part does:
|
||||||
1. **DecideAction**: The brain that figures out whether to search or answer
|
1. **DecideAction**: The brain that figures out whether to search or answer
|
||||||
2. **SearchWeb**: The researcher that goes out and finds information
|
2. **SearchWeb**: The researcher that goes out and finds information
|
||||||
3. **AnswerQuestion**: The writer that crafts the final answer
|
3. **AnswerQuestion**: The writer that crafts the final answer
|
||||||
|
|
||||||
|
Here's what's in each file:
|
||||||
|
- [`main.py`](./main.py): The starting point - runs the whole show!
|
||||||
|
- [`flow.py`](./flow.py): Connects everything together into a smart agent
|
||||||
|
- [`nodes.py`](./nodes.py): The building blocks that make decisions and take actions
|
||||||
|
- [`utils.py`](./utils.py): Helper functions for talking to the LLM and searching the web
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue