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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@moduler-prompt/simple-chat

v0.1.9

Published

Sample implementation: Simple chat application using Moduler Prompt with MLX models

Readme

Simple Chat - サンプル実装

Moduler Promptフレームワークを使用したチャットアプリケーションのサンプル実装です。実際のアプリケーションでフレームワークをどのように使用するかを示すリファレンス実装として提供されています。

概要

このパッケージは以下を実演します:

  • PromptModuleの静的定義とコンテキストバインディング
  • mergeを使用したモジュール合成(withMaterialsの活用)
  • MLXドライバーを使用したAIモデルとの対話
  • チャットログの管理とリソースファイルの処理

インストール

npm install @moduler-prompt/simple-chat

使用方法

CLIとして使用

# 直接メッセージを送信
simple-chat "こんにちは"

# プロファイルを指定
simple-chat -p profile.yaml "質問があります"

# チャットログを保存・継続
simple-chat -l chat.json "会話を続けます"

# 標準入力から読み込み
echo "長い質問文..." | simple-chat --stdin

# オプションの組み合わせ
simple-chat -p custom.yaml -l session.json --temperature 0.8 "創造的な回答をお願いします"

ライブラリとして使用

import { chatPromptModule, performAIChat } from '@moduler-prompt/simple-chat';

対話プロファイル

対話プロファイルは、チャットの動作を制御するYAML形式の設定ファイルです。

プロファイルの構造

# 使用するAIモデル
model: "mlx-community/gemma-3-270m-it-qat-4bit"

# ドライバータイプ(現在はmlxのみサポート)
driver: "mlx"

# システムプロンプト - AIの基本的な振る舞いを定義
systemPrompt: |
  あなたは親切で知識豊富なAIアシスタントです。
  ユーザーの質問に対して、正確で分かりやすい回答を提供してください。
  日本語で応答してください。

# 初回メッセージ(オプション)- 新規セッション開始時の挨拶
preMessage: "こんにちは!何かお手伝いできることはありますか?"

# 参照ファイル(オプション)- プロンプトに含める追加資料
resourceFiles:
  - "./docs/guide.md"
  - "./data/reference.txt"

# 生成オプション
options:
  temperature: 0.7      # 生成の創造性(0.0-2.0)
  maxTokens: 4000      # 最大トークン数
  topP: 0.9            # トップP サンプリング

デフォルトプロファイル

プロファイルを指定しない場合、以下のデフォルト設定が使用されます:

  • model: mlx-community/gemma-3-270m-it-qat-4bit
  • systemPrompt: 親切で知識豊富なAIアシスタントとしての基本設定
  • temperature: 0.7
  • maxTokens: 4000

プロファイルの活用例

1. 技術サポート用プロファイル

model: "mlx-community/gemma-3-270m-it-qat-4bit"
systemPrompt: |
  あなたはソフトウェア開発の専門家です。
  技術的な質問に対して、具体的なコード例を交えて回答してください。
  エラーの解決方法を段階的に説明してください。
options:
  temperature: 0.3  # より正確な回答のため低めに設定

2. 創作支援用プロファイル

model: "mlx-community/gemma-3-270m-it-qat-4bit"  
systemPrompt: |
  あなたは創造的な文章作成を支援するアシスタントです。
  ユーザーのアイデアを発展させ、独創的な提案を行ってください。
options:
  temperature: 1.2  # 創造性を高めるため高めに設定
  maxTokens: 8000  # 長い文章生成に対応

実装のポイント

このサンプル実装では、Moduler Promptフレームワークの主要な機能を実際のアプリケーションで活用する方法を示しています:

  1. 静的なモジュール定義: chatPromptModuleは静的に定義されたテンプレート
  2. モジュールの合成: @moduler-prompt/processwithMaterialsモジュールとの合成
  3. 型安全なコンテキスト: ChatContextによる型定義
  4. 段階的なデータバインディング: createContext → データ設定 → compile

詳細はプロンプトモジュール仕様書の実装例セクションを参照してください。