dirsql-plugin-embeddings 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- dirsql_plugin_embeddings-0.1.1/PKG-INFO +68 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/README.md +9 -6
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/pyproject.toml +1 -0
- dirsql_plugin_embeddings-0.1.0/PKG-INFO +0 -5
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/.gitignore +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/e2e-attestations/claude-open-issues-review-le8hm5-531.json +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/src/dirsql_plugin_embeddings/__init__.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/src/dirsql_plugin_embeddings/dirsql.toml +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/src/dirsql_plugin_embeddings/embedder.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/src/dirsql_plugin_embeddings/on_file.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/src/dirsql_plugin_embeddings/pre_query.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/testing-conventions.toml +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/tests/conftest.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/tests/e2e/__init__.py +0 -0
- {dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/tests/integration/__init__.py +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dirsql-plugin-embeddings
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: First-party dirsql plugin: semantic search via an OpenAI-compatible embeddings endpoint.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
# dirsql-plugin-embeddings
|
|
9
|
+
|
|
10
|
+
A first-party [`dirsql`](https://github.com/thekevinscott/dirsql) plugin that
|
|
11
|
+
adds **semantic search** over a directory of Markdown files. It is the worked
|
|
12
|
+
implementation behind the [Search documents by
|
|
13
|
+
meaning](https://thekevinscott.github.io/dirsql/howto/search-by-meaning) how-to,
|
|
14
|
+
swapping that guide's local `model2vec` model for any OpenAI-compatible
|
|
15
|
+
`/v1/embeddings` endpoint.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
uvx --with dirsql-plugin-embeddings dirsql
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Deliberately minimal (v0.1): one embedding provider shape, one table, no
|
|
22
|
+
chunking, no config surface beyond three environment variables.
|
|
23
|
+
|
|
24
|
+
## How it works
|
|
25
|
+
|
|
26
|
+
The plugin ships a `dirsql.toml` fragment that dirsql discovers when the package
|
|
27
|
+
is installed alongside it. The fragment declares:
|
|
28
|
+
|
|
29
|
+
- the [`sqlite-vec`](https://github.com/asg017/sqlite-vec) extension, for
|
|
30
|
+
`vec_distance_cosine()`;
|
|
31
|
+
- a `documents` table whose `on-file` hook embeds each `**/*.md` file into a
|
|
32
|
+
TEXT `embedding` column;
|
|
33
|
+
- a `pre-query` hook that embeds the incoming question and emits the
|
|
34
|
+
nearest-neighbor SQL.
|
|
35
|
+
|
|
36
|
+
Both hooks are console scripts that call the same embedder.
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
The embedder reads three environment variables (point them at any hosted or
|
|
41
|
+
self-managed OpenAI-compatible inference server):
|
|
42
|
+
|
|
43
|
+
| Variable | Meaning |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `DIRSQL_EMBEDDINGS_BASE_URL` | Base URL; `/v1/embeddings` is appended. |
|
|
46
|
+
| `DIRSQL_EMBEDDINGS_MODEL` | Model name sent in the request. |
|
|
47
|
+
| `DIRSQL_EMBEDDINGS_API_KEY` | Bearer token for `Authorization`. |
|
|
48
|
+
|
|
49
|
+
## Console scripts
|
|
50
|
+
|
|
51
|
+
| Script | Hook | Input | Output |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| `dirsql-embeddings-on-file` | `on-file` | a file's absolute path (`argv[1]`) | one-line JSON row array with `path`, `text`, `embedding` |
|
|
54
|
+
| `dirsql-embeddings-pre-query` | `pre-query` | a raw request body (`argv[1]`) | nearest-neighbor SQL over `documents` |
|
|
55
|
+
|
|
56
|
+
`pre-query` accepts both a verbatim server body (`{"q": ...}`) and the CLI
|
|
57
|
+
`query` subcommand's `{"sql": <arg>}` wrapper, so `dirsql query '{"q": ...}'` and
|
|
58
|
+
a real `POST /query` both work.
|
|
59
|
+
|
|
60
|
+
## Tests
|
|
61
|
+
|
|
62
|
+
Three tiers, per the dirsql testing conventions:
|
|
63
|
+
|
|
64
|
+
- **unit** (colocated, mocked seams) — `src/dirsql_plugin_embeddings/*_test.py`
|
|
65
|
+
- **integration** (`tests/integration/`) — each console script as a real
|
|
66
|
+
subprocess against a local stub `/v1/embeddings` server
|
|
67
|
+
- **e2e** (`tests/e2e/`) — the full loop through the real launcher + `dirsql`
|
|
68
|
+
binary + `sqlite-vec`, nothing mocked but the embedding endpoint
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
A first-party [`dirsql`](https://github.com/thekevinscott/dirsql) plugin that
|
|
4
4
|
adds **semantic search** over a directory of Markdown files. It is the worked
|
|
5
5
|
implementation behind the [Search documents by
|
|
6
|
-
meaning](
|
|
7
|
-
local `model2vec` model for any OpenAI-compatible
|
|
6
|
+
meaning](https://thekevinscott.github.io/dirsql/howto/search-by-meaning) how-to,
|
|
7
|
+
swapping that guide's local `model2vec` model for any OpenAI-compatible
|
|
8
|
+
`/v1/embeddings` endpoint.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
```sh
|
|
11
|
+
uvx --with dirsql-plugin-embeddings dirsql
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Deliberately minimal (v0.1): one embedding provider shape, one table, no
|
|
15
|
+
chunking, no config surface beyond three environment variables.
|
|
13
16
|
|
|
14
17
|
## How it works
|
|
15
18
|
|
|
@@ -10,6 +10,7 @@ build-backend = "hatchling.build"
|
|
|
10
10
|
name = "dirsql-plugin-embeddings"
|
|
11
11
|
dynamic = ["version"]
|
|
12
12
|
description = "First-party dirsql plugin: semantic search via an OpenAI-compatible embeddings endpoint."
|
|
13
|
+
readme = "README.md"
|
|
13
14
|
requires-python = ">=3.11"
|
|
14
15
|
|
|
15
16
|
[tool.hatch.version]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dirsql_plugin_embeddings-0.1.0 → dirsql_plugin_embeddings-0.1.1}/tests/integration/__init__.py
RENAMED
|
File without changes
|