mcpField
B
blink-rag

blink-rag

github.com/blink-newデータ・データベース437 回インストール2 週間前に更新
リポジトリ

blink-rag について

blink-ragは、Blinkのドキュメントコレクションを管理し、その内容を検索するスキルです。検索機能を構築する開発者向けに、テキスト、URL、ファイルの取り込みと、セマンティック検索やAI Q&Aを扱います。

主な機能

  1. 01コレクションのセマンティック検索
  2. 02ドキュメントへのAI Q&A
  3. 03コレクションの作成と一覧表示
  4. 04テキスト、URL、ファイルの取り込み
  5. 05AI検索結果のストリーミング

活用シーン

  1. 01ドキュメントコレクションから回答を検索
  2. 02Web記事やテキストを検索用に取り込み
  3. 03コレクションに関する回答をストリーミング

MCP 対応

MCPクライアント向けに、セマンティック検索やAI Q&A用の `blink_rag_search` と、コレクション一覧用の `blink_rag_collections` を提供します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/blink-new/blink-plugin --skill blink-rag

インストール後、Claude Code で/blink-ragを入力して読み込まれたか確認します。

詳細

はじめに

# Search a collection
blink rag search docs "How do I configure auth?"

# Upload a document
blink rag upload docs ./guide.txt

# List collections
blink rag collections

MCP ツール

ツール説明
blink_rag_searchコレクション内のセマンティック検索または AI 質問応答
blink_rag_collections利用可能なコレクションの一覧表示

SDK メソッド

// Create collection
const col = await blink.rag.createCollection({ name: 'docs', description: 'Product docs' })

// Upload document
const doc = await blink.rag.upload({
  collectionName: 'docs',
  filename: 'guide.txt',
  content: 'Your content...',
})
await blink.rag.waitForReady(doc.id)

// Vector search
const results = await blink.rag.search({
  collectionName: 'docs',
  query: 'How do I configure auth?',
  maxResults: 5,
})

// AI search (RAG) — returns answer + sources
const result = await blink.rag.aiSearch({
  collectionName: 'docs',
  query: 'What are the main features?',
  model: 'google/gemini-3-flash',
})
console.log(result.answer, result.sources)

アップロード方法

// Text content
await blink.rag.upload({ collectionName: 'docs', filename: 'notes.txt', content: 'Text...' })

// From URL
await blink.rag.upload({ collectionName: 'docs', filename: 'article.html', url: 'https://example.com/article' })

// File (base64)
await blink.rag.upload({ collectionName: 'docs', filename: 'report.pdf', file: { data: base64, contentType: 'application/pdf' } })

重要:PDF のアップロード方法

PDF を Base64 で直接アップロードしないでください — 埋め込みが正しく保存されない可能性があります。最初にテキストを抽出してください:

// 1. Upload PDF to storage
const { publicUrl } = await blink.storage.upload(pdfFile, `docs/${Date.now()}_${pdfFile.name}`)

// 2. Extract text
const text = await blink.data.extractFromUrl(publicUrl)

// 3. Upload extracted text as content
await blink.rag.upload({ collectionName: 'docs', filename: pdfFile.name, content: text })

ドキュメントのライフサイクル

ドキュメントは pending → processing → ready(または error)の状態を経ます。処理には 30〜40 秒かかります。検索する前に、必ず完了を待ってください:

const doc = await blink.rag.upload({ ... })
await blink.rag.waitForReady(doc.id, { timeoutMs: 120000 })

AI 検索のストリーミング

const stream = await blink.rag.aiSearch({
  collectionName: 'docs',
  query: 'Explain the architecture',
  stream: true,
})

モデルの選択

RAG AI 検索には、必ず google/gemini-3-flash を使用してください。非推奨のモデルでは失敗します。

よくあるエラー

エラー対処方法
409「コレクションが存在します」エラーを捕捉して、既存のコレクションを再利用します
検索結果のトークン数がゼロドキュメントの処理中です — ready 状態になるまで待ちます
アップロード時の「同一のコンテンツ」重複ドキュメントです — エラーを捕捉して、既存のドキュメント ID を使用します

コメント