npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fumiami

v0.1.10

Published

Full Understanding of Mutual Inconsistencies in Administrative Markup Items - Contradiction detection system for regulation documents using HTML GraphRAG

Readme

FUMIAMI

Full Understanding of Mutual Inconsistencies in Administrative Markup Items

大学規定集等のHTML文書をHTML GraphRAGを用いて解析し、規定間の矛盾・不整合を自動検出するシステム。

TypeScript Node.js License

🎯 主要機能

  1. 矛盾検出 - 規定文書内の矛盾を自動検出
  2. 影響分析 - 規定変更時に影響を受ける条項を特定

📦 パッケージ構成

fumiami/
├── packages/
│   ├── esperanto-ts/    # LLM/Embedding統合インターフェース
│   ├── graphrag/        # HTML GraphRAG (パーサー, チャンカー, グラフ)
│   └── detector/        # 矛盾検出 + 影響分析
└── samples/
    └── u-tokyo/         # 東京大学規則集サンプル

| パッケージ | 説明 | |-----------|------| | @fumiami/esperanto-ts | Azure AI Foundry / Ollama 統一インターフェース | | @fumiami/graphrag | HTML文書のGraphRAG処理 | | @fumiami/detector | 矛盾検出・影響分析エンジン |

🚀 クイックスタート

インストール

# npm からインストール
npm install fumiami

# または pnpm
pnpm add fumiami

開発版インストール(ソースから)

# リポジトリをクローン
git clone https://github.com/nahisaho/FUMIAMI.git
cd FUMIAMI/fumiami

# 依存関係をインストール
pnpm install

# ビルド
pnpm build

基本的な使い方

1. グラフ構築

import { GraphBuilder, AIFactory } from 'fumiami';

// Ollama使用(ローカル)
const factory = AIFactory.ollama('http://localhost:11434');
const embedding = factory.createEmbeddingModel({ model: 'nomic-embed-text' });

// グラフ構築
const builder = new GraphBuilder();
builder.setEmbeddingModel(embedding);
const result = await builder.buildFromHTML(html, 'regulation.html');
const graph = builder.getGraph();

2. 矛盾検出

import { ContradictionDetector } from 'fumiami';

const detector = new ContradictionDetector();
const detection = await detector.detect(graph);
console.log('矛盾:', detection.contradictions);

3. 影響分析

import { ImpactAnalyzer } from 'fumiami';

const analyzer = new ImpactAnalyzer();
const impact = await analyzer.analyze(graph, 'chunk-id-of-article-3');
console.log('影響を受ける条項:', impact.impactedArticles);

CLI使用例

# グラフ構築
npx fumiami build ./path/to/regulation.html -o ./graph.json

# 矛盾検出
npx fumiami detect ./graph.json

# 影響分析
npx fumiami impact ./graph.json 第3条

🔧 開発

前提条件

  • Node.js 20+
  • pnpm 8+
  • Ollama(ローカルLLM使用時)

テスト実行

# 全パッケージのテスト
pnpm -r test:run

# 個別パッケージ
cd packages/esperanto-ts && pnpm test:run
cd packages/graphrag && pnpm test:run
cd packages/detector && pnpm test:run

AIプロバイダー設定

FUMIAMIは Ollama(ローカルLLM)と Azure AI Foundry(クラウド)の2つのAIプロバイダーをサポートしています。


Ollama(ローカル)

ローカル環境でLLMを実行する場合に使用します。

1. Ollamaのインストール
# Linux/WSL
curl -fsSL https://ollama.com/install.sh | sh

# macOS
brew install ollama

# 起動
ollama serve
2. 必要なモデルをダウンロード
# Embeddingモデル(必須)
ollama pull nomic-embed-text

# 言語モデル(オプション - 将来のLLM連携用)
ollama pull qwen2.5:7b
3. TypeScriptでの使用
import { AIFactory } from '@fumiami/esperanto-ts';

// 方法1: 静的ファクトリーメソッド(推奨)
const factory = AIFactory.ollama('http://localhost:11434');

// 方法2: モデルを指定して初期化
const factory = AIFactory.ollama('http://localhost:11434', {
  embeddingModel: 'nomic-embed-text',
  languageModel: 'qwen2.5:7b',
  systemPrompt: 'あなたは規定文書の専門家です。',
});

// Embeddingモデルを作成
const embedding = factory.createEmbeddingModel({ model: 'nomic-embed-text' });

// ベクトル生成
const result = await embedding.embed('第1条 この規則は...');
console.log(result.embedding); // number[]
4. CLI使用時の設定
# graphragでOllamaを使用
npx graphrag build ./regulation.html -o ./graph.json \
  --ollama-url http://localhost:11434 \
  --embedding-model nomic-embed-text

Azure AI Foundry(クラウド)

Azure AI Foundryのモデルを使用する場合に設定します。

1. 環境変数の設定

プロジェクトルートに .env ファイルを作成:

# fumiami/.env
AZURE_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_API_KEY=your-api-key-here
AZURE_API_VERSION=2024-02-15-preview
2. TypeScriptでの使用
import { AIFactory } from '@fumiami/esperanto-ts';
import dotenv from 'dotenv';

// 環境変数を読み込み
dotenv.config();

// 方法1: 静的ファクトリーメソッド(推奨)
const factory = AIFactory.azure(
  process.env.AZURE_ENDPOINT!,
  process.env.AZURE_API_KEY!
);

// 方法2: オプション付きで初期化
const factory = AIFactory.azure(
  process.env.AZURE_ENDPOINT!,
  process.env.AZURE_API_KEY!,
  {
    embeddingModel: 'text-embedding-ada-002',
    languageModel: 'gpt-4',
    apiVersion: '2024-02-15-preview',
  }
);

// Embeddingモデルを作成
const embedding = factory.createEmbeddingModel({ 
  model: 'text-embedding-ada-002' 
});

// ベクトル生成
const result = await embedding.embed('第1条 この規則は...');
3. Azure AI Foundryの設定型
interface AzureConfig {
  provider: 'azure';
  endpoint: string;    // Azure OpenAIのエンドポイントURL
  apiKey: string;      // APIキー
  apiVersion?: string; // APIバージョン(省略時はデフォルト値)
}

設定の優先順位

  1. メソッド引数 - createEmbeddingModel({ model: '...' }) で直接指定
  2. ファクトリー初期化時 - AIFactory.ollama(url, { embeddingModel: '...' })
  3. デフォルト値 - 設定がない場合はエラー
// ファクトリー初期化時にデフォルトモデルを設定
const factory = AIFactory.ollama('http://localhost:11434', {
  embeddingModel: 'nomic-embed-text',
});

// デフォルトモデルを使用
const embedding1 = factory.createEmbeddingModel();

// 別のモデルを指定して上書き
const embedding2 = factory.createEmbeddingModel({ model: 'mxbai-embed-large' });

推奨モデル

| プロバイダー | 用途 | 推奨モデル | |-------------|------|-----------| | Ollama | Embedding | nomic-embed-text, mxbai-embed-large | | Ollama | 言語モデル | qwen2.5:7b, llama3.1:8b | | Azure | Embedding | text-embedding-ada-002, text-embedding-3-small | | Azure | 言語モデル | gpt-4, gpt-4o, gpt-35-turbo |

📊 検出可能な矛盾タイプ

| タイプ | 説明 | 例 | |--------|------|-----| | definition | 同一用語の定義矛盾 | 「学生」の定義が複数存在 | | numeric | 数値の矛盾 | 期限が「14日」と「20日」で異なる | | condition | 条件の論理矛盾 | 条件が相互に矛盾 | | temporal | 時期・期限の矛盾 | 締切日が複数存在 | | reference | 参照矛盾 | 存在しない条項への参照 |

📊 影響タイプ

| タイプ | 説明 | 深刻度 | |--------|------|--------| | direct-reference | 直接参照している条項 | high | | definition-usage | 定義された用語を使用 | medium | | condition-chain | 条件の前提として参照 | critical | | structural-child | 構造的な子要素 | critical | | structural-sibling | 同一章・節内の条項 | low | | semantic-similar | 意味的に類似した条項 | low-high |

📁 サンプルデータ

samples/u-tokyo/ に東京大学規則集のサンプルデータがあります。

# サンプルで矛盾検出を試す
cd packages/graphrag
npx graphrag build ../samples/u-tokyo/html/学部通則.html -o ./cache/gakubu.json

cd ../detector
npx detector detect ../graphrag/cache/gakubu.json

📄 ライセンス

MIT License

🤝 コントリビューション

Issue・PRを歓迎します。


Project: FUMIAMI
Version: 0.1.0
Date: 2026-01-14