recursive-llm-ts 2.0.5 → 2.0.6
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/dist/bunpy-bridge.js +13 -1
- package/dist/rlm-bridge.js +23 -5
- package/package.json +1 -1
package/dist/bunpy-bridge.js
CHANGED
|
@@ -79,8 +79,20 @@ class BunpyBridge {
|
|
|
79
79
|
const pythonPackagePath = path.join(__dirname, '..', 'recursive-llm');
|
|
80
80
|
const pythonSrcPath = path.join(pythonPackagePath, 'src');
|
|
81
81
|
sys.path.insert(0, pythonSrcPath);
|
|
82
|
-
//
|
|
82
|
+
// Try to import rlm, install deps if needed
|
|
83
83
|
try {
|
|
84
|
+
// First check if litellm is available
|
|
85
|
+
try {
|
|
86
|
+
this.python.import('litellm');
|
|
87
|
+
}
|
|
88
|
+
catch (_a) {
|
|
89
|
+
// litellm not found, install dependencies
|
|
90
|
+
console.log('[recursive-llm-ts] Installing Python dependencies (first time only)...');
|
|
91
|
+
const { execSync } = yield Promise.resolve().then(() => __importStar(require('child_process')));
|
|
92
|
+
const pipCmd = `pip install -e "${pythonPackagePath}" || pip3 install -e "${pythonPackagePath}"`;
|
|
93
|
+
execSync(pipCmd, { stdio: 'inherit' });
|
|
94
|
+
console.log('[recursive-llm-ts] ✓ Python dependencies installed');
|
|
95
|
+
}
|
|
84
96
|
this.rlmModule = this.python.import('rlm');
|
|
85
97
|
}
|
|
86
98
|
catch (error) {
|
package/dist/rlm-bridge.js
CHANGED
|
@@ -75,14 +75,32 @@ class PythoniaBridge {
|
|
|
75
75
|
'Note: pythonia only works with Node.js runtime, not Bun');
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
const rlmPath = path.join(__dirname, '..', 'recursive-llm', 'src', 'rlm');
|
|
78
|
+
const pythonPackagePath = path.join(__dirname, '..', 'recursive-llm');
|
|
80
79
|
// Import sys module to add path
|
|
81
80
|
const sys = yield this.python('sys');
|
|
82
81
|
const pathList = yield sys.path;
|
|
83
|
-
yield pathList.insert(0, path.join(
|
|
84
|
-
//
|
|
85
|
-
|
|
82
|
+
yield pathList.insert(0, path.join(pythonPackagePath, 'src'));
|
|
83
|
+
// Try to import rlm, install deps if needed
|
|
84
|
+
try {
|
|
85
|
+
// First check if litellm is available
|
|
86
|
+
try {
|
|
87
|
+
yield this.python('litellm');
|
|
88
|
+
}
|
|
89
|
+
catch (_a) {
|
|
90
|
+
// litellm not found, install dependencies
|
|
91
|
+
console.log('[recursive-llm-ts] Installing Python dependencies (first time only)...');
|
|
92
|
+
const { execSync } = yield Promise.resolve().then(() => __importStar(require('child_process')));
|
|
93
|
+
const pipCmd = `pip install -e "${pythonPackagePath}" || pip3 install -e "${pythonPackagePath}"`;
|
|
94
|
+
execSync(pipCmd, { stdio: 'inherit' });
|
|
95
|
+
console.log('[recursive-llm-ts] ✓ Python dependencies installed');
|
|
96
|
+
}
|
|
97
|
+
this.rlmModule = yield this.python('rlm');
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
throw new Error('Failed to import rlm module. Python dependencies may not be installed.\n' +
|
|
101
|
+
`Run: pip install -e ${pythonPackagePath}\n` +
|
|
102
|
+
`Original error: ${error.message || error}`);
|
|
103
|
+
}
|
|
86
104
|
});
|
|
87
105
|
}
|
|
88
106
|
completion(model_1, query_1, context_1) {
|
package/package.json
CHANGED