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

@modular-prompt/driver

v0.10.4

Published

AIモデルドライバーパッケージ - 様々なAIプロバイダーとの統一されたインターフェースを提供。

Readme

@modular-prompt/driver

AIモデルドライバーパッケージ - 様々なAIプロバイダーとの統一されたインターフェースを提供。

インストール

npm install @modular-prompt/driver

基本的な使い方

import { compile } from '@modular-prompt/core';
import { OpenAIDriver } from '@modular-prompt/driver';

const driver = new OpenAIDriver({ model: 'gpt-4o-mini' });
const prompt = compile(myModule, context);

// クエリ
const result = await driver.query(prompt, { temperature: 0.7 });
console.log(result.content);

// ストリーミング
const { stream, result: resultPromise } = await driver.streamQuery(prompt);
for await (const chunk of stream) {
  process.stdout.write(chunk);
}

await driver.close();

利用可能なドライバー

| ドライバー | プロバイダー | 備考 | |-----------|------------|------| | OpenAIDriver | OpenAI | OpenAI互換API対応 | | AnthropicDriver | Anthropic | Claude | | VertexAIDriver | Google Cloud | Vertex AI経由Gemini | | GoogleGenAIDriver | Google | APIキーのみで利用可能 | | OllamaDriver | Ollama | ローカルLLM | | MlxDriver | MLX | Apple Silicon専用 | | VllmDriver | vLLM | CUDA GPU推論(Linux) | | TestDriver | - | モックレスポンス | | EchoDriver | - | プロンプトをそのまま返す |

各ドライバーの詳細な設定・オプションは skills/driver-usage/SKILL.md を参照。

主な機能

  • 統一インターフェース: query() / streamQuery() / close() の3メソッド
  • ツール呼び出し: Function Calling対応(OpenAI、Anthropic、VertexAI、GoogleGenAI)
  • 構造化出力: JSONスキーマによる出力制御
  • AIService: 能力ベースのモデル自動選択

カスタムドライバーの作成

AIDriver インターフェースを実装:

import type { AIDriver, CompiledPrompt, QueryOptions, QueryResult, StreamResult } from '@modular-prompt/driver';

export class CustomDriver implements AIDriver {
  async query(prompt: CompiledPrompt, options?: QueryOptions): Promise<QueryResult> {
    // 実装
  }

  async streamQuery(prompt: CompiledPrompt, options?: QueryOptions): Promise<StreamResult> {
    // 実装
  }

  async close(): Promise<void> {
    // リソースのクリーンアップ
  }
}

ローカルモデルのセットアップ

MLX(Apple Silicon)

MLXドライバーはインストール時に自動でPython環境をセットアップします。手動で実行する場合:

cd node_modules/@modular-prompt/driver
npm run setup-mlx

前提条件: Python 3.11以上、Apple Silicon Mac、uv。

特殊トークンの確認

モデルがサポートする特殊トークンを確認できます:

npx tsx scripts/check-special-tokens.ts <model-name>
# 例:
npx tsx scripts/check-special-tokens.ts mlx-community/gemma-3-270m-it-qat-8bit

vLLM(CUDA GPU)

vLLMドライバーは独立したPythonエンジンプロセスとして起動します。

# 環境のセットアップ
cd node_modules/@modular-prompt/driver/src/vllm/python
uv sync

# エンジンの起動
uv --project . run python __main__.py \
  --model Qwen/Qwen2.5-7B-Instruct \
  --socket /tmp/vllm.sock \
  --tool-call-parser hermes

前提条件: Python 3.10以上、CUDA対応GPU、Linux。

詳細は ローカルモデルセットアップガイド を参照してください。

Skills(Claude Code向け)

このパッケージには skills/driver-usage/SKILL.md が同梱されています。Claude Codeのスキルとして利用でき、ドライバーの使い方をガイドします。

ライセンス

MIT