mcpField
M
mpep-search

mpep-search

github.com/robthepcguy生産性20670 回インストール2 日前に更新
リポジトリ

mpep-search について

mpep-searchは、特許審査手続や関連する米国の法令を検索するスキルです。ベクトル検索とキーワード検索を組み合わせ、結果を再ランキングします。

主な機能

  1. 01ベクトル・キーワード検索
  2. 02HyDEによるクエリ拡張
  3. 03クロスエンコーダー再ランキング
  4. 04ソースと内容種別による絞り込み
  5. 05MPEPの指定セクション取得

活用シーン

  1. 01特許審査手続の指針検索
  2. 02Title 35の法令内容の検索
  3. 032024年1月以降の更新の確認

インストール

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

$npx skills add https://github.com/robthepcguy/claude-patent-creator --skill mpep-search

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

同梱ファイルmpep_search.py

詳細

MPEP 検索スキル

ハイブリッド RAG(FAISS ベクトル検索+BM25 キーワード検索+HyDE+クロスエンコーダーによる再ランキング)で MPEP コーパスを検索します。

ソース:

  • MPEP:特許審査手続マニュアル
  • 35 USC:合衆国法典第 35 編
  • 37 CFR:連邦規則集第 37 編
  • 以降の刊行物:連邦官報の更新情報(2024 年 1 月以降)

主な操作

1. search_mpep

入力:

  • query(string、必須):検索クエリ(最小 3 文字)
  • top_k(int、省略可):結果数(デフォルト:5、最大:20)
  • retrieve_k(int | None、省略可):再ランキング前の候補数(デフォルト:top_k * 4、最大:100)
  • source_filter(string | None、省略可):ソースで絞り込み("MPEP"、"35_USC"、"37_CFR"、"SUBSEQUENT"、または None)
  • is_statute(bool | None、省略可):制定法の内容で絞り込み
  • is_regulation(bool | None、省略可):規則の内容で絞り込み
  • is_update(bool | None、省略可):最近の更新情報で絞り込み

出力:

{
    "rank": int,
    "source": str,
    "section": str,
    "file": str,
    "page": int,
    "has_statute": bool,
    "has_mpep_ref": bool,
    "has_rule_ref": bool,
    "is_statute": bool,
    "is_regulation": bool,
    "is_update": bool,
    "relevance_score": float,
    "text": str,
    # Optional for SUBSEQUENT:
    "doc_type": str,
    "fr_citation": str,
    "effective_date": str
}

例:

# Basic search
search_mpep("enablement requirement 35 USC 112", top_k=5)

# Search only statutes
search_mpep("written description", top_k=10, is_statute=True)

# Search recent updates
search_mpep("AI inventorship", is_update=True)

# Filter by source
search_mpep("fee schedule", source_filter="37_CFR")
2. get_mpep_section

指定した MPEP セクションのすべての内容を取得します。

入力:

  • section_number(string、必須):MPEP セクション番号(例:"2100"、"608.01")
  • max_chunks(int、省略可):返すチャンクの最大数(デフォルト:50)

出力:

{
    "section": str,
    "total_chunks": int,
    "chunks": [
        {
            "text": str,
            "metadata": {
                "source": str,
                "file": str,
                "page": int,
                "section": str,
                "has_statute": bool,
                "has_mpep_ref": bool,
                "has_rule_ref": bool,
                "is_statute": bool,
                "is_regulation": bool,
                "is_update": bool
            }
        }
    ]
}

エラーレスポンス:

{"error": "No content found for MPEP section {section_number}"}

例:

# Get MPEP 2100 (Patentability)
get_mpep_section("2100", max_chunks=50)

# Get subsection
get_mpep_section("608.01")

入力検証

クエリの検証:

  • 最小 3 文字
  • 大文字と小文字を区別しません
  • 空または空白文字のみのクエリは不可

セクション番号の検証:

  • 数値。小数点以下を指定できます(例:"100"、"2100"、"608.01")

上限:

  • top_k の上限は 20 です
  • retrieve_k の上限は 100 です

実装に関する注意事項

インデックスの場所:

  • FAISS インデックス:mcp_server/index/mpep_index.faiss
  • メタデータ:mcp_server/index/mpep_metadata.json
  • BM25 インデックス:mcp_server/index/mpep_bm25.json

検索アーキテクチャ:

  1. HyDE クエリ拡張(仮想文書)
  2. ハイブリッド検索(RRF による FAISS ベクトル検索+BM25 キーワード検索)
  3. クロスエンコーダーによる再ランキング(最終的な関連性スコア)
  4. メタデータによる絞り込み(ソース/種類)

依存関係:

  • sentence-transformers(BGE-base-en-v1.5)
  • FAISS(ベクトル検索)
  • rank-bm25(キーワード検索)
  • クロスエンコーダー(再ランキング)
  • HyDE(省略可。利用できない場合は機能を縮退して動作)

エラー処理:

  • インデックスが見つからない場合やクエリが無効な場合に、明確なエラーメッセージを表示します
  • HyDE が失敗した場合は、機能を縮退して動作します
  • 処理前に入力を検証します

コメント