| 1 | # LanceDB |
| 2 | |
| 3 | A JavaScript / Node.js library for [LanceDB](https://github.com/lancedb/lancedb). |
| 4 | |
| 5 | ## Installation |
| 6 | |
| 7 | ```bash |
| 8 | npm install vectordb |
| 9 | ``` |
| 10 | |
| 11 | This will download the appropriate native library for your platform. We currently |
| 12 | support: |
| 13 | |
| 14 | * Linux (x86_64 and aarch64) |
| 15 | * MacOS (Intel and ARM/M1/M2) |
| 16 | * Windows (x86_64 only) |
| 17 | |
| 18 | We do not yet support musl-based Linux (such as Alpine Linux) or aarch64 Windows. |
| 19 | |
| 20 | ## Usage |
| 21 | |
| 22 | ### Basic Example |
| 23 | |
| 24 | ```javascript |
| 25 | const lancedb = require('vectordb'); |
| 26 | const db = await lancedb.connect('data/sample-lancedb'); |
| 27 | const table = await db.createTable("my_table", |
| 28 | [{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 }, |
| 29 | { id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 }]) |
| 30 | const results = await table.search([0.1, 0.3]).limit(20).execute(); |
| 31 | console.log(results); |
| 32 | ``` |
| 33 | |
| 34 | The [examples](./examples) folder contains complete examples. |
| 35 | |
| 36 | ## Development |
| 37 | |
| 38 | To build everything fresh: |
| 39 | |
| 40 | ```bash |
| 41 | npm install |
| 42 | npm run build |
| 43 | ``` |
| 44 | |
| 45 | Then you should be able to run the tests with: |
| 46 | |
| 47 | ```bash |
| 48 | npm test |
| 49 | ``` |
| 50 | |
| 51 | ### Fix lints |
| 52 | |
| 53 | To run the linter and have it automatically fix all errors |
| 54 | |
| 55 | ```bash |
| 56 | npm run lint -- --fix |
| 57 | ``` |
| 58 | |
| 59 | To build documentation |
| 60 | |
| 61 | ```bash |
| 62 | npx typedoc --plugin typedoc-plugin-markdown --out ../docs/src/javascript src/index.ts |
| 63 | ``` |