drift-ml 0.2.6 → 0.2.8
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 +19 -1
- package/bin/drift.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ That's it. On first run, drift downloads and starts the engine automatically. No
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
-
## Example
|
|
41
|
+
## Example (CLI)
|
|
42
42
|
|
|
43
43
|
```text
|
|
44
44
|
drift › load iris.csv
|
|
@@ -49,6 +49,24 @@ drift › quit
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
|
+
## Use as library
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install drift-ml
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from drift import Drift
|
|
60
|
+
|
|
61
|
+
d = Drift()
|
|
62
|
+
d.load("iris.csv")
|
|
63
|
+
d.chat("predict sepal length")
|
|
64
|
+
result = d.train()
|
|
65
|
+
print(result["metrics"])
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
52
70
|
## Philosophy
|
|
53
71
|
|
|
54
72
|
drift should feel like `git`, `docker`, `brew` — a tool you trust immediately. Zero friction. Open source.
|
package/bin/drift.js
CHANGED
|
@@ -13,7 +13,7 @@ const http = require("http");
|
|
|
13
13
|
const isWindows = process.platform === "win32";
|
|
14
14
|
const ENGINE_PORT = process.env.DRIFT_ENGINE_PORT || "8000";
|
|
15
15
|
const GITHUB_REPO = "lakshitsachdeva/intent2model"; // Engine binaries (same repo)
|
|
16
|
-
const ENGINE_TAG = "v0.2.
|
|
16
|
+
const ENGINE_TAG = "v0.2.8"; // Pinned — direct URL, no API, no rate limits
|
|
17
17
|
const ENGINE_BASE_URL = `https://github.com/${GITHUB_REPO}/releases/download/${ENGINE_TAG}`;
|
|
18
18
|
const HEALTH_URL = `http://127.0.0.1:${ENGINE_PORT}/health`;
|
|
19
19
|
const HEALTH_TIMEOUT_MS = 2000;
|
|
@@ -132,6 +132,16 @@ async function ensureEngine() {
|
|
|
132
132
|
if (!fs.existsSync(binDir)) {
|
|
133
133
|
fs.mkdirSync(binDir, { recursive: true });
|
|
134
134
|
}
|
|
135
|
+
// Re-download if engine tag changed (e.g. after npm upgrade)
|
|
136
|
+
const versionFile = path.join(binDir, ".engine-tag");
|
|
137
|
+
if (fs.existsSync(binPath)) {
|
|
138
|
+
try {
|
|
139
|
+
const stored = fs.existsSync(versionFile) ? fs.readFileSync(versionFile, "utf8").trim() : "";
|
|
140
|
+
if (stored !== ENGINE_TAG) {
|
|
141
|
+
fs.unlinkSync(binPath);
|
|
142
|
+
}
|
|
143
|
+
} catch (_) {}
|
|
144
|
+
}
|
|
135
145
|
if (!fs.existsSync(binPath)) {
|
|
136
146
|
const { plat, arch } = getPlatformKey();
|
|
137
147
|
const ext = isWindows ? ".exe" : "";
|
|
@@ -140,6 +150,9 @@ async function ensureEngine() {
|
|
|
140
150
|
process.stderr.write(`drift: Downloading engine (${asset})...\n`);
|
|
141
151
|
try {
|
|
142
152
|
await downloadWithCurl(url, binPath).catch(() => downloadFile(url, binPath));
|
|
153
|
+
try {
|
|
154
|
+
fs.writeFileSync(versionFile, ENGINE_TAG);
|
|
155
|
+
} catch (_) {}
|
|
143
156
|
} catch (e) {
|
|
144
157
|
console.error("drift: Download failed.", e.message);
|
|
145
158
|
return false;
|