commit
55e1f4fa3f
|
|
@ -82,7 +82,7 @@ summarize_all_files.run(shared)
|
||||||
## 3. Nested or Multi-Level Batches
|
## 3. Nested or Multi-Level Batches
|
||||||
|
|
||||||
You can nest a **BatchFlow** in another **BatchFlow**. For instance:
|
You can nest a **BatchFlow** in another **BatchFlow**. For instance:
|
||||||
- **Outer** batch: returns a list of diretory param dicts (e.g., `{"directory": "/pathA"}`, `{"directory": "/pathB"}`, ...).
|
- **Outer** batch: returns a list of directory param dicts (e.g., `{"directory": "/pathA"}`, `{"directory": "/pathB"}`, ...).
|
||||||
- **Inner** batch: returning a list of per-file param dicts.
|
- **Inner** batch: returning a list of per-file param dicts.
|
||||||
|
|
||||||
At each level, **BatchFlow** merges its own param dict with the parent’s. By the time you reach the **innermost** node, the final `params` is the merged result of **all** parents in the chain. This way, a nested structure can keep track of the entire context (e.g., directory + file name) at once.
|
At each level, **BatchFlow** merges its own param dict with the parent’s. By the time you reach the **innermost** node, the final `params` is the merged result of **all** parents in the chain. This way, a nested structure can keep track of the entire context (e.g., directory + file name) at once.
|
||||||
|
|
@ -104,4 +104,4 @@ class DirectoryBatchFlow(BatchFlow):
|
||||||
# MapSummaries have params like {"directory": "/path/to/dirA", "filename": "file1.txt"}
|
# MapSummaries have params like {"directory": "/path/to/dirA", "filename": "file1.txt"}
|
||||||
inner_flow = FileBatchFlow(start=MapSummaries())
|
inner_flow = FileBatchFlow(start=MapSummaries())
|
||||||
outer_flow = DirectoryBatchFlow(start=inner_flow)
|
outer_flow = DirectoryBatchFlow(start=inner_flow)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ Agentic Coding should be a collaboration between Human System Design and Agent I
|
||||||
prompt = "What is the meaning of life?"
|
prompt = "What is the meaning of life?"
|
||||||
print(call_llm(prompt))
|
print(call_llm(prompt))
|
||||||
```
|
```
|
||||||
- > **Sometimes, design Utilies before Flow:** For example, for an LLM project to automate a legacy system, the bottleneck will likely be the available interface to that system. Start by designing the hardest utilities for interfacing, and then build the flow around them.
|
- > **Sometimes, design Utilities before Flow:** For example, for an LLM project to automate a legacy system, the bottleneck will likely be the available interface to that system. Start by designing the hardest utilities for interfacing, and then build the flow around them.
|
||||||
{: .best-practice }
|
{: .best-practice }
|
||||||
|
|
||||||
4. **Node Design**: Plan how each node will read and write data, and use utility functions.
|
4. **Node Design**: Plan how each node will read and write data, and use utility functions.
|
||||||
|
|
@ -224,4 +224,4 @@ my_project/
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue