Each runtime SDK has the same three examples. They intentionally use separate database names so the models do not blur together:
These files are SDK usage samples only. They are not included in either server
binary; protocol and server regression coverage remains in test.exe/test.cpp.
| Model | VEC owns | Application owns | Query shape |
|---|---|---|---|
01_relational |
vector + integer slot ID | rows/payloads in a relational DB, keyed by slot ID | 0 (ID + distance only) |
02_filenames |
vector + filename label | file bytes on the filesystem/object store | label only |
03_sidecar |
vector + label + up-to-100KB data blob | nothing else for the demonstrated record | data only |
Implementations are provided for:
- Python
- Node.js — also the runtime model for the TypeScript declarations
- C++
- Delphi/Windows
Every example uses three-dimensional vectors to keep the code readable. Start one database in another terminal before running its example:
./vec-cpu demo_relational 3 --topk=10
./vec-cpu demo_filenames 3 --topk=10
./vec-cpu demo_sidecar 3 --topk=10For a fresh database on every run without creating or reading persistence
files, add --memory:
./vec-cpu --memory demo_relational 3 --topk=10The examples and SDK connection code do not change; they still connect using
the database name, e.g. demo_relational. All records are discarded when the
server exits.
Use vec instead of vec-cpu for GPU storage. GPU QUERY returns up to 16
neighbors. CPU QUERY defaults to 50, and --topk=N configures 1..100.
The Python and Node examples retain the first TOP_K returned hits; C++ passes
that capacity directly to the SDK decoder. Delphi truncates the returned array.
There is currently no per-query server-side k field.
The examples use the default L2 metric, whose reported distance is squared Euclidean distance. Pass each SDK's cosine option when cosine distance is wanted.
The examples expect fresh demo databases because PUSH rejects exact duplicate
vectors. Use --memory for disposable runs. In persistent mode, rerunning from
scratch requires stopping the server and removing all four matching demo files
(.tensors, .meta, .hashes, and .data) before restarting it.
- Python relational example: standard-library
sqlite3; the SDK itself needs NumPy. - Node relational example:
npm install better-sqlite3; the other Node examples need no package beyond the SDK. - C++ relational example: SQLite development library, linked with
-lsqlite3. - Delphi relational example: FireDAC's SQLite driver. Add
sdkto the unit search path for all Delphi examples.
Labels are identifiers, not file access. VEC never opens the filename used in the label example. Sidecar data is opaque bytes and is limited to 102400 bytes. Non-empty data passed directly to PUSH requires a non-empty label.