Compare commits

..

2 Commits

Author SHA1 Message Date
albertlockett
8abd5c8d85 fix ann docs 2024-01-03 15:36:54 -05:00
albertlockett
1b455dbce8 fix saas test 2024-01-03 14:49:19 -05:00
2 changed files with 9 additions and 16 deletions

View File

@@ -88,9 +88,6 @@ jobs:
cd docs/test
node md_testing.js
- name: Test
env:
LANCEDB_URI: ${{ secrets.LANCEDB_URI }}
LANCEDB_DEV_API_KEY: ${{ secrets.LANCEDB_DEV_API_KEY }}
run: |
cd docs/test/node
for d in *; do cd "$d"; echo "$d".js; node "$d".js; cd ..; done

View File

@@ -37,21 +37,17 @@ yet support Windows or musl-based Linux (such as Alpine Linux).
## Example code
```javascript
const lancedb = require('vectordb');
const { Schema, Field, Int32, Float32, Utf8, FixedSizeList } = require ("apache-arrow/Arrow.node")
const { Schema, Field, Int32, FixedSizeList, Float32 } = require('apache-arrow/Arrow.node')
// connect to a remote DB
const devApiKey = process.env.LANCEDB_DEV_API_KEY
const dbURI = process.env.LANCEDB_URI
console.log(devApiKey)
const db = await lancedb.connect({
uri: dbURI, // replace dbURI with your project, e.g. "db://your-project-name"
apiKey: devApiKey, // replace dbURI with your api key
region: "us-east-1-dev"
uri: "db://your-project-name",
apiKey: "sk_...",
region: "us-east-1"
});
// create a new table
const tableName = "my_table_000"
const tableName = "my_table"
const data = [
{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 },
{ id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 }
@@ -60,7 +56,7 @@ const schema = new Schema(
[
new Field('id', new Int32()),
new Field('vector', new FixedSizeList(2, new Field('float32', new Float32()))),
new Field('item', new Utf8()),
new Field('item', new String()),
new Field('price', new Float32())
]
)
@@ -76,11 +72,11 @@ const newData = [
{ id: 3, vector: [10.3, 1.9], item: "test1", price: 30.0 },
{ id: 4, vector: [6.2, 9.2], item: "test2", price: 40.0 }
]
await table.add(newData)
table.add(newData)
// create the index for the table
await table.createIndex({
metric_type: "L2",
column: "vector"
metric_type: 'L2',
column: 'vector'
})
let result = await table.search([2.8, 4.3]).select(["vector", "price"]).limit(1).execute()
// update the data