@sisu-ai/mw-react-parser 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +22 -6
  2. package/package.json +11 -2
package/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # @sisu-ai/mw-react-parser
2
2
 
3
- Lightweight ReAct-style tool loop.
3
+ Lightweight ReAct-style tool loop. Lets the model decide an action in natural language, you parse it, execute, and then the model reflects and answers.
4
4
 
5
- ## Behavior
6
- - Asks the model for a reply with tools disabled.
7
- - Parses `Action: <tool>` and `Action Input: <json or text>` from the assistant message.
8
- - Invokes the tool and appends a `role:'tool'` message.
9
- - Asks the model again for a final assistant message.
5
+ ## Setup
6
+ ```bash
7
+ npm i @sisu-ai/mw-react-parser
8
+ ```
9
+
10
+ ## Documentation
11
+ Discover what you can do through examples or documentation. Check it out at https://github.com/finger-gun/sisu
12
+
13
+ ## Behavior (ReAct pattern)
14
+ - Think: Ask the model for an initial response with tools disabled (`toolChoice: 'none'`).
15
+ - Act: Parse `Action: <tool>` and `Action Input: <json or text>` from its message.
16
+ - Observe: Execute the named tool with parsed input, append a `role:'tool'` message.
17
+ - Reflect: Ask the model again to produce the final answer that incorporates the observation.
10
18
 
11
19
  ## Usage
12
20
  ```ts
@@ -15,3 +23,11 @@ import { reactToolLoop } from '@sisu-ai/mw-react-parser';
15
23
  const app = new Agent()
16
24
  .use(reactToolLoop());
17
25
  ```
26
+
27
+ Prompting tip
28
+ - Seed system with the expected format, e.g.:
29
+ - `Use tools when helpful. Reply with\nAction: <tool>\nAction Input: <JSON>`
30
+
31
+ Customizing
32
+ - Provide your own tools via `@sisu-ai/mw-register-tools` and define strict zod schemas for reliable parsing.
33
+ - If you need a different action syntax, build a small middleware before/after to transform the assistant message.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sisu-ai/mw-react-parser",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,6 +14,15 @@
14
14
  "build": "tsc -b"
15
15
  },
16
16
  "peerDependencies": {
17
- "@sisu-ai/core": "0.2.0"
17
+ "@sisu-ai/core": "0.3.0"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/finger-gun/sisu",
22
+ "directory": "packages/middleware/react-parser"
23
+ },
24
+ "homepage": "https://github.com/finger-gun/sisu#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/finger-gun/sisu/issues"
18
27
  }
19
28
  }