@lancedb/lancedb 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/arrow.d.ts +5 -3
  2. package/dist/arrow.js +1 -1
  3. package/dist/embedding/embedding_function.d.ts +4 -3
  4. package/dist/embedding/index.d.ts +1 -0
  5. package/dist/embedding/index.js +1 -0
  6. package/dist/embedding/registry.d.ts +9 -7
  7. package/dist/embedding/registry.js +24 -6
  8. package/dist/embedding/transformers.d.ts +37 -0
  9. package/dist/embedding/transformers.js +147 -0
  10. package/dist/query.js +15 -9
  11. package/dist/remote/client.d.ts +1 -1
  12. package/dist/remote/client.js +6 -8
  13. package/dist/remote/connection.d.ts +2 -3
  14. package/dist/remote/connection.js +2 -2
  15. package/dist/table.d.ts +3 -0
  16. package/dist/table.js +1 -1
  17. package/package.json +17 -14
  18. package/Cargo.toml +0 -28
  19. package/biome.json +0 -158
  20. package/build.rs +0 -5
  21. package/dist/native.d.ts +0 -208
  22. package/examples/ann_indexes.ts +0 -49
  23. package/examples/basic.ts +0 -149
  24. package/examples/embedding.ts +0 -83
  25. package/examples/filtering.ts +0 -34
  26. package/examples/jsconfig.json +0 -27
  27. package/examples/package-lock.json +0 -79
  28. package/examples/package.json +0 -18
  29. package/examples/search.ts +0 -37
  30. package/jest.config.js +0 -7
  31. package/lancedb/arrow.ts +0 -947
  32. package/lancedb/connection.ts +0 -333
  33. package/lancedb/embedding/embedding_function.ts +0 -194
  34. package/lancedb/embedding/index.ts +0 -113
  35. package/lancedb/embedding/openai.ts +0 -113
  36. package/lancedb/embedding/registry.ts +0 -188
  37. package/lancedb/index.ts +0 -142
  38. package/lancedb/indices.ts +0 -203
  39. package/lancedb/merge.ts +0 -70
  40. package/lancedb/query.ts +0 -507
  41. package/lancedb/remote/client.ts +0 -221
  42. package/lancedb/remote/connection.ts +0 -201
  43. package/lancedb/remote/index.ts +0 -3
  44. package/lancedb/remote/table.ts +0 -226
  45. package/lancedb/sanitize.ts +0 -588
  46. package/lancedb/table.ts +0 -669
  47. package/lancedb/util.ts +0 -69
  48. package/native.d.ts +0 -208
  49. package/nodejs-artifacts/arrow.d.ts +0 -250
  50. package/nodejs-artifacts/arrow.js +0 -768
  51. package/nodejs-artifacts/connection.d.ts +0 -171
  52. package/nodejs-artifacts/connection.js +0 -135
  53. package/nodejs-artifacts/embedding/embedding_function.d.ts +0 -79
  54. package/nodejs-artifacts/embedding/embedding_function.js +0 -112
  55. package/nodejs-artifacts/embedding/index.d.ts +0 -28
  56. package/nodejs-artifacts/embedding/index.js +0 -114
  57. package/nodejs-artifacts/embedding/openai.d.ts +0 -18
  58. package/nodejs-artifacts/embedding/openai.js +0 -105
  59. package/nodejs-artifacts/embedding/registry.d.ts +0 -53
  60. package/nodejs-artifacts/embedding/registry.js +0 -127
  61. package/nodejs-artifacts/index.d.ts +0 -55
  62. package/nodejs-artifacts/index.js +0 -57
  63. package/nodejs-artifacts/indices.d.ts +0 -165
  64. package/nodejs-artifacts/indices.js +0 -71
  65. package/nodejs-artifacts/merge.d.ts +0 -54
  66. package/nodejs-artifacts/merge.js +0 -64
  67. package/nodejs-artifacts/native.d.ts +0 -208
  68. package/nodejs-artifacts/native.js +0 -330
  69. package/nodejs-artifacts/query.d.ts +0 -283
  70. package/nodejs-artifacts/query.js +0 -448
  71. package/nodejs-artifacts/remote/client.d.ts +0 -28
  72. package/nodejs-artifacts/remote/client.js +0 -172
  73. package/nodejs-artifacts/remote/connection.d.ts +0 -25
  74. package/nodejs-artifacts/remote/connection.js +0 -110
  75. package/nodejs-artifacts/remote/index.d.ts +0 -3
  76. package/nodejs-artifacts/remote/index.js +0 -9
  77. package/nodejs-artifacts/remote/table.d.ts +0 -42
  78. package/nodejs-artifacts/remote/table.js +0 -179
  79. package/nodejs-artifacts/sanitize.d.ts +0 -31
  80. package/nodejs-artifacts/sanitize.js +0 -436
  81. package/nodejs-artifacts/table.d.ts +0 -395
  82. package/nodejs-artifacts/table.js +0 -230
  83. package/nodejs-artifacts/util.d.ts +0 -14
  84. package/nodejs-artifacts/util.js +0 -65
  85. package/tsconfig.json +0 -25
  86. package/typedoc.json +0 -10
@@ -1,221 +0,0 @@
1
- // Copyright 2023 LanceDB Developers.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import axios, {
16
- AxiosError,
17
- type AxiosResponse,
18
- type ResponseType,
19
- } from "axios";
20
- import { Table as ArrowTable } from "../arrow";
21
- import { tableFromIPC } from "../arrow";
22
- import { VectorQuery } from "../query";
23
-
24
- export class RestfulLanceDBClient {
25
- #dbName: string;
26
- #region: string;
27
- #apiKey: string;
28
- #hostOverride?: string;
29
- #closed: boolean = false;
30
- #connectionTimeout: number = 12 * 1000; // 12 seconds;
31
- #readTimeout: number = 30 * 1000; // 30 seconds;
32
- #session?: import("axios").AxiosInstance;
33
-
34
- constructor(
35
- dbName: string,
36
- apiKey: string,
37
- region: string,
38
- hostOverride?: string,
39
- connectionTimeout?: number,
40
- readTimeout?: number,
41
- ) {
42
- this.#dbName = dbName;
43
- this.#apiKey = apiKey;
44
- this.#region = region;
45
- this.#hostOverride = hostOverride ?? this.#hostOverride;
46
- this.#connectionTimeout = connectionTimeout ?? this.#connectionTimeout;
47
- this.#readTimeout = readTimeout ?? this.#readTimeout;
48
- }
49
-
50
- // todo: cache the session.
51
- get session(): import("axios").AxiosInstance {
52
- if (this.#session !== undefined) {
53
- return this.#session;
54
- } else {
55
- return axios.create({
56
- baseURL: this.url,
57
- headers: {
58
- // biome-ignore lint: external API
59
- Authorization: `Bearer ${this.#apiKey}`,
60
- },
61
- transformResponse: decodeErrorData,
62
- timeout: this.#connectionTimeout,
63
- });
64
- }
65
- }
66
-
67
- get url(): string {
68
- return (
69
- this.#hostOverride ??
70
- `https://${this.#dbName}.${this.#region}.api.lancedb.com`
71
- );
72
- }
73
-
74
- get headers(): { [key: string]: string } {
75
- const headers: { [key: string]: string } = {
76
- "x-api-key": this.#apiKey,
77
- "x-request-id": "na",
78
- };
79
- if (this.#region == "local") {
80
- headers["Host"] = `${this.#dbName}.${this.#region}.api.lancedb.com`;
81
- }
82
- if (this.#hostOverride) {
83
- headers["x-lancedb-database"] = this.#dbName;
84
- }
85
- return headers;
86
- }
87
-
88
- isOpen(): boolean {
89
- return !this.#closed;
90
- }
91
-
92
- private checkNotClosed(): void {
93
- if (this.#closed) {
94
- throw new Error("Connection is closed");
95
- }
96
- }
97
-
98
- close(): void {
99
- this.#session = undefined;
100
- this.#closed = true;
101
- }
102
-
103
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
104
- async get(uri: string, params?: Record<string, any>): Promise<any> {
105
- this.checkNotClosed();
106
- uri = new URL(uri, this.url).toString();
107
- let response;
108
- try {
109
- response = await this.session.get(uri, {
110
- headers: this.headers,
111
- params,
112
- });
113
- } catch (e) {
114
- if (e instanceof AxiosError) {
115
- response = e.response;
116
- } else {
117
- throw e;
118
- }
119
- }
120
-
121
- RestfulLanceDBClient.checkStatus(response!);
122
- return response!.data;
123
- }
124
-
125
- // biome-ignore lint/suspicious/noExplicitAny: api response
126
- async post(uri: string, body?: any): Promise<any>;
127
- async post(
128
- uri: string,
129
- // biome-ignore lint/suspicious/noExplicitAny: api request
130
- body: any,
131
- additional: {
132
- config?: { responseType: "arraybuffer" };
133
- headers?: Record<string, string>;
134
- params?: Record<string, string>;
135
- },
136
- ): Promise<Buffer>;
137
- async post(
138
- uri: string,
139
- // biome-ignore lint/suspicious/noExplicitAny: api request
140
- body?: any,
141
- additional?: {
142
- config?: { responseType: ResponseType };
143
- headers?: Record<string, string>;
144
- params?: Record<string, string>;
145
- },
146
- // biome-ignore lint/suspicious/noExplicitAny: api response
147
- ): Promise<any> {
148
- this.checkNotClosed();
149
- uri = new URL(uri, this.url).toString();
150
- additional = Object.assign(
151
- { config: { responseType: "json" } },
152
- additional,
153
- );
154
-
155
- const headers = { ...this.headers, ...additional.headers };
156
-
157
- if (!headers["Content-Type"]) {
158
- headers["Content-Type"] = "application/json";
159
- }
160
- let response;
161
- try {
162
- response = await this.session.post(uri, body, {
163
- headers,
164
- responseType: additional!.config!.responseType,
165
- params: new Map(Object.entries(additional.params ?? {})),
166
- });
167
- } catch (e) {
168
- if (e instanceof AxiosError) {
169
- response = e.response;
170
- } else {
171
- throw e;
172
- }
173
- }
174
- RestfulLanceDBClient.checkStatus(response!);
175
- if (additional!.config!.responseType === "arraybuffer") {
176
- return response!.data;
177
- } else {
178
- return JSON.parse(response!.data);
179
- }
180
- }
181
-
182
- async listTables(limit = 10, pageToken = ""): Promise<string[]> {
183
- const json = await this.get("/v1/table", { limit, pageToken });
184
- return json.tables;
185
- }
186
-
187
- async query(tableName: string, query: VectorQuery): Promise<ArrowTable> {
188
- const tbl = await this.post(`/v1/table/${tableName}/query`, query, {
189
- config: {
190
- responseType: "arraybuffer",
191
- },
192
- });
193
- return tableFromIPC(tbl);
194
- }
195
-
196
- static checkStatus(response: AxiosResponse): void {
197
- if (response.status === 404) {
198
- throw new Error(`Not found: ${response.data}`);
199
- } else if (response.status >= 400 && response.status < 500) {
200
- throw new Error(
201
- `Bad Request: ${response.status}, error: ${response.data}`,
202
- );
203
- } else if (response.status >= 500 && response.status < 600) {
204
- throw new Error(
205
- `Internal Server Error: ${response.status}, error: ${response.data}`,
206
- );
207
- } else if (response.status !== 200) {
208
- throw new Error(
209
- `Unknown Error: ${response.status}, error: ${response.data}`,
210
- );
211
- }
212
- }
213
- }
214
-
215
- function decodeErrorData(data: unknown) {
216
- if (Buffer.isBuffer(data)) {
217
- const decoded = data.toString("utf-8");
218
- return decoded;
219
- }
220
- return data;
221
- }
@@ -1,201 +0,0 @@
1
- import { Schema } from "apache-arrow";
2
- import {
3
- Data,
4
- SchemaLike,
5
- fromTableToStreamBuffer,
6
- makeEmptyTable,
7
- } from "../arrow";
8
- import {
9
- Connection,
10
- CreateTableOptions,
11
- OpenTableOptions,
12
- TableNamesOptions,
13
- } from "../connection";
14
- import { Table } from "../table";
15
- import { TTLCache } from "../util";
16
- import { RestfulLanceDBClient } from "./client";
17
- import { RemoteTable } from "./table";
18
-
19
- export interface RemoteConnectionOptions {
20
- apiKey?: string;
21
- region?: string;
22
- hostOverride?: string;
23
- connectionTimeout?: number;
24
- readTimeout?: number;
25
- }
26
-
27
- export class RemoteConnection extends Connection {
28
- #dbName: string;
29
- #apiKey: string;
30
- #region: string;
31
- #client: RestfulLanceDBClient;
32
- #tableCache = new TTLCache(300_000);
33
-
34
- constructor(
35
- url: string,
36
- {
37
- apiKey,
38
- region,
39
- hostOverride,
40
- connectionTimeout,
41
- readTimeout,
42
- }: RemoteConnectionOptions,
43
- ) {
44
- super();
45
- apiKey = apiKey ?? process.env.LANCEDB_API_KEY;
46
- region = region ?? process.env.LANCEDB_REGION;
47
-
48
- if (!apiKey) {
49
- throw new Error("apiKey is required when connecting to LanceDB Cloud");
50
- }
51
-
52
- if (!region) {
53
- throw new Error("region is required when connecting to LanceDB Cloud");
54
- }
55
-
56
- const parsed = new URL(url);
57
- if (parsed.protocol !== "db:") {
58
- throw new Error(
59
- `invalid protocol: ${parsed.protocol}, only accepts db://`,
60
- );
61
- }
62
-
63
- this.#dbName = parsed.hostname;
64
- this.#apiKey = apiKey;
65
- this.#region = region;
66
- this.#client = new RestfulLanceDBClient(
67
- this.#dbName,
68
- this.#apiKey,
69
- this.#region,
70
- hostOverride,
71
- connectionTimeout,
72
- readTimeout,
73
- );
74
- }
75
-
76
- isOpen(): boolean {
77
- return this.#client.isOpen();
78
- }
79
- close(): void {
80
- return this.#client.close();
81
- }
82
-
83
- display(): string {
84
- return `RemoteConnection(${this.#dbName})`;
85
- }
86
-
87
- async tableNames(options?: Partial<TableNamesOptions>): Promise<string[]> {
88
- const response = await this.#client.get("/v1/table/", {
89
- limit: options?.limit ?? 10,
90
- // biome-ignore lint/style/useNamingConvention: <explanation>
91
- page_token: options?.startAfter ?? "",
92
- });
93
- const body = await response.body();
94
- for (const table of body.tables) {
95
- this.#tableCache.set(table, true);
96
- }
97
- return body.tables;
98
- }
99
-
100
- async openTable(
101
- name: string,
102
- _options?: Partial<OpenTableOptions> | undefined,
103
- ): Promise<Table> {
104
- if (this.#tableCache.get(name) === undefined) {
105
- await this.#client.post(
106
- `/v1/table/${encodeURIComponent(name)}/describe/`,
107
- );
108
- this.#tableCache.set(name, true);
109
- }
110
- return new RemoteTable(this.#client, name, this.#dbName);
111
- }
112
-
113
- async createTable(
114
- nameOrOptions:
115
- | string
116
- | ({ name: string; data: Data } & Partial<CreateTableOptions>),
117
- data?: Data,
118
- options?: Partial<CreateTableOptions> | undefined,
119
- ): Promise<Table> {
120
- if (typeof nameOrOptions !== "string" && "name" in nameOrOptions) {
121
- const { name, data, ...options } = nameOrOptions;
122
- return this.createTable(name, data, options);
123
- }
124
- if (data === undefined) {
125
- throw new Error("data is required");
126
- }
127
- if (options?.mode) {
128
- console.warn(
129
- "option 'mode' is not supported in LanceDB Cloud",
130
- "LanceDB Cloud only supports the default 'create' mode.",
131
- "If the table already exists, an error will be thrown.",
132
- );
133
- }
134
- if (options?.embeddingFunction) {
135
- console.warn(
136
- "embedding_functions is not yet supported on LanceDB Cloud.",
137
- "Please vote https://github.com/lancedb/lancedb/issues/626 ",
138
- "for this feature.",
139
- );
140
- }
141
-
142
- const { buf } = await Table.parseTableData(
143
- data,
144
- options,
145
- true /** streaming */,
146
- );
147
-
148
- await this.#client.post(
149
- `/v1/table/${encodeURIComponent(nameOrOptions)}/create/`,
150
- buf,
151
- {
152
- config: {
153
- responseType: "arraybuffer",
154
- },
155
- headers: { "Content-Type": "application/vnd.apache.arrow.stream" },
156
- },
157
- );
158
- this.#tableCache.set(nameOrOptions, true);
159
- return new RemoteTable(this.#client, nameOrOptions, this.#dbName);
160
- }
161
-
162
- async createEmptyTable(
163
- name: string,
164
- schema: SchemaLike,
165
- options?: Partial<CreateTableOptions> | undefined,
166
- ): Promise<Table> {
167
- if (options?.mode) {
168
- console.warn(`mode is not supported on LanceDB Cloud`);
169
- }
170
-
171
- if (options?.embeddingFunction) {
172
- console.warn(
173
- "embeddingFunction is not yet supported on LanceDB Cloud.",
174
- "Please vote https://github.com/lancedb/lancedb/issues/626 ",
175
- "for this feature.",
176
- );
177
- }
178
- const emptyTable = makeEmptyTable(schema);
179
- const buf = await fromTableToStreamBuffer(emptyTable);
180
-
181
- await this.#client.post(
182
- `/v1/table/${encodeURIComponent(name)}/create/`,
183
- buf,
184
- {
185
- config: {
186
- responseType: "arraybuffer",
187
- },
188
- headers: { "Content-Type": "application/vnd.apache.arrow.stream" },
189
- },
190
- );
191
-
192
- this.#tableCache.set(name, true);
193
- return new RemoteTable(this.#client, name, this.#dbName);
194
- }
195
-
196
- async dropTable(name: string): Promise<void> {
197
- await this.#client.post(`/v1/table/${encodeURIComponent(name)}/drop/`);
198
-
199
- this.#tableCache.delete(name);
200
- }
201
- }
@@ -1,3 +0,0 @@
1
- export { RestfulLanceDBClient } from "./client";
2
- export { type RemoteConnectionOptions, RemoteConnection } from "./connection";
3
- export { RemoteTable } from "./table";
@@ -1,226 +0,0 @@
1
- // Copyright 2023 LanceDB Developers.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import { Table as ArrowTable } from "apache-arrow";
16
-
17
- import { Data, IntoVector } from "../arrow";
18
-
19
- import { IndexStatistics } from "..";
20
- import { CreateTableOptions } from "../connection";
21
- import { IndexOptions } from "../indices";
22
- import { MergeInsertBuilder } from "../merge";
23
- import { VectorQuery } from "../query";
24
- import { AddDataOptions, Table, UpdateOptions } from "../table";
25
- import { IntoSql, toSQL } from "../util";
26
- import { RestfulLanceDBClient } from "./client";
27
-
28
- export class RemoteTable extends Table {
29
- #client: RestfulLanceDBClient;
30
- #name: string;
31
-
32
- // Used in the display() method
33
- #dbName: string;
34
-
35
- get #tablePrefix() {
36
- return `/v1/table/${encodeURIComponent(this.#name)}/`;
37
- }
38
-
39
- get name(): string {
40
- return this.#name;
41
- }
42
-
43
- public constructor(
44
- client: RestfulLanceDBClient,
45
- tableName: string,
46
- dbName: string,
47
- ) {
48
- super();
49
- this.#client = client;
50
- this.#name = tableName;
51
- this.#dbName = dbName;
52
- }
53
-
54
- isOpen(): boolean {
55
- return !this.#client.isOpen();
56
- }
57
-
58
- close(): void {
59
- this.#client.close();
60
- }
61
-
62
- display(): string {
63
- return `RemoteTable(${this.#dbName}; ${this.#name})`;
64
- }
65
-
66
- async schema(): Promise<import("apache-arrow").Schema> {
67
- const resp = await this.#client.post(`${this.#tablePrefix}/describe/`);
68
- // TODO: parse this into a valid arrow schema
69
- return resp.schema;
70
- }
71
- async add(data: Data, options?: Partial<AddDataOptions>): Promise<void> {
72
- const { buf, mode } = await Table.parseTableData(
73
- data,
74
- options as CreateTableOptions,
75
- true,
76
- );
77
- await this.#client.post(`${this.#tablePrefix}/insert/`, buf, {
78
- params: {
79
- mode,
80
- },
81
- headers: {
82
- "Content-Type": "application/vnd.apache.arrow.stream",
83
- },
84
- });
85
- }
86
-
87
- async update(
88
- optsOrUpdates:
89
- | (Map<string, string> | Record<string, string>)
90
- | ({
91
- values: Map<string, IntoSql> | Record<string, IntoSql>;
92
- } & Partial<UpdateOptions>)
93
- | ({
94
- valuesSql: Map<string, string> | Record<string, string>;
95
- } & Partial<UpdateOptions>),
96
- options?: Partial<UpdateOptions>,
97
- ): Promise<void> {
98
- const isValues =
99
- "values" in optsOrUpdates && typeof optsOrUpdates.values !== "string";
100
- const isValuesSql =
101
- "valuesSql" in optsOrUpdates &&
102
- typeof optsOrUpdates.valuesSql !== "string";
103
- const isMap = (obj: unknown): obj is Map<string, string> => {
104
- return obj instanceof Map;
105
- };
106
-
107
- let predicate;
108
- let columns: [string, string][];
109
- switch (true) {
110
- case isMap(optsOrUpdates):
111
- columns = Array.from(optsOrUpdates.entries());
112
- predicate = options?.where;
113
- break;
114
- case isValues && isMap(optsOrUpdates.values):
115
- columns = Array.from(optsOrUpdates.values.entries()).map(([k, v]) => [
116
- k,
117
- toSQL(v),
118
- ]);
119
- predicate = optsOrUpdates.where;
120
- break;
121
- case isValues && !isMap(optsOrUpdates.values):
122
- columns = Object.entries(optsOrUpdates.values).map(([k, v]) => [
123
- k,
124
- toSQL(v),
125
- ]);
126
- predicate = optsOrUpdates.where;
127
- break;
128
-
129
- case isValuesSql && isMap(optsOrUpdates.valuesSql):
130
- columns = Array.from(optsOrUpdates.valuesSql.entries());
131
- predicate = optsOrUpdates.where;
132
- break;
133
- case isValuesSql && !isMap(optsOrUpdates.valuesSql):
134
- columns = Object.entries(optsOrUpdates.valuesSql).map(([k, v]) => [
135
- k,
136
- v,
137
- ]);
138
- predicate = optsOrUpdates.where;
139
- break;
140
- default:
141
- columns = Object.entries(optsOrUpdates as Record<string, string>);
142
- predicate = options?.where;
143
- }
144
-
145
- await this.#client.post(`${this.#tablePrefix}/update/`, {
146
- predicate: predicate ?? null,
147
- updates: columns,
148
- });
149
- }
150
- async countRows(filter?: unknown): Promise<number> {
151
- const payload = { predicate: filter };
152
- return await this.#client.post(`${this.#tablePrefix}/count_rows/`, payload);
153
- }
154
-
155
- async delete(predicate: unknown): Promise<void> {
156
- const payload = { predicate };
157
- await this.#client.post(`${this.#tablePrefix}/delete/`, payload);
158
- }
159
- async createIndex(
160
- column: string,
161
- options?: Partial<IndexOptions>,
162
- ): Promise<void> {
163
- if (options !== undefined) {
164
- console.warn("options are not yet supported on the LanceDB cloud");
165
- }
166
- const indexType = "vector";
167
- const metric = "L2";
168
- const data = {
169
- column,
170
- // biome-ignore lint/style/useNamingConvention: external API
171
- index_type: indexType,
172
- // biome-ignore lint/style/useNamingConvention: external API
173
- metric_type: metric,
174
- };
175
- await this.#client.post(`${this.#tablePrefix}/create_index`, data);
176
- }
177
- query(): import("..").Query {
178
- throw new Error("query() is not yet supported on the LanceDB cloud");
179
- }
180
-
181
- search(_query: string | IntoVector): VectorQuery {
182
- throw new Error("search() is not yet supported on the LanceDB cloud");
183
- }
184
- vectorSearch(_vector: unknown): import("..").VectorQuery {
185
- throw new Error("vectorSearch() is not yet supported on the LanceDB cloud");
186
- }
187
- addColumns(_newColumnTransforms: unknown): Promise<void> {
188
- throw new Error("addColumns() is not yet supported on the LanceDB cloud");
189
- }
190
- alterColumns(_columnAlterations: unknown): Promise<void> {
191
- throw new Error("alterColumns() is not yet supported on the LanceDB cloud");
192
- }
193
- dropColumns(_columnNames: unknown): Promise<void> {
194
- throw new Error("dropColumns() is not yet supported on the LanceDB cloud");
195
- }
196
- async version(): Promise<number> {
197
- const resp = await this.#client.post(`${this.#tablePrefix}/describe/`);
198
- return resp.version;
199
- }
200
- checkout(_version: unknown): Promise<void> {
201
- throw new Error("checkout() is not yet supported on the LanceDB cloud");
202
- }
203
- checkoutLatest(): Promise<void> {
204
- throw new Error(
205
- "checkoutLatest() is not yet supported on the LanceDB cloud",
206
- );
207
- }
208
- restore(): Promise<void> {
209
- throw new Error("restore() is not yet supported on the LanceDB cloud");
210
- }
211
- optimize(_options?: unknown): Promise<import("../native").OptimizeStats> {
212
- throw new Error("optimize() is not yet supported on the LanceDB cloud");
213
- }
214
- async listIndices(): Promise<import("../native").IndexConfig[]> {
215
- return await this.#client.post(`${this.#tablePrefix}/index/list/`);
216
- }
217
- toArrow(): Promise<ArrowTable> {
218
- throw new Error("toArrow() is not yet supported on the LanceDB cloud");
219
- }
220
- mergeInsert(_on: string | string[]): MergeInsertBuilder {
221
- throw new Error("mergeInsert() is not yet supported on the LanceDB cloud");
222
- }
223
- async indexStats(_name: string): Promise<IndexStatistics | undefined> {
224
- throw new Error("indexStats() is not yet supported on the LanceDB cloud");
225
- }
226
- }