New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vectordb

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vectordb - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

7

dist/index.d.ts

@@ -82,2 +82,7 @@ import { type Table as ArrowTable } from 'apache-arrow';

}
export interface AwsCredentials {
accessKeyId: string;
secretKey: string;
sessionToken?: string;
}
/**

@@ -137,2 +142,3 @@ * A connection to a LanceDB database.

private readonly _embeddings?;
private readonly _awsCredentials?;
constructor(tbl: any, name: string);

@@ -145,2 +151,3 @@ /**

constructor(tbl: any, name: string, embeddings: EmbeddingFunction<T>);
constructor(tbl: any, name: string, embeddings?: EmbeddingFunction<T>, awsCredentials?: AwsCredentials);
get name(): string;

@@ -147,0 +154,0 @@ /**

38

dist/index.js

@@ -73,3 +73,3 @@ "use strict";

}
createTable(name, data, mode, embeddings) {
createTable(name, data, mode, embeddings, awsCredentials) {
return __awaiter(this, void 0, void 0, function* () {

@@ -79,9 +79,12 @@ if (mode === undefined) {

}
const tbl = yield tableCreate.call(this._db, name, yield (0, arrow_1.fromRecordsToBuffer)(data, embeddings), mode.toLowerCase());
if (embeddings !== undefined) {
return new LocalTable(tbl, name, embeddings);
const createArgs = [this._db, name, yield (0, arrow_1.fromRecordsToBuffer)(data, embeddings), mode.toLowerCase()];
if (awsCredentials !== undefined) {
createArgs.push(awsCredentials.accessKeyId);
createArgs.push(awsCredentials.secretKey);
if (awsCredentials.sessionToken !== undefined) {
createArgs.push(awsCredentials.sessionToken);
}
}
else {
return new LocalTable(tbl, name);
}
const tbl = yield tableCreate.call(...createArgs);
return new LocalTable(tbl, name, embeddings, awsCredentials);
});

@@ -108,6 +111,7 @@ }

class LocalTable {
constructor(tbl, name, embeddings) {
constructor(tbl, name, embeddings, awsCredentials) {
this._tbl = tbl;
this._name = name;
this._embeddings = embeddings;
this._awsCredentials = awsCredentials;
}

@@ -132,3 +136,11 @@ get name() {

return __awaiter(this, void 0, void 0, function* () {
return tableAdd.call(this._tbl, yield (0, arrow_1.fromRecordsToBuffer)(data, this._embeddings), WriteMode.Append.toString());
const callArgs = [this._tbl, yield (0, arrow_1.fromRecordsToBuffer)(data, this._embeddings), WriteMode.Append.toString()];
if (this._awsCredentials !== undefined) {
callArgs.push(this._awsCredentials.accessKeyId);
callArgs.push(this._awsCredentials.secretKey);
if (this._awsCredentials.sessionToken !== undefined) {
callArgs.push(this._awsCredentials.sessionToken);
}
}
return tableAdd.call(...callArgs);
});

@@ -144,2 +156,10 @@ }

return __awaiter(this, void 0, void 0, function* () {
const callArgs = [this._tbl, yield (0, arrow_1.fromRecordsToBuffer)(data, this._embeddings), WriteMode.Overwrite.toString()];
if (this._awsCredentials !== undefined) {
callArgs.push(this._awsCredentials.accessKeyId);
callArgs.push(this._awsCredentials.secretKey);
if (this._awsCredentials.sessionToken !== undefined) {
callArgs.push(this._awsCredentials.sessionToken);
}
}
return tableAdd.call(this._tbl, yield (0, arrow_1.fromRecordsToBuffer)(data, this._embeddings), WriteMode.Overwrite.toString());

@@ -146,0 +166,0 @@ });

{
"name": "vectordb",
"version": "0.1.10",
"version": "0.1.11",
"description": " Serverless, low-latency vector database for AI applications",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -125,2 +125,10 @@ // Copyright 2023 Lance Developers.

export interface AwsCredentials {
accessKeyId: string
secretKey: string
sessionToken?: string
}
/**

@@ -190,12 +198,19 @@ * A connection to a LanceDB database.

async createTable<T> (name: string, data: Array<Record<string, unknown>>, mode: WriteMode, embeddings: EmbeddingFunction<T>): Promise<Table<T>>
async createTable<T> (name: string, data: Array<Record<string, unknown>>, mode: WriteMode, embeddings?: EmbeddingFunction<T>): Promise<Table<T>> {
async createTable<T> (name: string, data: Array<Record<string, unknown>>, mode: WriteMode, embeddings?: EmbeddingFunction<T>, awsCredentials?: AwsCredentials): Promise<Table<T>> {
if (mode === undefined) {
mode = WriteMode.Create
}
const tbl = await tableCreate.call(this._db, name, await fromRecordsToBuffer(data, embeddings), mode.toLowerCase())
if (embeddings !== undefined) {
return new LocalTable(tbl, name, embeddings)
} else {
return new LocalTable(tbl, name)
const createArgs = [this._db, name, await fromRecordsToBuffer(data, embeddings), mode.toLowerCase()]
if (awsCredentials !== undefined) {
createArgs.push(awsCredentials.accessKeyId)
createArgs.push(awsCredentials.secretKey)
if (awsCredentials.sessionToken !== undefined) {
createArgs.push(awsCredentials.sessionToken)
}
}
const tbl = await tableCreate.call(...createArgs)
return new LocalTable(tbl, name, embeddings, awsCredentials)
}

@@ -222,2 +237,3 @@

private readonly _embeddings?: EmbeddingFunction<T>
private readonly _awsCredentials?: AwsCredentials

@@ -231,6 +247,8 @@ constructor (tbl: any, name: string)

constructor (tbl: any, name: string, embeddings: EmbeddingFunction<T>)
constructor (tbl: any, name: string, embeddings?: EmbeddingFunction<T>) {
constructor (tbl: any, name: string, embeddings?: EmbeddingFunction<T>, awsCredentials?: AwsCredentials)
constructor (tbl: any, name: string, embeddings?: EmbeddingFunction<T>, awsCredentials?: AwsCredentials) {
this._tbl = tbl
this._name = name
this._embeddings = embeddings
this._awsCredentials = awsCredentials
}

@@ -257,3 +275,11 @@

async add (data: Array<Record<string, unknown>>): Promise<number> {
return tableAdd.call(this._tbl, await fromRecordsToBuffer(data, this._embeddings), WriteMode.Append.toString())
const callArgs = [this._tbl, await fromRecordsToBuffer(data, this._embeddings), WriteMode.Append.toString()]
if (this._awsCredentials !== undefined) {
callArgs.push(this._awsCredentials.accessKeyId)
callArgs.push(this._awsCredentials.secretKey)
if (this._awsCredentials.sessionToken !== undefined) {
callArgs.push(this._awsCredentials.sessionToken)
}
}
return tableAdd.call(...callArgs)
}

@@ -268,2 +294,10 @@

async overwrite (data: Array<Record<string, unknown>>): Promise<number> {
const callArgs = [this._tbl, await fromRecordsToBuffer(data, this._embeddings), WriteMode.Overwrite.toString()]
if (this._awsCredentials !== undefined) {
callArgs.push(this._awsCredentials.accessKeyId)
callArgs.push(this._awsCredentials.secretKey)
if (this._awsCredentials.sessionToken !== undefined) {
callArgs.push(this._awsCredentials.sessionToken)
}
}
return tableAdd.call(this._tbl, await fromRecordsToBuffer(data, this._embeddings), WriteMode.Overwrite.toString())

@@ -270,0 +304,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc