recursive-llm-ts 2.0.3 → 2.0.4
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.
- package/README.md +10 -4
- package/dist/bunpy-bridge.js +9 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,14 +14,20 @@ npm install recursive-llm-ts
|
|
|
14
14
|
- **Python 3.9+** - Required for the underlying recursive-llm Python package
|
|
15
15
|
- **pip** - Python package manager
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
### Python Dependencies
|
|
18
|
+
|
|
19
|
+
**Important:** After installing the package, you must install Python dependencies:
|
|
18
20
|
|
|
19
|
-
#### For Bun Users
|
|
20
|
-
If using Bun, also install `bunpy`:
|
|
21
21
|
```bash
|
|
22
|
-
|
|
22
|
+
cd node_modules/recursive-llm-ts/recursive-llm
|
|
23
|
+
pip install -e .
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
This installs `litellm`, `RestrictedPython`, and other required Python packages.
|
|
27
|
+
|
|
28
|
+
#### For Bun Users
|
|
29
|
+
Bunpy is included as a dependency, so no additional installation needed.
|
|
30
|
+
|
|
25
31
|
The package will automatically detect your runtime and use the appropriate Python bridge:
|
|
26
32
|
- **Node.js** → uses `pythonia` (included)
|
|
27
33
|
- **Bun** → uses `bunpy` (peer dependency)
|
package/dist/bunpy-bridge.js
CHANGED
|
@@ -74,31 +74,20 @@ class BunpyBridge {
|
|
|
74
74
|
throw new Error('bunpy is not installed. Install it with: bun add bunpy\n' +
|
|
75
75
|
'Note: bunpy only works with Bun runtime, not Node.js');
|
|
76
76
|
}
|
|
77
|
-
// Import sys
|
|
77
|
+
// Import sys module to add path
|
|
78
78
|
const sys = this.python.import('sys');
|
|
79
|
-
const subprocess = this.python.import('subprocess');
|
|
80
|
-
const os = this.python.import('os');
|
|
81
|
-
// Install Python dependencies if not already installed
|
|
82
79
|
const pythonPackagePath = path.join(__dirname, '..', 'recursive-llm');
|
|
83
|
-
try {
|
|
84
|
-
// Check if litellm is importable
|
|
85
|
-
try {
|
|
86
|
-
this.python.import('litellm');
|
|
87
|
-
}
|
|
88
|
-
catch (_a) {
|
|
89
|
-
// Install dependencies using pip
|
|
90
|
-
const result = subprocess.run([sys.executable, '-m', 'pip', 'install', '-e', pythonPackagePath], { capture_output: true, text: true, check: true });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (installError) {
|
|
94
|
-
console.warn('[recursive-llm-ts] Failed to auto-install Python dependencies:', installError);
|
|
95
|
-
console.warn('[recursive-llm-ts] Please manually run: pip install -e', pythonPackagePath);
|
|
96
|
-
}
|
|
97
|
-
// Add Python source path
|
|
98
80
|
const pythonSrcPath = path.join(pythonPackagePath, 'src');
|
|
99
81
|
sys.path.insert(0, pythonSrcPath);
|
|
100
82
|
// Import the rlm module
|
|
101
|
-
|
|
83
|
+
try {
|
|
84
|
+
this.rlmModule = this.python.import('rlm');
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw new Error('Failed to import rlm module. Python dependencies may not be installed.\n' +
|
|
88
|
+
`Run: pip install -e ${pythonPackagePath}\n` +
|
|
89
|
+
`Original error: ${error.message || error}`);
|
|
90
|
+
}
|
|
102
91
|
});
|
|
103
92
|
}
|
|
104
93
|
completion(model_1, query_1, context_1) {
|
package/package.json
CHANGED