Movatterモバイル変換


[0]ホーム

URL:


Skip to content

vectordb / Exports

vectordb

Table of contents

Enumerations

Classes

Interfaces

Type Aliases

Functions

Type Aliases

VectorIndexParams

ƬVectorIndexParams:IvfPQIndexConfig

Defined in

index.ts:1348

Functions

connect

connect(uri):Promise\<Connection>

Connect to a LanceDB instance at the given URI.

Accepted formats:

  • /path/to/database - local database
  • s3://bucket/path/to/database orgs://bucket/path/to/database - database on cloud storage
  • db://host:port - remote database (LanceDB cloud)

Parameters

NameTypeDescription
uristringThe uri of the database. If the database uri starts withdb:// then it connects to a remote database.

Returns

Promise\<Connection>

See

ConnectionOptions for more details on the URI format.

Defined in

index.ts:189

connect(opts):Promise\<Connection>

Connect to a LanceDB instance with connection options.

Parameters

NameTypeDescription
optsPartial\<ConnectionOptions>TheConnectionOptions to use when connecting to the database.

Returns

Promise\<Connection>

Defined in

index.ts:195


convertToTable

convertToTable\<T>(data,embeddings?,makeTableOptions?):Promise\<ArrowTable>

Type parameters

Name
T

Parameters

NameType
dataRecord\<string,unknown>[]
embeddings?EmbeddingFunction\<T>
makeTableOptions?Partial\<MakeArrowTableOptions>

Returns

Promise\<ArrowTable>

Defined in

arrow.ts:465


isWriteOptions

isWriteOptions(value): value is WriteOptions

Parameters

NameType
valueany

Returns

value is WriteOptions

Defined in

index.ts:1374


makeArrowTable

makeArrowTable(data,options?):ArrowTable

An enhanced version of the makeTable function from Apache Arrowthat supports nested fields and embeddings columns.

This function converts an array of Record (row-major JS objects)to an Arrow Table (a columnar structure)

Note that it currently does not support nulls.

If a schema is provided then it will be used to determine the resulting arraytypes. Fields will also be reordered to fit the order defined by the schema.

If a schema is not provided then the types will be inferred and the field orderwill be controlled by the order of properties in the first record.

If the input is empty then a schema must be provided to create an empty table.

When a schema is not specified then data types will be inferred. The inferencerules are as follows:

  • boolean => Bool
  • number => Float64
  • String => Utf8
  • Buffer => Binary
  • Record => Struct
  • Array => List

Parameters

NameTypeDescription
dataRecord\<string,any>[]input data
options?Partial\<MakeArrowTableOptions>options to control the makeArrowTable call.

Returns

ArrowTable

Example

import{fromTableToBuffer,makeArrowTable}from"../arrow";import{Field,FixedSizeList,Float16,Float32,Int32,Schema}from"apache-arrow";constschema=newSchema([newField("a",newInt32()),newField("b",newFloat32()),newField("c",newFixedSizeList(3,newField("item",newFloat16()))),]);consttable=makeArrowTable([{a:1,b:2,c:[1,2,3]},{a:4,b:5,c:[4,5,6]},{a:7,b:8,c:[7,8,9]},],{schema});

By default it assumes that the column namedvector is a vector columnand it will be converted into a fixed size list array of type float32.ThevectorColumns option can be used to support other vector columnnames and data types.

constschema=newSchema([newField("a",newFloat64()),newField("b",newFloat64()),newField("vector",newFixedSizeList(3,newField("item",newFloat32()))),]);consttable=makeArrowTable([{a:1,b:2,vector:[1,2,3]},{a:4,b:5,vector:[4,5,6]},{a:7,b:8,vector:[7,8,9]},]);assert.deepEqual(table.schema,schema);

You can specify the vector column types and names using the options as well

constschema=newSchema([newField('a',newFloat64()),newField('b',newFloat64()),newField('vec1',newFixedSizeList(3,newField('item',newFloat16()))),newField('vec2',newFixedSizeList(3,newField('item',newFloat16())))]);consttable=makeArrowTable([{a:1,b:2,vec1:[1,2,3],vec2:[2,4,6]},{a:4,b:5,vec1:[4,5,6],vec2:[8,10,12]},{a:7,b:8,vec1:[7,8,9],vec2:[14,16,18]}],{vectorColumns:{vec1:{type:newFloat16()},vec2:{type:newFloat16()}}}assert.deepEqual(table.schema,schema)

Defined in

arrow.ts:198


[8]ページ先頭

©2009-2025 Movatter.jp