[docs] fixed javascript docs for overloaded functions (#247)

Solves #244 :


![image](https://github.com/lancedb/lancedb/assets/43097991/d1fd9d2a-0d6a-4c16-a0ab-f460cc709349)

Problem was function overloading in the interface caused some weird
`typedoc` formatting, so breaking it apart into methods fixed the issue.

Also regenerated and updated javascript docs

---------

Co-authored-by: Tevin Wang <tevin@cmu.edu>
This commit is contained in:
Leon Yee
2023-07-04 13:07:34 -07:00
committed by GitHub
parent 148ed82607
commit 9600a38ff0
14 changed files with 262 additions and 188 deletions

View File

@@ -17,7 +17,7 @@ npm install vectordb
```javascript
const lancedb = require('vectordb');
const db = await lancedb.connect('data/sample-lancedb');
const table = await db.createTable("my_table",
const table = await db.createTable("my_table",
[{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 },
{ id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 }])
const results = await table.search([0.1, 0.3]).limit(20).execute();

View File

@@ -46,7 +46,7 @@ A connection to a LanceDB database.
#### Defined in
[index.ts:129](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L129)
[index.ts:132](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L132)
## Properties
@@ -56,7 +56,7 @@ A connection to a LanceDB database.
#### Defined in
[index.ts:127](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L127)
[index.ts:130](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L130)
___
@@ -66,7 +66,7 @@ ___
#### Defined in
[index.ts:126](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L126)
[index.ts:129](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L129)
## Accessors
@@ -84,13 +84,13 @@ ___
#### Defined in
[index.ts:134](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L134)
[index.ts:137](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L137)
## Methods
### createTable
**createTable**(`name`, `data`): `Promise`<[`Table`](../interfaces/Table.md)<`number`[]\>\>
**createTable**(`name`, `data`, `mode?`): `Promise`<[`Table`](../interfaces/Table.md)<`number`[]\>\>
Creates a new Table and initialize it with new data.
@@ -100,6 +100,29 @@ Creates a new Table and initialize it with new data.
| :------ | :------ | :------ |
| `name` | `string` | The name of the table. |
| `data` | `Record`<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the Table |
| `mode?` | [`WriteMode`](../enums/WriteMode.md) | The write mode to use when creating the table. |
#### Returns
`Promise`<[`Table`](../interfaces/Table.md)<`number`[]\>\>
#### Implementation of
[Connection](../interfaces/Connection.md).[createTable](../interfaces/Connection.md#createtable)
#### Defined in
[index.ts:177](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L177)
**createTable**(`name`, `data`, `mode`): `Promise`<[`Table`](../interfaces/Table.md)<`number`[]\>\>
#### Parameters
| Name | Type |
| :------ | :------ |
| `name` | `string` |
| `data` | `Record`<`string`, `unknown`\>[] |
| `mode` | [`WriteMode`](../enums/WriteMode.md) |
#### Returns
@@ -111,9 +134,9 @@ Connection.createTable
#### Defined in
[index.ts:174](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L174)
[index.ts:178](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L178)
**createTable**<`T`\>(`name`, `data`, `embeddings`): `Promise`<[`Table`](../interfaces/Table.md)<`T`\>\>
**createTable**<`T`\>(`name`, `data`, `mode`, `embeddings`): `Promise`<[`Table`](../interfaces/Table.md)<`T`\>\>
Creates a new Table and initialize it with new data.
@@ -129,6 +152,7 @@ Creates a new Table and initialize it with new data.
| :------ | :------ | :------ |
| `name` | `string` | The name of the table. |
| `data` | `Record`<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the Table |
| `mode` | [`WriteMode`](../enums/WriteMode.md) | The write mode to use when creating the table. |
| `embeddings` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)<`T`\> | An embedding function to use on this Table |
#### Returns
@@ -141,7 +165,7 @@ Connection.createTable
#### Defined in
[index.ts:182](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L182)
[index.ts:188](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L188)
___
@@ -166,7 +190,7 @@ ___
#### Defined in
[index.ts:192](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L192)
[index.ts:201](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L201)
___
@@ -192,7 +216,7 @@ Drop an existing table.
#### Defined in
[index.ts:202](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L202)
[index.ts:211](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L211)
___
@@ -214,11 +238,11 @@ Open a table in the database.
#### Implementation of
Connection.openTable
[Connection](../interfaces/Connection.md).[openTable](../interfaces/Connection.md#opentable)
#### Defined in
[index.ts:150](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L150)
[index.ts:153](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L153)
**openTable**<`T`\>(`name`, `embeddings`): `Promise`<[`Table`](../interfaces/Table.md)<`T`\>\>
@@ -247,7 +271,7 @@ Connection.openTable
#### Defined in
[index.ts:157](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L157)
[index.ts:160](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L160)
___
@@ -267,4 +291,4 @@ Get the names of all tables in the database.
#### Defined in
[index.ts:141](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L141)
[index.ts:144](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L144)

View File

@@ -2,7 +2,7 @@
# Class: LocalTable<T\>
A LanceDB table that allows you to search and update a table.
A LanceDB Table is the collection of Records. Each Record has one or more vector fields.
## Type parameters
@@ -60,7 +60,7 @@ A LanceDB table that allows you to search and update a table.
#### Defined in
[index.ts:212](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L212)
[index.ts:221](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L221)
**new LocalTable**<`T`\>(`tbl`, `name`, `embeddings`)
@@ -80,7 +80,7 @@ A LanceDB table that allows you to search and update a table.
#### Defined in
[index.ts:218](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L218)
[index.ts:227](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L227)
## Properties
@@ -90,7 +90,7 @@ A LanceDB table that allows you to search and update a table.
#### Defined in
[index.ts:210](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L210)
[index.ts:219](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L219)
___
@@ -100,7 +100,7 @@ ___
#### Defined in
[index.ts:209](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L209)
[index.ts:218](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L218)
___
@@ -110,7 +110,7 @@ ___
#### Defined in
[index.ts:208](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L208)
[index.ts:217](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L217)
## Accessors
@@ -128,7 +128,7 @@ ___
#### Defined in
[index.ts:225](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L225)
[index.ts:234](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L234)
## Methods
@@ -156,7 +156,7 @@ The number of rows added to the table
#### Defined in
[index.ts:243](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L243)
[index.ts:252](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L252)
___
@@ -176,7 +176,7 @@ Returns the number of rows in this table.
#### Defined in
[index.ts:269](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L269)
[index.ts:278](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L278)
___
@@ -206,7 +206,7 @@ VectorIndexParams.
#### Defined in
[index.ts:262](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L262)
[index.ts:271](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L271)
___
@@ -232,7 +232,7 @@ Delete rows from this table.
#### Defined in
[index.ts:278](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L278)
[index.ts:287](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L287)
___
@@ -260,7 +260,7 @@ The number of rows added to the table
#### Defined in
[index.ts:253](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L253)
[index.ts:262](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L262)
___
@@ -286,4 +286,4 @@ Creates a search query to find the nearest neighbors of the given search term
#### Defined in
[index.ts:233](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L233)
[index.ts:242](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L242)

View File

@@ -40,7 +40,7 @@ An embedding function that automatically creates vector representation for a giv
#### Defined in
[embedding/openai.ts:21](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/openai.ts#L21)
[embedding/openai.ts:21](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/openai.ts#L21)
## Properties
@@ -50,7 +50,7 @@ An embedding function that automatically creates vector representation for a giv
#### Defined in
[embedding/openai.ts:19](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/openai.ts#L19)
[embedding/openai.ts:19](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/openai.ts#L19)
___
@@ -60,7 +60,7 @@ ___
#### Defined in
[embedding/openai.ts:18](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/openai.ts#L18)
[embedding/openai.ts:18](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/openai.ts#L18)
___
@@ -76,7 +76,7 @@ The name of the column that will be used as input for the Embedding Function.
#### Defined in
[embedding/openai.ts:50](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/openai.ts#L50)
[embedding/openai.ts:50](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/openai.ts#L50)
## Methods
@@ -102,4 +102,4 @@ Creates a vector representation for the given values.
#### Defined in
[embedding/openai.ts:38](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/openai.ts#L38)
[embedding/openai.ts:38](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/openai.ts#L38)

View File

@@ -62,7 +62,7 @@ A builder for nearest neighbor queries for LanceDB.
#### Defined in
[index.ts:353](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L353)
[index.ts:362](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L362)
## Properties
@@ -72,7 +72,7 @@ A builder for nearest neighbor queries for LanceDB.
#### Defined in
[index.ts:351](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L351)
[index.ts:360](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L360)
___
@@ -82,7 +82,7 @@ ___
#### Defined in
[index.ts:349](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L349)
[index.ts:358](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L358)
___
@@ -92,7 +92,7 @@ ___
#### Defined in
[index.ts:345](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L345)
[index.ts:354](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L354)
___
@@ -102,7 +102,7 @@ ___
#### Defined in
[index.ts:350](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L350)
[index.ts:359](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L359)
___
@@ -112,7 +112,7 @@ ___
#### Defined in
[index.ts:347](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L347)
[index.ts:356](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L356)
___
@@ -122,7 +122,7 @@ ___
#### Defined in
[index.ts:343](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L343)
[index.ts:352](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L352)
___
@@ -132,7 +132,7 @@ ___
#### Defined in
[index.ts:344](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L344)
[index.ts:353](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L353)
___
@@ -142,7 +142,7 @@ ___
#### Defined in
[index.ts:346](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L346)
[index.ts:355](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L355)
___
@@ -152,7 +152,7 @@ ___
#### Defined in
[index.ts:348](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L348)
[index.ts:357](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L357)
___
@@ -162,7 +162,7 @@ ___
#### Defined in
[index.ts:342](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L342)
[index.ts:351](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L351)
___
@@ -188,7 +188,7 @@ A filter statement to be applied to this query.
#### Defined in
[index.ts:401](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L401)
[index.ts:410](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L410)
## Methods
@@ -210,7 +210,7 @@ Execute the query and return the results as an Array of Objects
#### Defined in
[index.ts:424](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L424)
[index.ts:433](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L433)
___
@@ -232,7 +232,7 @@ A filter statement to be applied to this query.
#### Defined in
[index.ts:396](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L396)
[index.ts:405](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L405)
___
@@ -254,7 +254,7 @@ Sets the number of results that will be returned
#### Defined in
[index.ts:369](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L369)
[index.ts:378](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L378)
___
@@ -280,7 +280,7 @@ MetricType for the different options
#### Defined in
[index.ts:416](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L416)
[index.ts:425](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L425)
___
@@ -302,7 +302,7 @@ The number of probes used. A higher number makes search more accurate but also s
#### Defined in
[index.ts:387](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L387)
[index.ts:396](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L396)
___
@@ -324,7 +324,7 @@ Refine the results by reading extra elements and re-ranking them in memory.
#### Defined in
[index.ts:378](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L378)
[index.ts:387](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L387)
___
@@ -346,4 +346,4 @@ Return only the specified columns.
#### Defined in
[index.ts:407](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L407)
[index.ts:416](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L416)

View File

@@ -9,6 +9,7 @@ Distance metrics type.
### Enumeration Members
- [Cosine](MetricType.md#cosine)
- [Dot](MetricType.md#dot)
- [L2](MetricType.md#l2)
## Enumeration Members
@@ -21,7 +22,19 @@ Cosine distance
#### Defined in
[index.ts:465](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L465)
[index.ts:481](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L481)
___
### Dot
• **Dot** = ``"dot"``
Dot product
#### Defined in
[index.ts:486](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L486)
___
@@ -33,4 +46,4 @@ Euclidean distance
#### Defined in
[index.ts:460](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L460)
[index.ts:476](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L476)

View File

@@ -2,11 +2,14 @@
# Enumeration: WriteMode
Write mode for writing a table.
## Table of contents
### Enumeration Members
- [Append](WriteMode.md#append)
- [Create](WriteMode.md#create)
- [Overwrite](WriteMode.md#overwrite)
## Enumeration Members
@@ -15,9 +18,23 @@
**Append** = ``"append"``
Append new data to the table.
#### Defined in
[index.ts:450](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L450)
[index.ts:466](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L466)
___
### Create
• **Create** = ``"create"``
Create a new [Table](../interfaces/Table.md).
#### Defined in
[index.ts:462](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L462)
___
@@ -25,6 +42,8 @@ ___
• **Overwrite** = ``"overwrite"``
Overwrite the existing [Table](../interfaces/Table.md) if presented.
#### Defined in
[index.ts:449](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L449)
[index.ts:464](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L464)

View File

@@ -2,7 +2,7 @@
# Interface: Connection
A LanceDB connection that allows you to open tables and create new ones.
A LanceDB Connection that allows you to open tables and create new ones.
Connection could be local against filesystem or remote against a server.
@@ -14,124 +14,139 @@ Connection could be local against filesystem or remote against a server.
### Properties
- [uri](Connection.md#uri)
### Methods
- [createTable](Connection.md#createtable)
- [createTableArrow](Connection.md#createtablearrow)
- [dropTable](Connection.md#droptable)
- [openTable](Connection.md#opentable)
- [tableNames](Connection.md#tablenames)
- [uri](Connection.md#uri)
## Properties
### createTable
**createTable**: (`name`: `string`, `data`: `Record`<`string`, `unknown`\>[]) => `Promise`<[`Table`](Table.md)<`number`[]\>\> & <T\>(`name`: `string`, `data`: `Record`<`string`, `unknown`\>[], `embeddings`: [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\>) => `Promise`<[`Table`](Table.md)<`T`\>\> & <T\>(`name`: `string`, `data`: `Record`<`string`, `unknown`\>[], `embeddings?`: [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\>) => `Promise`<[`Table`](Table.md)<`T`\>\>
Creates a new Table and initialize it with new data.
**`Param`**
The name of the table.
**`Param`**
Non-empty Array of Records to be inserted into the Table
#### Defined in
[index.ts:63](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L63)
___
### createTableArrow
**createTableArrow**: (`name`: `string`, `table`: `Table`<`any`\>) => `Promise`<[`Table`](Table.md)<`number`[]\>\>
#### Type declaration
▸ (`name`, `table`): `Promise`<[`Table`](Table.md)<`number`[]\>\>
##### Parameters
| Name | Type |
| :------ | :------ |
| `name` | `string` |
| `table` | `Table`<`any`\> |
##### Returns
`Promise`<[`Table`](Table.md)<`number`[]\>\>
#### Defined in
[index.ts:65](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L65)
___
### dropTable
**dropTable**: (`name`: `string`) => `Promise`<`void`\>
#### Type declaration
▸ (`name`): `Promise`<`void`\>
Drop an existing table.
##### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the table to drop. |
##### Returns
`Promise`<`void`\>
#### Defined in
[index.ts:71](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L71)
___
### openTable
**openTable**: (`name`: `string`) => `Promise`<[`Table`](Table.md)<`number`[]\>\> & <T\>(`name`: `string`, `embeddings`: [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\>) => `Promise`<[`Table`](Table.md)<`T`\>\> & <T\>(`name`: `string`, `embeddings?`: [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\>) => `Promise`<[`Table`](Table.md)<`T`\>\>
Open a table in the database.
**`Param`**
The name of the table.
#### Defined in
[index.ts:54](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L54)
___
### tableNames
**tableNames**: () => `Promise`<`string`[]\>
#### Type declaration
▸ (): `Promise`<`string`[]\>
##### Returns
`Promise`<`string`[]\>
#### Defined in
[index.ts:47](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L47)
___
### uri
**uri**: `string`
#### Defined in
[index.ts:45](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L45)
[index.ts:45](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L45)
## Methods
### createTable
**createTable**<`T`\>(`name`, `data`, `mode?`, `embeddings?`): `Promise`<[`Table`](Table.md)<`T`\>\>
Creates a new Table and initialize it with new data.
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the table. |
| `data` | `Record`<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the table |
| `mode?` | [`WriteMode`](../enums/WriteMode.md) | The write mode to use when creating the table. |
| `embeddings?` | [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\> | An embedding function to use on this table |
#### Returns
`Promise`<[`Table`](Table.md)<`T`\>\>
#### Defined in
[index.ts:65](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L65)
___
### createTableArrow
**createTableArrow**(`name`, `table`): `Promise`<[`Table`](Table.md)<`number`[]\>\>
#### Parameters
| Name | Type |
| :------ | :------ |
| `name` | `string` |
| `table` | `Table`<`any`\> |
#### Returns
`Promise`<[`Table`](Table.md)<`number`[]\>\>
#### Defined in
[index.ts:67](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L67)
___
### dropTable
**dropTable**(`name`): `Promise`<`void`\>
Drop an existing table.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the table to drop. |
#### Returns
`Promise`<`void`\>
#### Defined in
[index.ts:73](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L73)
___
### openTable
**openTable**<`T`\>(`name`, `embeddings?`): `Promise`<[`Table`](Table.md)<`T`\>\>
Open a table in the database.
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the table. |
| `embeddings?` | [`EmbeddingFunction`](EmbeddingFunction.md)<`T`\> | An embedding function to use on this table |
#### Returns
`Promise`<[`Table`](Table.md)<`T`\>\>
#### Defined in
[index.ts:55](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L55)
___
### tableNames
**tableNames**(): `Promise`<`string`[]\>
#### Returns
`Promise`<`string`[]\>
#### Defined in
[index.ts:47](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L47)

View File

@@ -45,7 +45,7 @@ Creates a vector representation for the given values.
#### Defined in
[embedding/embedding_function.ts:27](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/embedding_function.ts#L27)
[embedding/embedding_function.ts:27](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/embedding_function.ts#L27)
___
@@ -57,4 +57,4 @@ The name of the column that will be used as input for the Embedding Function.
#### Defined in
[embedding/embedding_function.ts:22](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/embedding/embedding_function.ts#L22)
[embedding/embedding_function.ts:22](https://github.com/lancedb/lancedb/blob/7247834/node/src/embedding/embedding_function.ts#L22)

View File

@@ -2,7 +2,7 @@
# Interface: Table<T\>
A LanceDB table that allows you to search and update a table.
A LanceDB Table is the collection of Records. Each Record has one or more vector fields.
## Type parameters
@@ -52,7 +52,7 @@ The number of rows added to the table
#### Defined in
[index.ts:92](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L92)
[index.ts:95](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L95)
___
@@ -72,7 +72,7 @@ Returns the number of rows in this table.
#### Defined in
[index.ts:112](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L112)
[index.ts:115](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L115)
___
@@ -102,7 +102,7 @@ VectorIndexParams.
#### Defined in
[index.ts:107](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L107)
[index.ts:110](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L110)
___
@@ -128,7 +128,7 @@ Delete rows from this table.
#### Defined in
[index.ts:119](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L119)
[index.ts:122](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L122)
___
@@ -138,7 +138,7 @@ ___
#### Defined in
[index.ts:78](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L78)
[index.ts:81](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L81)
___
@@ -166,7 +166,7 @@ The number of rows added to the table
#### Defined in
[index.ts:100](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L100)
[index.ts:103](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L103)
___
@@ -192,4 +192,4 @@ Creates a search query to find the nearest neighbors of the given search term
#### Defined in
[index.ts:84](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L84)
[index.ts:87](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L87)

View File

@@ -38,7 +38,7 @@
#### Defined in
[index.ts:336](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L336)
[index.ts:345](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L345)
## Functions
@@ -60,4 +60,4 @@ Connect to a LanceDB instance at the given URI
#### Defined in
[index.ts:34](https://github.com/lancedb/lancedb/blob/bfb5400/node/src/index.ts#L34)
[index.ts:34](https://github.com/lancedb/lancedb/blob/7247834/node/src/index.ts#L34)

View File

@@ -12,5 +12,6 @@ module.exports = {
sourceType: 'module'
},
rules: {
"@typescript-eslint/method-signature-style": "off",
}
}

View File

@@ -14,8 +14,10 @@ npm install vectordb
```javascript
const lancedb = require('vectordb');
const db = lancedb.connect('<PATH_TO_LANCEDB_DATASET>');
const table = await db.openTable('my_table');
const db = await lancedb.connect('data/sample-lancedb');
const table = await db.createTable("my_table",
[{ id: 1, vector: [0.1, 1.0], item: "foo", price: 10.0 },
{ id: 2, vector: [3.9, 0.5], item: "bar", price: 20.0 }])
const results = await table.search([0.1, 0.3]).limit(20).execute();
console.log(results);
```

View File

@@ -44,34 +44,34 @@ export async function connect (uri: string): Promise<Connection> {
export interface Connection {
uri: string
tableNames: () => Promise<string[]>
tableNames(): Promise<string[]>
/**
* Open a table in the database.
*
* @param name The name of the table.
* @param embeddings An embedding function to use on this table
*/
openTable: ((name: string) => Promise<Table>) & (<T>(name: string, embeddings: EmbeddingFunction<T>) => Promise<Table<T>>) & (<T>(name: string, embeddings?: EmbeddingFunction<T>) => Promise<Table<T>>)
openTable<T>(name: string, embeddings?: EmbeddingFunction<T>): Promise<Table<T>>
/**
* Creates a new Table and initialize it with new data.
*
* @param {string} name - The name of the table.
* @param data - Non-empty Array of Records to be inserted into the Table
* @param data - Non-empty Array of Records to be inserted into the table
* @param {WriteMode} mode - The write mode to use when creating the table.
* @param {EmbeddingFunction} embeddings - An embedding function to use on this table
*/
createTable<T>(name: string, data: Array<Record<string, unknown>>, mode?: WriteMode, embeddings?: EmbeddingFunction<T>): Promise<Table<T>>
createTable: ((name: string, data: Array<Record<string, unknown>>, mode?: WriteMode) => Promise<Table>)
& ((name: string, data: Array<Record<string, unknown>>, mode: WriteMode) => Promise<Table>)
& (<T>(name: string, data: Array<Record<string, unknown>>, mode: WriteMode, embeddings: EmbeddingFunction<T>) => Promise<Table<T>>)
& (<T>(name: string, data: Array<Record<string, unknown>>, mode: WriteMode, embeddings?: EmbeddingFunction<T>) => Promise<Table<T>>)
createTableArrow: (name: string, table: ArrowTable) => Promise<Table>
createTableArrow(name: string, table: ArrowTable): Promise<Table>
/**
* Drop an existing table.
* @param name The name of the table to drop.
*/
dropTable: (name: string) => Promise<void>
dropTable(name: string): Promise<void>
}
/**