refactor: rename the rust crate from vectordb to lancedb (#1012)

This also renames the new experimental node package to lancedb. The
classic node package remains named vectordb.

The goal here is to avoid introducing piecemeal breaking changes to the
vectordb crate. Instead, once the new API is stabilized, we will
officially release the lancedb crate and deprecate the vectordb crate.
The same pattern will eventually happen with the npm package vectordb.
This commit is contained in:
Weston Pace
2024-02-22 19:56:39 -08:00
committed by GitHub
parent 3aa0c40168
commit f1596122e6
58 changed files with 140 additions and 137 deletions

View File

@@ -9,4 +9,4 @@ tag_name = v{new_version}
[bumpversion:file:rust/ffi/node/Cargo.toml] [bumpversion:file:rust/ffi/node/Cargo.toml]
[bumpversion:file:rust/vectordb/Cargo.toml] [bumpversion:file:rust/lancedb/Cargo.toml]

View File

@@ -26,4 +26,4 @@ jobs:
sudo apt install -y protobuf-compiler libssl-dev sudo apt install -y protobuf-compiler libssl-dev
- name: Publish the package - name: Publish the package
run: | run: |
cargo publish -p vectordb --all-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }} cargo publish -p lancedb --all-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

View File

@@ -1,5 +1,5 @@
[workspace] [workspace]
members = ["rust/ffi/node", "rust/vectordb", "nodejs"] members = ["rust/ffi/node", "rust/lancedb", "nodejs"]
# Python package needs to be built by maturin. # Python package needs to be built by maturin.
exclude = ["python"] exclude = ["python"]
resolver = "2" resolver = "2"

View File

@@ -6,7 +6,7 @@
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"tsc": "tsc -b", "tsc": "tsc -b",
"build": "npm run tsc && cargo-cp-artifact --artifact cdylib vectordb-node index.node -- cargo build --message-format=json", "build": "npm run tsc && cargo-cp-artifact --artifact cdylib lancedb-node index.node -- cargo build --message-format=json",
"build-release": "npm run build -- --release", "build-release": "npm run build -- --release",
"test": "npm run tsc && mocha -recursive dist/test", "test": "npm run tsc && mocha -recursive dist/test",
"integration-test": "npm run tsc && mocha -recursive dist/integration_test", "integration-test": "npm run tsc && mocha -recursive dist/integration_test",
@@ -91,4 +91,4 @@
"@lancedb/vectordb-linux-x64-gnu": "0.4.10", "@lancedb/vectordb-linux-x64-gnu": "0.4.10",
"@lancedb/vectordb-win32-x64-msvc": "0.4.10" "@lancedb/vectordb-win32-x64-msvc": "0.4.10"
} }
} }

View File

@@ -18,5 +18,5 @@ module.exports = {
"@typescript-eslint/method-signature-style": "off", "@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
}, },
ignorePatterns: ["node_modules/", "dist/", "build/", "vectordb/native.*"], ignorePatterns: ["node_modules/", "dist/", "build/", "lancedb/native.*"],
}; };

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "vectordb-nodejs" name = "lancedb-nodejs"
edition.workspace = true edition.workspace = true
version = "0.0.0" version = "0.0.0"
license.workspace = true license.workspace = true
@@ -16,7 +16,7 @@ arrow-ipc.workspace = true
futures.workspace = true futures.workspace = true
lance-linalg.workspace = true lance-linalg.workspace = true
lance.workspace = true lance.workspace = true
vectordb = { path = "../rust/vectordb" } lancedb = { path = "../rust/lancedb" }
napi = { version = "2.15", default-features = false, features = [ napi = { version = "2.15", default-features = false, features = [
"napi7", "napi7",
"async" "async"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { makeArrowTable, toBuffer } from "../vectordb/arrow"; import { makeArrowTable, toBuffer } from "../lancedb/arrow";
import { import {
Int64, Int64,
Field, Field,

View File

@@ -32,24 +32,24 @@ switch (platform) {
case 'android': case 'android':
switch (arch) { switch (arch) {
case 'arm64': case 'arm64':
localFileExisted = existsSync(join(__dirname, 'vectordb-nodejs.android-arm64.node')) localFileExisted = existsSync(join(__dirname, 'lancedb-nodejs.android-arm64.node'))
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.android-arm64.node') nativeBinding = require('./lancedb-nodejs.android-arm64.node')
} else { } else {
nativeBinding = require('vectordb-android-arm64') nativeBinding = require('lancedb-android-arm64')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
} }
break break
case 'arm': case 'arm':
localFileExisted = existsSync(join(__dirname, 'vectordb-nodejs.android-arm-eabi.node')) localFileExisted = existsSync(join(__dirname, 'lancedb-nodejs.android-arm-eabi.node'))
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.android-arm-eabi.node') nativeBinding = require('./lancedb-nodejs.android-arm-eabi.node')
} else { } else {
nativeBinding = require('vectordb-android-arm-eabi') nativeBinding = require('lancedb-android-arm-eabi')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -63,13 +63,13 @@ switch (platform) {
switch (arch) { switch (arch) {
case 'x64': case 'x64':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.win32-x64-msvc.node') join(__dirname, 'lancedb-nodejs.win32-x64-msvc.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.win32-x64-msvc.node') nativeBinding = require('./lancedb-nodejs.win32-x64-msvc.node')
} else { } else {
nativeBinding = require('vectordb-win32-x64-msvc') nativeBinding = require('lancedb-win32-x64-msvc')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -77,13 +77,13 @@ switch (platform) {
break break
case 'ia32': case 'ia32':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.win32-ia32-msvc.node') join(__dirname, 'lancedb-nodejs.win32-ia32-msvc.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.win32-ia32-msvc.node') nativeBinding = require('./lancedb-nodejs.win32-ia32-msvc.node')
} else { } else {
nativeBinding = require('vectordb-win32-ia32-msvc') nativeBinding = require('lancedb-win32-ia32-msvc')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -91,13 +91,13 @@ switch (platform) {
break break
case 'arm64': case 'arm64':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.win32-arm64-msvc.node') join(__dirname, 'lancedb-nodejs.win32-arm64-msvc.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.win32-arm64-msvc.node') nativeBinding = require('./lancedb-nodejs.win32-arm64-msvc.node')
} else { } else {
nativeBinding = require('vectordb-win32-arm64-msvc') nativeBinding = require('lancedb-win32-arm64-msvc')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -108,23 +108,23 @@ switch (platform) {
} }
break break
case 'darwin': case 'darwin':
localFileExisted = existsSync(join(__dirname, 'vectordb-nodejs.darwin-universal.node')) localFileExisted = existsSync(join(__dirname, 'lancedb-nodejs.darwin-universal.node'))
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.darwin-universal.node') nativeBinding = require('./lancedb-nodejs.darwin-universal.node')
} else { } else {
nativeBinding = require('vectordb-darwin-universal') nativeBinding = require('lancedb-darwin-universal')
} }
break break
} catch {} } catch {}
switch (arch) { switch (arch) {
case 'x64': case 'x64':
localFileExisted = existsSync(join(__dirname, 'vectordb-nodejs.darwin-x64.node')) localFileExisted = existsSync(join(__dirname, 'lancedb-nodejs.darwin-x64.node'))
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.darwin-x64.node') nativeBinding = require('./lancedb-nodejs.darwin-x64.node')
} else { } else {
nativeBinding = require('vectordb-darwin-x64') nativeBinding = require('lancedb-darwin-x64')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -132,13 +132,13 @@ switch (platform) {
break break
case 'arm64': case 'arm64':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.darwin-arm64.node') join(__dirname, 'lancedb-nodejs.darwin-arm64.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.darwin-arm64.node') nativeBinding = require('./lancedb-nodejs.darwin-arm64.node')
} else { } else {
nativeBinding = require('vectordb-darwin-arm64') nativeBinding = require('lancedb-darwin-arm64')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -152,12 +152,12 @@ switch (platform) {
if (arch !== 'x64') { if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
} }
localFileExisted = existsSync(join(__dirname, 'vectordb-nodejs.freebsd-x64.node')) localFileExisted = existsSync(join(__dirname, 'lancedb-nodejs.freebsd-x64.node'))
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.freebsd-x64.node') nativeBinding = require('./lancedb-nodejs.freebsd-x64.node')
} else { } else {
nativeBinding = require('vectordb-freebsd-x64') nativeBinding = require('lancedb-freebsd-x64')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -168,26 +168,26 @@ switch (platform) {
case 'x64': case 'x64':
if (isMusl()) { if (isMusl()) {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-x64-musl.node') join(__dirname, 'lancedb-nodejs.linux-x64-musl.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-x64-musl.node') nativeBinding = require('./lancedb-nodejs.linux-x64-musl.node')
} else { } else {
nativeBinding = require('vectordb-linux-x64-musl') nativeBinding = require('lancedb-linux-x64-musl')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
} }
} else { } else {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-x64-gnu.node') join(__dirname, 'lancedb-nodejs.linux-x64-gnu.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-x64-gnu.node') nativeBinding = require('./lancedb-nodejs.linux-x64-gnu.node')
} else { } else {
nativeBinding = require('vectordb-linux-x64-gnu') nativeBinding = require('lancedb-linux-x64-gnu')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -197,26 +197,26 @@ switch (platform) {
case 'arm64': case 'arm64':
if (isMusl()) { if (isMusl()) {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-arm64-musl.node') join(__dirname, 'lancedb-nodejs.linux-arm64-musl.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-arm64-musl.node') nativeBinding = require('./lancedb-nodejs.linux-arm64-musl.node')
} else { } else {
nativeBinding = require('vectordb-linux-arm64-musl') nativeBinding = require('lancedb-linux-arm64-musl')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
} }
} else { } else {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-arm64-gnu.node') join(__dirname, 'lancedb-nodejs.linux-arm64-gnu.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-arm64-gnu.node') nativeBinding = require('./lancedb-nodejs.linux-arm64-gnu.node')
} else { } else {
nativeBinding = require('vectordb-linux-arm64-gnu') nativeBinding = require('lancedb-linux-arm64-gnu')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -225,13 +225,13 @@ switch (platform) {
break break
case 'arm': case 'arm':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-arm-gnueabihf.node') join(__dirname, 'lancedb-nodejs.linux-arm-gnueabihf.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-arm-gnueabihf.node') nativeBinding = require('./lancedb-nodejs.linux-arm-gnueabihf.node')
} else { } else {
nativeBinding = require('vectordb-linux-arm-gnueabihf') nativeBinding = require('lancedb-linux-arm-gnueabihf')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -240,26 +240,26 @@ switch (platform) {
case 'riscv64': case 'riscv64':
if (isMusl()) { if (isMusl()) {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-riscv64-musl.node') join(__dirname, 'lancedb-nodejs.linux-riscv64-musl.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-riscv64-musl.node') nativeBinding = require('./lancedb-nodejs.linux-riscv64-musl.node')
} else { } else {
nativeBinding = require('vectordb-linux-riscv64-musl') nativeBinding = require('lancedb-linux-riscv64-musl')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
} }
} else { } else {
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-riscv64-gnu.node') join(__dirname, 'lancedb-nodejs.linux-riscv64-gnu.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-riscv64-gnu.node') nativeBinding = require('./lancedb-nodejs.linux-riscv64-gnu.node')
} else { } else {
nativeBinding = require('vectordb-linux-riscv64-gnu') nativeBinding = require('lancedb-linux-riscv64-gnu')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e
@@ -268,13 +268,13 @@ switch (platform) {
break break
case 's390x': case 's390x':
localFileExisted = existsSync( localFileExisted = existsSync(
join(__dirname, 'vectordb-nodejs.linux-s390x-gnu.node') join(__dirname, 'lancedb-nodejs.linux-s390x-gnu.node')
) )
try { try {
if (localFileExisted) { if (localFileExisted) {
nativeBinding = require('./vectordb-nodejs.linux-s390x-gnu.node') nativeBinding = require('./lancedb-nodejs.linux-s390x-gnu.node')
} else { } else {
nativeBinding = require('vectordb-linux-s390x-gnu') nativeBinding = require('lancedb-linux-s390x-gnu')
} }
} catch (e) { } catch (e) {
loadError = e loadError = e

View File

@@ -1,3 +1,3 @@
# `vectordb-darwin-arm64` # `lancedb-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `vectordb` This is the **aarch64-apple-darwin** binary for `lancedb`

View File

@@ -1,5 +1,5 @@
{ {
"name": "vectordb-darwin-arm64", "name": "lancedb-darwin-arm64",
"version": "0.4.3", "version": "0.4.3",
"os": [ "os": [
"darwin" "darwin"
@@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "vectordb.darwin-arm64.node", "main": "lancedb.darwin-arm64.node",
"files": [ "files": [
"vectordb.darwin-arm64.node" "lancedb.darwin-arm64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View File

@@ -1,3 +1,3 @@
# `vectordb-darwin-x64` # `lancedb-darwin-x64`
This is the **x86_64-apple-darwin** binary for `vectordb` This is the **x86_64-apple-darwin** binary for `lancedb`

View File

@@ -1,5 +1,5 @@
{ {
"name": "vectordb-darwin-x64", "name": "lancedb-darwin-x64",
"version": "0.4.3", "version": "0.4.3",
"os": [ "os": [
"darwin" "darwin"
@@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "vectordb.darwin-x64.node", "main": "lancedb.darwin-x64.node",
"files": [ "files": [
"vectordb.darwin-x64.node" "lancedb.darwin-x64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View File

@@ -1,3 +1,3 @@
# `vectordb-linux-arm64-gnu` # `lancedb-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `vectordb` This is the **aarch64-unknown-linux-gnu** binary for `lancedb`

View File

@@ -1,5 +1,5 @@
{ {
"name": "vectordb-linux-arm64-gnu", "name": "lancedb-linux-arm64-gnu",
"version": "0.4.3", "version": "0.4.3",
"os": [ "os": [
"linux" "linux"
@@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "vectordb.linux-arm64-gnu.node", "main": "lancedb.linux-arm64-gnu.node",
"files": [ "files": [
"vectordb.linux-arm64-gnu.node" "lancedb.linux-arm64-gnu.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View File

@@ -1,3 +1,3 @@
# `vectordb-linux-x64-gnu` # `lancedb-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `vectordb` This is the **x86_64-unknown-linux-gnu** binary for `lancedb`

View File

@@ -1,5 +1,5 @@
{ {
"name": "vectordb-linux-x64-gnu", "name": "lancedb-linux-x64-gnu",
"version": "0.4.3", "version": "0.4.3",
"os": [ "os": [
"linux" "linux"
@@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "vectordb.linux-x64-gnu.node", "main": "lancedb.linux-x64-gnu.node",
"files": [ "files": [
"vectordb.linux-x64-gnu.node" "lancedb.linux-x64-gnu.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View File

@@ -1,10 +1,10 @@
{ {
"name": "vectordb", "name": "lancedb",
"version": "0.4.3", "version": "0.4.3",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"napi": { "napi": {
"name": "vectordb-nodejs", "name": "lancedb-nodejs",
"triples": { "triples": {
"defaults": false, "defaults": false,
"additional": [ "additional": [
@@ -45,11 +45,11 @@
], ],
"scripts": { "scripts": {
"artifacts": "napi artifacts", "artifacts": "napi artifacts",
"build:native": "napi build --platform --release --js vectordb/native.js --dts vectordb/native.d.ts dist/", "build:native": "napi build --platform --release --js lancedb/native.js --dts lancedb/native.d.ts dist/",
"build:debug": "napi build --platform --dts ../vectordb/native.d.ts --js ../vectordb/native.js dist/", "build:debug": "napi build --platform --dts ../lancedb/native.d.ts --js ../lancedb/native.js dist/",
"build": "npm run build:debug && tsc -b", "build": "npm run build:debug && tsc -b",
"docs": "typedoc --plugin typedoc-plugin-markdown vectordb/index.ts", "docs": "typedoc --plugin typedoc-plugin-markdown lancedb/index.ts",
"lint": "eslint vectordb --ext .js,.ts", "lint": "eslint lancedb --ext .js,.ts",
"prepublishOnly": "napi prepublish -t npm", "prepublishOnly": "napi prepublish -t npm",
"//": "maxWorkers=1 is workaround for bigint issue in jest: https://github.com/jestjs/jest/issues/11617#issuecomment-1068732414", "//": "maxWorkers=1 is workaround for bigint issue in jest: https://github.com/jestjs/jest/issues/11617#issuecomment-1068732414",
"test": "npm run build && jest --maxWorkers=1", "test": "npm run build && jest --maxWorkers=1",
@@ -57,10 +57,10 @@
"version": "napi version" "version": "napi version"
}, },
"optionalDependencies": { "optionalDependencies": {
"vectordb-darwin-arm64": "0.4.3", "lancedb-darwin-arm64": "0.4.3",
"vectordb-darwin-x64": "0.4.3", "lancedb-darwin-x64": "0.4.3",
"vectordb-linux-arm64-gnu": "0.4.3", "lancedb-linux-arm64-gnu": "0.4.3",
"vectordb-linux-x64-gnu": "0.4.3" "lancedb-linux-x64-gnu": "0.4.3"
}, },
"dependencies": { "dependencies": {
"apache-arrow": "^15.0.0" "apache-arrow": "^15.0.0"

View File

@@ -17,8 +17,8 @@ use napi_derive::*;
use crate::table::Table; use crate::table::Table;
use crate::ConnectionOptions; use crate::ConnectionOptions;
use vectordb::connection::{ConnectBuilder, Connection as LanceDBConnection}; use lancedb::connection::{ConnectBuilder, Connection as LanceDBConnection};
use vectordb::ipc::ipc_file_to_batches; use lancedb::ipc::ipc_file_to_batches;
#[napi] #[napi]
pub struct Connection { pub struct Connection {

View File

@@ -40,12 +40,12 @@ impl From<MetricType> for LanceMetricType {
#[napi] #[napi]
pub struct IndexBuilder { pub struct IndexBuilder {
inner: vectordb::index::IndexBuilder, inner: lancedb::index::IndexBuilder,
} }
#[napi] #[napi]
impl IndexBuilder { impl IndexBuilder {
pub fn new(tbl: &dyn vectordb::Table) -> Self { pub fn new(tbl: &dyn lancedb::Table) -> Self {
let inner = tbl.create_index(&[]); let inner = tbl.create_index(&[]);
Self { inner } Self { inner }
} }

View File

@@ -14,9 +14,9 @@
use futures::StreamExt; use futures::StreamExt;
use lance::io::RecordBatchStream; use lance::io::RecordBatchStream;
use lancedb::ipc::batches_to_ipc_file;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use napi_derive::napi; use napi_derive::napi;
use vectordb::ipc::batches_to_ipc_file;
/** Typescript-style Async Iterator over RecordBatches */ /** Typescript-style Async Iterator over RecordBatches */
#[napi] #[napi]

View File

@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use lancedb::query::Query as LanceDBQuery;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use napi_derive::napi; use napi_derive::napi;
use vectordb::query::Query as LanceDBQuery;
use crate::{iterator::RecordBatchIterator, table::Table}; use crate::{iterator::RecordBatchIterator, table::Table};

View File

@@ -13,10 +13,10 @@
// limitations under the License. // limitations under the License.
use arrow_ipc::writer::FileWriter; use arrow_ipc::writer::FileWriter;
use lancedb::table::AddDataOptions;
use lancedb::{ipc::ipc_file_to_batches, table::TableRef};
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use napi_derive::napi; use napi_derive::napi;
use vectordb::table::AddDataOptions;
use vectordb::{ipc::ipc_file_to_batches, table::TableRef};
use crate::index::IndexBuilder; use crate::index::IndexBuilder;
use crate::query::Query; use crate::query::Query;

View File

@@ -1,8 +1,8 @@
{ {
"include": [ "include": [
"vectordb/*.ts", "lancedb/*.ts",
"vectordb/**/*.ts", "lancedb/**/*.ts",
"vectordb/*.js", "lancedb/*.js",
], ],
"compilerOptions": { "compilerOptions": {
"target": "es2022", "target": "es2022",
@@ -18,7 +18,7 @@
], ],
"typedocOptions": { "typedocOptions": {
"entryPoints": [ "entryPoints": [
"vectordb/index.ts" "lancedb/index.ts"
], ],
"out": "../docs/src/javascript/", "out": "../docs/src/javascript/",
"visibilityFilters": { "visibilityFilters": {

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "vectordb-node" name = "lancedb-node"
version = "0.4.10" version = "0.4.10"
description = "Serverless, low-latency vector database for AI applications" description = "Serverless, low-latency vector database for AI applications"
license.workspace = true license.workspace = true
@@ -24,9 +24,14 @@ half = { workspace = true }
lance = { workspace = true } lance = { workspace = true }
lance-index = { workspace = true } lance-index = { workspace = true }
lance-linalg = { workspace = true } lance-linalg = { workspace = true }
vectordb = { path = "../../vectordb" } lancedb = { path = "../../lancedb" }
tokio = { version = "1.23", features = ["rt-multi-thread"] } tokio = { version = "1.23", features = ["rt-multi-thread"] }
neon = {version = "0.10.1", default-features = false, features = ["channel-api", "napi-6", "promise-api", "task-api"] } neon = { version = "0.10.1", default-features = false, features = [
"channel-api",
"napi-6",
"promise-api",
"task-api",
] }
object_store = { workspace = true, features = ["aws"] } object_store = { workspace = true, features = ["aws"] }
snafu = { workspace = true } snafu = { workspace = true }
async-trait = "0" async-trait = "0"

View File

@@ -1,3 +1,3 @@
The LanceDB node bridge (vectordb-node) allows javascript applications to access LanceDB datasets. The LanceDB node bridge (lancedb-node) allows javascript applications to access LanceDB datasets.
It is build using [Neon](https://neon-bindings.com). See the node project for an example of how it is used / tests It is build using [Neon](https://neon-bindings.com). See the node project for an example of how it is used / tests

View File

@@ -34,8 +34,8 @@ pub enum Error {
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
impl From<vectordb::error::Error> for Error { impl From<lancedb::error::Error> for Error {
fn from(e: vectordb::error::Error) -> Self { fn from(e: lancedb::error::Error) -> Self {
Self::LanceDB { Self::LanceDB {
message: e.to_string(), message: e.to_string(),
} }

View File

@@ -19,7 +19,7 @@ use neon::{
}; };
use crate::{error::ResultExt, runtime, table::JsTable}; use crate::{error::ResultExt, runtime, table::JsTable};
use vectordb::Table; use lancedb::Table;
pub fn table_create_scalar_index(mut cx: FunctionContext) -> JsResult<JsPromise> { pub fn table_create_scalar_index(mut cx: FunctionContext) -> JsResult<JsPromise> {
let js_table = cx.this().downcast_or_throw::<JsBox<JsTable>, _>(&mut cx)?; let js_table = cx.this().downcast_or_throw::<JsBox<JsTable>, _>(&mut cx)?;

View File

@@ -13,10 +13,10 @@
// limitations under the License. // limitations under the License.
use lance_linalg::distance::MetricType; use lance_linalg::distance::MetricType;
use lancedb::index::IndexBuilder;
use neon::context::FunctionContext; use neon::context::FunctionContext;
use neon::prelude::*; use neon::prelude::*;
use std::convert::TryFrom; use std::convert::TryFrom;
use vectordb::index::IndexBuilder;
use crate::error::Error::InvalidIndexType; use crate::error::Error::InvalidIndexType;
use crate::error::ResultExt; use crate::error::ResultExt;

View File

@@ -22,9 +22,9 @@ use object_store::CredentialProvider;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use vectordb::connect; use lancedb::connect;
use vectordb::connection::Connection; use lancedb::connection::Connection;
use vectordb::table::ReadParams; use lancedb::table::ReadParams;
use crate::error::ResultExt; use crate::error::ResultExt;
use crate::query::JsQuery; use crate::query::JsQuery;

View File

@@ -93,7 +93,7 @@ impl JsQuery {
.and_then(|stream| { .and_then(|stream| {
stream stream
.try_collect::<Vec<_>>() .try_collect::<Vec<_>>()
.map_err(vectordb::error::Error::from) .map_err(lancedb::error::Error::from)
}) })
.await; .await;

View File

@@ -18,12 +18,12 @@ use arrow_array::{RecordBatch, RecordBatchIterator};
use lance::dataset::optimize::CompactionOptions; use lance::dataset::optimize::CompactionOptions;
use lance::dataset::{WriteMode, WriteParams}; use lance::dataset::{WriteMode, WriteParams};
use lance::io::ObjectStoreParams; use lance::io::ObjectStoreParams;
use vectordb::table::{AddDataOptions, OptimizeAction, WriteOptions}; use lancedb::table::{AddDataOptions, OptimizeAction, WriteOptions};
use crate::arrow::{arrow_buffer_to_record_batch, record_batch_to_buffer}; use crate::arrow::{arrow_buffer_to_record_batch, record_batch_to_buffer};
use lancedb::TableRef;
use neon::prelude::*; use neon::prelude::*;
use neon::types::buffer::TypedArray; use neon::types::buffer::TypedArray;
use vectordb::TableRef;
use crate::error::ResultExt; use crate::error::ResultExt;
use crate::{convert, get_aws_credential_provider, get_aws_region, runtime, JsDatabase}; use crate::{convert, get_aws_credential_provider, get_aws_region, runtime, JsDatabase};

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "vectordb" name = "lancedb"
version = "0.4.10" version = "0.4.10"
edition.workspace = true edition.workspace = true
description = "LanceDB: A serverless, low-latency vector database for AI applications" description = "LanceDB: A serverless, low-latency vector database for AI applications"

View File

@@ -19,9 +19,9 @@ use arrow_array::{FixedSizeListArray, Int32Array, RecordBatch, RecordBatchIterat
use arrow_schema::{DataType, Field, Schema}; use arrow_schema::{DataType, Field, Schema};
use futures::TryStreamExt; use futures::TryStreamExt;
use vectordb::connection::Connection; use lancedb::connection::Connection;
use vectordb::table::AddDataOptions; use lancedb::table::AddDataOptions;
use vectordb::{connect, Result, Table, TableRef}; use lancedb::{connect, Result, Table, TableRef};
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//! # VectorDB ([LanceDB](https://github.com/lancedb/lancedb)) -- Developer-friendly, serverless vector database for AI applications
//!
//! [LanceDB](https://github.com/lancedb/lancedb) is an open-source database for vector-search built with persistent storage, //! [LanceDB](https://github.com/lancedb/lancedb) is an open-source database for vector-search built with persistent storage,
//! which greatly simplifies retrevial, filtering and management of embeddings. //! which greatly simplifies retrevial, filtering and management of embeddings.
//! //!
@@ -33,7 +31,7 @@
//! LanceDB runs in process, to use it in your Rust project, put the following in your `Cargo.toml`: //! LanceDB runs in process, to use it in your Rust project, put the following in your `Cargo.toml`:
//! //!
//! ```ignore //! ```ignore
//! cargo install vectordb //! cargo install lancedb
//! ``` //! ```
//! //!
//! ### Quick Start //! ### Quick Start
@@ -45,7 +43,7 @@
//! ```rust //! ```rust
//! # use arrow_schema::{Field, Schema}; //! # use arrow_schema::{Field, Schema};
//! # tokio::runtime::Runtime::new().unwrap().block_on(async { //! # tokio::runtime::Runtime::new().unwrap().block_on(async {
//! let db = vectordb::connect("data/sample-lancedb").execute().await.unwrap(); //! let db = lancedb::connect("data/sample-lancedb").execute().await.unwrap();
//! # }); //! # });
//! ``` //! ```
//! //!
@@ -60,7 +58,7 @@
//! ```rust //! ```rust
//! use object_store::aws::AwsCredential; //! use object_store::aws::AwsCredential;
//! # tokio::runtime::Runtime::new().unwrap().block_on(async { //! # tokio::runtime::Runtime::new().unwrap().block_on(async {
//! let db = vectordb::connect("data/sample-lancedb") //! let db = lancedb::connect("data/sample-lancedb")
//! .aws_creds(AwsCredential { //! .aws_creds(AwsCredential {
//! key_id: "some_key".to_string(), //! key_id: "some_key".to_string(),
//! secret_key: "some_secret".to_string(), //! secret_key: "some_secret".to_string(),
@@ -90,7 +88,7 @@
//! //!
//! # tokio::runtime::Runtime::new().unwrap().block_on(async { //! # tokio::runtime::Runtime::new().unwrap().block_on(async {
//! # let tmpdir = tempfile::tempdir().unwrap(); //! # let tmpdir = tempfile::tempdir().unwrap();
//! # let db = vectordb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap(); //! # let db = lancedb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap();
//! let schema = Arc::new(Schema::new(vec![ //! let schema = Arc::new(Schema::new(vec![
//! Field::new("id", DataType::Int32, false), //! Field::new("id", DataType::Int32, false),
//! Field::new( //! Field::new(
@@ -134,7 +132,7 @@
//! # use arrow_schema::{Schema, Field, DataType}; //! # use arrow_schema::{Schema, Field, DataType};
//! # tokio::runtime::Runtime::new().unwrap().block_on(async { //! # tokio::runtime::Runtime::new().unwrap().block_on(async {
//! # let tmpdir = tempfile::tempdir().unwrap(); //! # let tmpdir = tempfile::tempdir().unwrap();
//! # let db = vectordb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap(); //! # let db = lancedb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap();
//! # let tbl = db.open_table("idx_test").execute().await.unwrap(); //! # let tbl = db.open_table("idx_test").execute().await.unwrap();
//! tbl.create_index(&["vector"]) //! tbl.create_index(&["vector"])
//! .ivf_pq() //! .ivf_pq()
@@ -155,7 +153,7 @@
//! # use arrow_array::{FixedSizeListArray, Float32Array, Int32Array, types::Float32Type}; //! # use arrow_array::{FixedSizeListArray, Float32Array, Int32Array, types::Float32Type};
//! # tokio::runtime::Runtime::new().unwrap().block_on(async { //! # tokio::runtime::Runtime::new().unwrap().block_on(async {
//! # let tmpdir = tempfile::tempdir().unwrap(); //! # let tmpdir = tempfile::tempdir().unwrap();
//! # let db = vectordb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap(); //! # let db = lancedb::connect(tmpdir.path().to_str().unwrap()).execute().await.unwrap();
//! # let schema = Arc::new(Schema::new(vec![ //! # let schema = Arc::new(Schema::new(vec![
//! # Field::new("id", DataType::Int32, false), //! # Field::new("id", DataType::Int32, false),
//! # Field::new("vector", DataType::FixedSizeList( //! # Field::new("vector", DataType::FixedSizeList(

View File

@@ -164,7 +164,7 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_schema::{Schema, Field, DataType}; /// # use arrow_schema::{Schema, Field, DataType};
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// let tmpdir = tempfile::tempdir().unwrap(); /// let tmpdir = tempfile::tempdir().unwrap();
/// let db = vectordb::connect(tmpdir.path().to_str().unwrap()) /// let db = lancedb::connect(tmpdir.path().to_str().unwrap())
/// .execute() /// .execute()
/// .await /// .await
/// .unwrap(); /// .unwrap();
@@ -212,7 +212,7 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_schema::{Schema, Field, DataType}; /// # use arrow_schema::{Schema, Field, DataType};
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// let tmpdir = tempfile::tempdir().unwrap(); /// let tmpdir = tempfile::tempdir().unwrap();
/// let db = vectordb::connect(tmpdir.path().to_str().unwrap()) /// let db = lancedb::connect(tmpdir.path().to_str().unwrap())
/// .execute() /// .execute()
/// .await /// .await
/// .unwrap(); /// .unwrap();
@@ -266,7 +266,7 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_schema::{Schema, Field, DataType}; /// # use arrow_schema::{Schema, Field, DataType};
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// let tmpdir = tempfile::tempdir().unwrap(); /// let tmpdir = tempfile::tempdir().unwrap();
/// let db = vectordb::connect(tmpdir.path().to_str().unwrap()) /// let db = lancedb::connect(tmpdir.path().to_str().unwrap())
/// .execute() /// .execute()
/// .await /// .await
/// .unwrap(); /// .unwrap();
@@ -324,8 +324,8 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_array::RecordBatch; /// # use arrow_array::RecordBatch;
/// # use futures::TryStreamExt; /// # use futures::TryStreamExt;
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// # let tbl = vectordb::table::NativeTable::open("/tmp/tbl").await.unwrap(); /// # let tbl = lancedb::table::NativeTable::open("/tmp/tbl").await.unwrap();
/// use crate::vectordb::Table; /// use crate::lancedb::Table;
/// let stream = tbl /// let stream = tbl
/// .query() /// .query()
/// .nearest_to(&[1.0, 2.0, 3.0]) /// .nearest_to(&[1.0, 2.0, 3.0])
@@ -343,8 +343,8 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_array::RecordBatch; /// # use arrow_array::RecordBatch;
/// # use futures::TryStreamExt; /// # use futures::TryStreamExt;
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// # let tbl = vectordb::table::NativeTable::open("/tmp/tbl").await.unwrap(); /// # let tbl = lancedb::table::NativeTable::open("/tmp/tbl").await.unwrap();
/// use crate::vectordb::Table; /// use crate::lancedb::Table;
/// let stream = tbl /// let stream = tbl
/// .query() /// .query()
/// .filter("id > 5") /// .filter("id > 5")
@@ -361,8 +361,8 @@ pub trait Table: std::fmt::Display + Send + Sync {
/// # use arrow_array::RecordBatch; /// # use arrow_array::RecordBatch;
/// # use futures::TryStreamExt; /// # use futures::TryStreamExt;
/// # tokio::runtime::Runtime::new().unwrap().block_on(async { /// # tokio::runtime::Runtime::new().unwrap().block_on(async {
/// # let tbl = vectordb::table::NativeTable::open("/tmp/tbl").await.unwrap(); /// # let tbl = lancedb::table::NativeTable::open("/tmp/tbl").await.unwrap();
/// use crate::vectordb::Table; /// use crate::lancedb::Table;
/// let stream = tbl.query().execute_stream().await.unwrap(); /// let stream = tbl.query().execute_stream().await.unwrap();
/// let batches: Vec<RecordBatch> = stream.try_collect().await.unwrap(); /// let batches: Vec<RecordBatch> = stream.try_collect().await.unwrap();
/// # }); /// # });