docs fix
This commit is contained in:
parent
f1f89d223a
commit
b3994478eb
|
|
@ -2,7 +2,7 @@
|
|||
|
||||

|
||||
|
||||
A 100-line minimalist LLM framework for agents, task decomposition, RAG, etc.
|
||||
A [100-line](minillmflow/__init__.py) minimalist LLM framework for agents, task decomposition, RAG, etc.
|
||||
|
||||
- Install via ```pip install minillmflow```, or just copy the [source](minillmflow/__init__.py) (only 100 lines)
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ Hence, I built this framework that lets LLMs focus on what matters. It turns out
|
|||
|
||||
|
||||
<div align="center">
|
||||
<img src="./assets/minillmflow.jpg" width="400"/>
|
||||
<img src="/assets/minillmflow.jpg" width="400"/>
|
||||
</div>
|
||||
|
||||
## Example
|
||||
|
|
|
|||
|
|
@ -1,23 +1,26 @@
|
|||
---
|
||||
layout: default
|
||||
title: "Home"
|
||||
nav_order: 1
|
||||
---
|
||||
|
||||
# Mini LLM Flow
|
||||
|
||||
A 100-line minimalist LLM framework for agents, task decomposition, RAG, etc.
|
||||
|
||||

|
||||
<div align="center">
|
||||
<img src="/assets/minillmflow.jpg" width="400"/>
|
||||
</div>
|
||||
|
||||
## Core Abstraction
|
||||
|
||||
We model the LLM workflow as a **Nested Flow**:
|
||||
|
||||
- Each **Node** handles a simple LLM task (e.g., text summarization, structure extraction, or question answering).
|
||||
- Nodes are chained together to form a **Flow** for more complex tasks. One Node can be chained to multiple Nodes based on **Actions**, e.g., for agentic steps.
|
||||
- Each **Node** handles a simple LLM task.
|
||||
- Nodes are chained together to form a **Flow** for more complex tasks.
|
||||
- One Node can be chained to multiple Nodes based on **Actions**.
|
||||
- A Flow can be treated as a Node for **Nested Flows**.
|
||||
- Both Nodes and Flows can be **Batched** for data-intensive tasks (e.g., processing one file at a time in a directory of files).
|
||||
- Nodes and Flows can be **Async**, e.g., for user feedback before proceeding.
|
||||
- Both Nodes and Flows can be **Batched** for data-intensive tasks.
|
||||
- Nodes and Flows can be **Async**.
|
||||
|
||||
- [Node](./node.md)
|
||||
- [Flow](./flow.md)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
layout: default
|
||||
title: "Node"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
# Node
|
||||
|
|
@ -38,16 +39,16 @@ When an exception occurs in `exec()`, the Node automatically retries until:
|
|||
|
||||
If you want to **gracefully handle** the error rather than raising it, you can override:
|
||||
|
||||
``
|
||||
```
|
||||
def process_after_fail(self, shared, prep_res, exc):
|
||||
raise exc
|
||||
``
|
||||
```
|
||||
|
||||
By **default**, it just re-raises `exc`. But you can return a fallback result instead. That fallback result becomes the `exec_res` passed to `post()`.
|
||||
|
||||
## Minimal Example
|
||||
|
||||
``
|
||||
```
|
||||
class SummarizeFile(Node):
|
||||
def prep(self, shared):
|
||||
filename = self.params["filename"]
|
||||
|
|
@ -68,5 +69,5 @@ class SummarizeFile(Node):
|
|||
filename = self.params["filename"]
|
||||
shared["summary"][filename] = exec_res
|
||||
# Return "default" by not returning anything
|
||||
``
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue