Skip to main content

First-party dirsql plugin: semantic search via an OpenAI-compatible embeddings endpoint.

Project description

dirsql-plugin-embeddings

A first-party dirsql plugin that adds semantic search over a directory of Markdown files. It is the worked implementation behind the Search documents by meaning how-to, swapping that guide's local model2vec model for any OpenAI-compatible /v1/embeddings endpoint.

uvx --with dirsql-plugin-embeddings dirsql

Deliberately minimal (v0.1): one embedding provider shape, one table, no chunking, no config surface beyond three environment variables.

How it works

The plugin ships a dirsql.toml fragment that dirsql discovers when the package is installed alongside it. The fragment declares:

  • the sqlite-vec extension, for vec_distance_cosine();
  • a documents table whose on-file hook embeds each **/*.md file into a TEXT embedding column;
  • a pre-query hook that embeds the incoming question and emits the nearest-neighbor SQL.

Both hooks are console scripts that call the same embedder.

Configuration

The embedder reads three environment variables (point them at any hosted or self-managed OpenAI-compatible inference server):

Variable Meaning
DIRSQL_EMBEDDINGS_BASE_URL Base URL; /v1/embeddings is appended.
DIRSQL_EMBEDDINGS_MODEL Model name sent in the request.
DIRSQL_EMBEDDINGS_API_KEY Bearer token for Authorization.

Console scripts

Script Hook Input Output
dirsql-embeddings-on-file on-file a file's absolute path (argv[1]) one-line JSON row array with path, text, embedding
dirsql-embeddings-pre-query pre-query a raw request body (argv[1]) nearest-neighbor SQL over documents

pre-query accepts both a verbatim server body ({"q": ...}) and the CLI query subcommand's {"sql": <arg>} wrapper, so dirsql query '{"q": ...}' and a real POST /query both work.

Tests

Three tiers, per the dirsql testing conventions:

  • unit (colocated, mocked seams) — src/dirsql_plugin_embeddings/*_test.py
  • integration (tests/integration/) — each console script as a real subprocess against a local stub /v1/embeddings server
  • e2e (tests/e2e/) — the full loop through the real launcher + dirsql binary + sqlite-vec, nothing mocked but the embedding endpoint

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirsql_plugin_embeddings-0.1.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dirsql_plugin_embeddings-0.1.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file dirsql_plugin_embeddings-0.1.2.tar.gz.

File metadata

  • Download URL: dirsql_plugin_embeddings-0.1.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dirsql_plugin_embeddings-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16e614930b6329f6e5200f9e914a29d3aa68d3a589b5a72f9a4cbc792a10d433
MD5 5da18e54492b133c18a9a94dbb7b4b05
BLAKE2b-256 7202be9f132e130137c929f531c90367d4e7036860e4bb9a9c1219df92b6e967

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirsql_plugin_embeddings-0.1.2.tar.gz:

Publisher: release.yml on thekevinscott/dirsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dirsql_plugin_embeddings-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dirsql_plugin_embeddings-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dda30fa69ba13f5a1a95b70d893a33971094f15a6f33e61be5a52cebe28a8757
MD5 c1ca8d9eee4b32947a8b12ddaca218a9
BLAKE2b-256 7668af604ba293b2405a1ec0cfacef2914a23726da5d66cb5cbc2fe9282e4b2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirsql_plugin_embeddings-0.1.2-py3-none-any.whl:

Publisher: release.yml on thekevinscott/dirsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page