LanceDB Node.js ベクター検索
LanceDB と Ollama の埋め込みモデルを使用したベクトル検索の Node.js 実装。
概要
このプロジェクトでは、次の方法を説明します。
LanceDBデータベースに接続する
Ollamaを使用してカスタム埋め込み関数を作成する
保存されたドキュメントに対してベクトル類似性検索を実行する
検索結果を処理して表示する
前提条件
Node.js (v14以降)
Ollama は
nomic-embed-text
モデルを使用してローカルで実行されています読み取り/書き込み権限を持つLanceDBの保存場所
インストール
リポジトリをクローンする
依存関係をインストールします:
依存関係
@lancedb/lancedb
: Node.js 用の LanceDB クライアントapache-arrow
: 列指向データの処理用node-fetch
: OllamaへのAPI呼び出しを行うため
使用法
ベクトル検索テスト スクリプトを実行します。
または直接実行します:
構成
スクリプトは以下に接続します:
設定されたパスのLanceDB
Ollama API (
http://localhost:11434/api/embeddings
MCP構成
Claude Desktop を MCP サービスとして統合するには、MCP 構成 JSON に以下を追加します。
パスを実際のインストール パスに置き換えます。
/path/to/lancedb-node/dist/index.js
- コンパイルされた index.js ファイルへのパス/path/to/your/lancedb/storage
- LanceDB ストレージディレクトリへのパス
カスタム埋め込み機能
このプロジェクトには、次の機能を備えたカスタムOllamaEmbeddingFunction
が含まれています。
Ollama APIにテキストを送信します
768次元の埋め込みを受け取る
LanceDB で使用できるようにフォーマットします
ベクトル検索の例
この例では、「ai-rag」テーブルで「成功基準の定義方法」を検索し、類似度スコアとともに結果を表示します。
ライセンス
貢献
貢献を歓迎します!お気軽にプルリクエストを送信してください。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
LanceDB と Ollama の埋め込みモデルを使用したベクトル検索の Node.js 実装。
Related MCP Servers
- -securityFlicense-qualityEnables efficient vector database operations for embedding storage and similarity search through a Model Context Protocol interface.Last updated -6
- -securityFlicense-qualityA Python-based local indexing server that creates semantic search capabilities for codebases using ChromaDB, allowing Cursor IDE to perform vector searches on your code without sending data to external services.Last updated -24
Lindorm MCP Serverofficial
-securityAlicense-qualityAn example server that enables interaction with Alibaba Cloud's Lindorm multi-model NoSQL database, allowing applications to perform vector searches, full-text searches, and SQL operations through a unified interface.Last updated -2Apache 2.0- -securityAlicense-qualityA vector search system that enables semantic retrieval of document chunks using MongoDB Atlas Vector Search and Voyage AI embeddings, allowing users to search documents by meaning rather than just keywords.Last updated -2MIT License