update agent
This commit is contained in:
parent
e5e474b74a
commit
d06fe20a01
|
|
@ -11,19 +11,19 @@ Agent is a powerful design pattern in which nodes can take dynamic actions based
|
||||||
|
|
||||||
The core of building **high-performance** and **reliable** agents boils down to:
|
The core of building **high-performance** and **reliable** agents boils down to:
|
||||||
|
|
||||||
1. **Context Management:** Provide *relevant, minimal context* so that agents can understand the problem. For example, rather than including an entire chat history or entire files, use a [Workflow](./workflow.md) that includes only the most relevant information. This is because, even if LLMs have larger contexts, they can exhibit the ["lost in the middle"](https://arxiv.org/abs/2307.03172) phenomenon, focusing primarily on the middle portion of the input.
|
1. **Context Management:** Provide *relevant, minimal context.* For example, rather than including an entire chat history, use [RAG](./rag.md) to retrieve only the most relevant parts. Even if LLMs have larger context windows, they can exhibit the ["lost in the middle"](https://arxiv.org/abs/2307.03172), often focusing on the start and end portions of the context while disregarding the middle.
|
||||||
|
|
||||||
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., with a search string) or be programmable (e.g., through SQL queries).
|
2. **Action Space:** Define *a well-structured and unambiguous* set of actions. Avoid overlapping actions like `read_databases` and `read_csvs`. Instead, unify data sources (e.g., import CSVs into a database) and design a single action. That action can be parameterized (e.g., a search string) or made programmable (e.g., SQL queries).
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://github.com/the-pocket/PocketFlow/raw/main/assets/agent.png?raw=true" width="250"/>
|
<img src="https://github.com/the-pocket/PocketFlow/raw/main/assets/agent.png?raw=true" width="350"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
To implement an agent:
|
Agent Implementation Steps:
|
||||||
|
|
||||||
1. Implement the nodes that provide context and perform actions.
|
1. **Context and Action:** Implement nodes that supply context and perform actions.
|
||||||
2. Connect these nodes with an agent node, using [branching](../core_abstraction/flow.md) to direct the flow to other action nodes.
|
2. **Branching:** Connect action nodes with an agent node, using [branching](../core_abstraction/flow.md) to direct the flow to other action nodes, and potentially loop back.
|
||||||
3. Implement the agent node, with an example prompt template that looks like this:
|
3. **Agent Node:** Provide a prompt—for example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue