dirsql 0.4.18 → 0.4.20
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.
|
@@ -51,6 +51,7 @@ uvx --with dirsql-plugin-embeddings dirsql "
|
|
|
51
51
|
SELECT path,
|
|
52
52
|
vec_distance_cosine(emb, embed('how do I cook pasta?')) AS distance
|
|
53
53
|
FROM (SELECT path, embed(content) AS emb FROM './notes/*.md')
|
|
54
|
+
WHERE emb IS NOT NULL
|
|
54
55
|
ORDER BY distance
|
|
55
56
|
LIMIT 3"
|
|
56
57
|
```
|
|
@@ -72,7 +73,12 @@ Reading the query inside-out:
|
|
|
72
73
|
the one-liner normalizes a bare glob for you.
|
|
73
74
|
2. `embed('how do I cook pasta?')` embeds the question once (the function is
|
|
74
75
|
deterministic, so SQLite reuses the value across rows).
|
|
75
|
-
3. `
|
|
76
|
+
3. `WHERE emb IS NOT NULL` drops the files that could not be embedded. A
|
|
77
|
+
file that is unreadable or not valid UTF-8 has
|
|
78
|
+
[`NULL` content](../reference/path-tables.md#columns), so its embedding
|
|
79
|
+
and its distance are NULL too — and SQLite sorts NULLs *first* ascending,
|
|
80
|
+
so without this line the unrankable files take the top-k slots.
|
|
81
|
+
4. `vec_distance_cosine(...)` computes cosine distance between the two
|
|
76
82
|
vectors; `ORDER BY distance LIMIT 3` keeps the three nearest.
|
|
77
83
|
|
|
78
84
|
Structured files compose with SQL's JSON operators — embed one field instead
|
|
@@ -82,6 +88,7 @@ of the whole file:
|
|
|
82
88
|
SELECT path
|
|
83
89
|
FROM (SELECT path, embed(content ->> 'abstract') AS emb
|
|
84
90
|
FROM './papers/**/metadata.json')
|
|
91
|
+
WHERE emb IS NOT NULL
|
|
85
92
|
ORDER BY vec_distance_cosine(emb, embed('local private models'))
|
|
86
93
|
LIMIT 10
|
|
87
94
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -213,10 +213,10 @@
|
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
215
|
"optionalDependencies": {
|
|
216
|
-
"@dirsql/lib-linux-x64-gnu": "0.4.
|
|
217
|
-
"@dirsql/lib-linux-arm64-gnu": "0.4.
|
|
218
|
-
"@dirsql/lib-darwin-x64": "0.4.
|
|
219
|
-
"@dirsql/lib-darwin-arm64": "0.4.
|
|
220
|
-
"@dirsql/lib-win32-x64-msvc": "0.4.
|
|
216
|
+
"@dirsql/lib-linux-x64-gnu": "0.4.20",
|
|
217
|
+
"@dirsql/lib-linux-arm64-gnu": "0.4.20",
|
|
218
|
+
"@dirsql/lib-darwin-x64": "0.4.20",
|
|
219
|
+
"@dirsql/lib-darwin-arm64": "0.4.20",
|
|
220
|
+
"@dirsql/lib-win32-x64-msvc": "0.4.20"
|
|
221
221
|
}
|
|
222
222
|
}
|