From 73e40157973ddfd8ddda35cf53e2f47b2bdaaf90 Mon Sep 17 00:00:00 2001 From: Aidan <64613310+aidangomar@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:16:40 -0500 Subject: [PATCH] feat: Node Schema API (#717) --- node/src/remote/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/node/src/remote/index.ts b/node/src/remote/index.ts index fa31c65d..9ef6723f 100644 --- a/node/src/remote/index.ts +++ b/node/src/remote/index.ts @@ -195,6 +195,17 @@ export class RemoteTable implements Table { return this._name } + get schema (): Promise { + return this._client.post(`/v1/table/${this._name}/describe/`).then(res => { + if (res.status !== 200) { + throw new Error(`Server Error, status: ${res.status}, ` + + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `message: ${res.statusText}: ${res.data}`) + } + return res.data?.schema + }) + } + search (query: T): Query { return new RemoteQuery(query, this._client, this._name)//, this._embeddings_new) }