メインコンテンツまでスキップ
バージョン: V1.4.0

listCollections - Collectionsリストの取得

listCollections()は、すべてのCollectionを取得するために使用されます。

備考

このインターフェースは、SeekdbClient接続を使用している場合にのみ利用できます。SeekdbClientの詳細については、SeekdbClientを参照してください。

前提条件​

  • seekdb-jsがインストール済みであること。seekdb-jsのインストール方法の詳細については、クイックスタートを参照してください。

  • サーバーモードのseekdbを使用している場合は、seekdbサーバーモードがインストールされていることを確認してください。seekdbサーバーモードのインストール方法の詳細については、パッケージ管理ツールを使用したseekdbのデプロイを参照してください。

  • データベースに接続されていること。接続の詳細な操作については、SeekdbClientを参照してください。

  • 取得しようとしているCollectionが存在すること。Collectionが存在しない場合、エラーが表示されます。

リクエストパラメータ​

listCollections()

リクエスト例​

import { SeekdbClient } from "seekdb";

// 1. Connect
// 埋め込みモード - データベース管理 (seekdb Embedded)
// const client = new SeekdbClient({
// path: "./seekdb.db",
// database: "test",
// });

// リモートサーバーモード - データベース管理 (seekdb Server)
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});

const collections = await client.listCollections();

レスポンスパラメータ​

パラメータ値の種類必須説明値の例
namestring必須クエリ結果のコレクション名。my_collection
dimensionintオプション384
embeddingFunctionEmbeddingFunctionオプションembeddingFunction: DefaultEmbeddingFunction {name: 'default-embed', pipe: null, modelName: 'Xenova/all-MiniLM-L6-v2', revision: undefined, dtype: undefined, cacheDir: undefined, localFilesOnly: undefined, progressCallback: undefined }
distancestringオプションcosine
metadatadictオプション予約フィールド、現在データなし

レスポンス例​

[
Collection {
name: 'my_collection',
dimension: 384,
distance: 'cosine',
embeddingFunction: DefaultEmbeddingFunction {
name: 'default-embed',
pipe: null,
modelName: 'Xenova/all-MiniLM-L6-v2',
revision: undefined,
dtype: undefined,
cacheDir: undefined,
localFilesOnly: undefined,
progressCallback: undefined
},
metadata: undefined
}
]

関連操作​