update doc

This commit is contained in:
zachary62 2025-02-26 01:53:14 -05:00
parent 4a563feb82
commit dab9e94605
10 changed files with 34 additions and 7 deletions

View File

@ -6,7 +6,7 @@
[![Docs](https://img.shields.io/badge/docs-latest-blue)](https://the-pocket.github.io/PocketFlow/) [![Docs](https://img.shields.io/badge/docs-latest-blue)](https://the-pocket.github.io/PocketFlow/)
<div align="center"> <div align="center">
<img src="./assets/minillmflow.jpg" width="400"/> <img src="./assets/meme.jpg" width="400"/>
</div> </div>
<br> <br>
@ -67,7 +67,7 @@ From there, its easy to implement popular design patterns like ([Multi-](http
<br> <br>
<div align="center"> <div align="center">
<img src="./assets/paradigm.png" width="600"/> <img src="./assets/design.png" width="600"/>
</div> </div>
<br> <br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 MiB

View File

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 MiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 KiB

After

Width:  |  Height:  |  Size: 538 KiB

View File

@ -7,10 +7,24 @@ nav_order: 6
# Agent # Agent
For many tasks, we need agents that take dynamic and recursive actions based on the inputs they receive. Agent is a powerful design pattern, where node can take dynamic actions based on the context it receives.
You can create these agents as **Nodes** connected by *Actions* in a directed graph using [Flow](./flow.md). To express an agent, create a Node (the agent) with [branching](./flow.md) to other nodes (Actions).
### Best Practice
The core of build **performant** and **reliable** agents boils down to:
1. **Context Management**
Provide *clear, relevant context* so agents can understand the problem.
E.g., Rather than dumping an entire chat history or entire files, use a [Workflow](./decomp.md) that filters out and includes only the most relevant information.
2. **Action Space**
Define *a well-structured, unambiguous, and easy-to-use* set of actions.
For instance, avoid creating overlapping actions like `read_databases` and `read_csvs`.
Instead, unify data sources (e.g., move CSVs into a database) and design a single action.
The action can be parameterized (e.g., string for search) or programmable (e.g., SQL queries).
### Example: Search Agent ### Example: Search Agent
This agent: This agent:

View File

@ -5,9 +5,19 @@ parent: "Design"
nav_order: 2 nav_order: 2
--- ---
# Task Decomposition # Workflow
Many real-world tasks are too complex for one LLM call. The solution is to decompose them into multiple calls as a [Flow](./flow.md) of Nodes. Many real-world tasks are too complex for one LLM call. The solution is to decompose them into a [chain](./flow.md) of multiple Nodes.
### Best Practice
You don't want to make each task **too coarse**, because it may be *too complex for one LLM call*.
You don't want to make each task **too granular**, because then *the LLM call doesn't have enough context* and results are *not consistent across nodes*.
You usually need multiple *iterations* to find the *sweet spot*.
If the task has too many *edge cases*, consider using [Agents](./agent.md).
### Example: Article Writing ### Example: Article Writing

View File

@ -51,7 +51,7 @@ We model the LLM workflow as a **Nested Directed Graph**:
## Design Patterns ## Design Patterns
- [Structured Output](./structure.md) - [Structured Output](./structure.md)
- [Task Decomposition](./decomp.md) - [Workflow](./decomp.md)
- [Map Reduce](./mapreduce.md) - [Map Reduce](./mapreduce.md)
- [RAG](./rag.md) - [RAG](./rag.md)
- [Chat Memory](./memory.md) - [Chat Memory](./memory.md)

View File

@ -10,6 +10,9 @@ nav_order: 7
Multiple [Agents](./flow.md) can work together by handling subtasks and communicating the progress. Multiple [Agents](./flow.md) can work together by handling subtasks and communicating the progress.
Communication between agents is typically implemented using message queues in shared storage. Communication between agents is typically implemented using message queues in shared storage.
### Best Practice
Most of time, you don't need Multi-Agents. Start with a simple solution first.
### Example Agent Communication: Message Queue ### Example Agent Communication: Message Queue