{"id":31581341,"url":"https://github.com/kimmmmyy223/llm-batch","last_synced_at":"2026-04-08T16:32:31.003Z","repository":{"id":317689675,"uuid":"1068203639","full_name":"kimmmmyy223/llm-batch","owner":"kimmmmyy223","description":"🚀 Process JSON data in batches with `llm-batch`, leveraging sequential or parallel modes for efficient interaction with LLMs.","archived":false,"fork":false,"pushed_at":"2026-04-08T03:06:54.000Z","size":1942,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-08T05:12:25.736Z","etag":null,"topics":["aws","batch-inference","bedrock","deep-learning","distributed-computing","dynamic-batching","flask","language-model","large-language-models","llm-agent","llm-inference","nlp","ops","python","rabbitmq","ray-data","react","vllm"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kimmmmyy223.png","metadata":{"files":{"readme":"README.ja.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-02T02:29:06.000Z","updated_at":"2026-04-08T03:07:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7988fd8-3b6e-41fb-a0d6-da800d9f882c","html_url":"https://github.com/kimmmmyy223/llm-batch","commit_stats":null,"previous_names":["kimmmmyy223/llm-batch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kimmmmyy223/llm-batch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimmmmyy223%2Fllm-batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimmmmyy223%2Fllm-batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimmmmyy223%2Fllm-batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimmmmyy223%2Fllm-batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kimmmmyy223","download_url":"https://codeload.github.com/kimmmmyy223/llm-batch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimmmmyy223%2Fllm-batch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31564900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","batch-inference","bedrock","deep-learning","distributed-computing","dynamic-batching","flask","language-model","large-language-models","llm-agent","llm-inference","nlp","ops","python","rabbitmq","ray-data","react","vllm"],"created_at":"2025-10-05T21:56:29.347Z","updated_at":"2026-04-08T16:32:30.976Z","avatar_url":"https://github.com/kimmmmyy223.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Batch Processing Tool (`llm-batch`)\n\n`llm-batch` は、JSON配列またはJSONL（JSON Lines）形式のデータを受け取り、各JSONオブジェクトをLLMに送信して一括処理を行うためのコマンドラインツールです。\n\nデフォルトでは安全な**逐次処理**を行いますが、バックエンドが対応している場合は**並行処理**に切り替えてパフォーマンスを向上させることができます。また、**ストリーミングモード**を使用することで、`llm-cli`の出力をリアルタイムでモニタリングすることも可能です。\n\n## 必要条件\n\n  * **Go**: 1.18以上 (Goプログラムをビルドするため)\n  * **make**: (Makefileを使用してビルドするため)\n  * **llm-cli**: LLMと対話するためのクライアントツール。PATHが通っている必要があります。\n  * **git**: (推奨) バージョン情報をバイナリに埋め込むために使用されます。\n\n## ビルド方法\n\nプロジェクトのルートディレクトリで、以下のコマンドを実行するだけです。依存関係の解決と実行ファイルの生成が自動的に行われます。\n\n```bash\nmake build\n```\n\nビルドが完了すると、`bin/` ディレクトリ内に各OS・アーキテクチャ向けの実行可能ファイルが生成されます。\n\n      * `llm-batch-linux-amd64`\n      * `llm-batch-darwin-universal` (macOS Universal Binary for Intel \u0026 Apple Silicon)\n      * `llm-batch-windows-amd64.exe`\n\n## 使い方\n\n### コマンド構文\n\n```bash\n./\u003cbinary_name\u003e (-P \"\u003cprompt\u003e\" | -F \u003cfile\u003e) [options] [input_file]\n```\n\n  * `\u003cbinary_name\u003e`: あなたの環境に合った実行可能ファイル名。（例: `bin/llm-batch-darwin-universal`）\n\n### 引数とオプション\n\n  * `[input_file]`: 入力となるJSON配列またはJSONLファイルへのパス。省略した場合、標準入力からデータを読み取ります。\n\n  * **プロンプト (必須)**\n\n      * `-P \"\u003cprompt\u003e\"`: LLMに与えるシステムプロンプトを直接指定します。\n      * `-F \u003cprompt_file\u003e`: システムプロンプトが記述されたファイルへのパスを指定します。\n\n  * **オプション**\n\n      * `-L \u003cprofile\u003e`: 使用する `llm-cli` のプロファイル名を指定します。\n      * `-o, --format \u003cformat\u003e`: 出力形式を指定します。デフォルトは `text` です。\n          * `text`: LLMの出力をそのまま表示します。アイテム間は `---` で区切られます。\n          * `json`: 全ての結果を一つのJSON配列として出力します。（入力順）\n          * `jsonl`: 各結果を一行のJSONオブジェクトとして出力します。（入力順）\n      * `-c \u003cnum\u003e`: 同時に実行するプロセスの数を指定します。デフォルトは `1` (逐次処理) です。\n      * `--stream`: `llm-cli`の出力をリアルタイムで表示するストリーミングモードを有効にします。デバッグに便利です。このオプションを使用すると、並行処理は無効化 (`-c=1`) され、出力形式は `text` に強制されます。\n      * `--version`: ツールのバージョン情報を表示して終了します。\n\n### 並行処理について (重要)\n\n`-c` オプションで `2` 以上の値を設定すると、複数の `llm-cli` プロセスが同時に実行されます。\n\n  * **推奨されるケース**: Amazon BedrockやGoogle Vertex AIなど、**並列リクエストに対応したクラウドAPI**を `llm-cli` のバックエンドとして使用している場合。\n  * **非推奨のケース**: OllamaやLM Studioなど、**ローカルで単一のLLMを動かしている**場合。これらのモデルは一度に一つのリクエストしか処理できないことが多く、並列で呼び出すとリソースの競合を引き起こし、かえって処理が遅くなったり、システムが不安定になったりする可能性があります。ローカルモデルを使用する場合は、`-c 1` (デフォルト) のままにすることを強く推奨します。\n\n### 実行例\n\n#### 1\\. 逐次処理 (デフォルト)\n\n```bash\ncat reviews.jsonl | ./bin/llm-batch-darwin-universal \\\n  -P \"レビューを英語に翻訳してください。\" \\\n  --format jsonl\n```\n\n#### 2\\. ストリーミングモード (デバッグ用)\n\n```bash\ncat reviews.jsonl | ./bin/llm-batch-darwin-universal \\\n  -P \"このレビューの問題点を指摘してください。\" \\\n  --stream\n```\n\n#### 3\\. 並行処理 (クラウドAPI向け)\n\nAmazon Bedrockのプロファイル `my-bedrock-profile` を使い、4並列で処理する例です。\n\n```bash\n./bin/llm-batch-darwin-universal \\\n  -F prompt.txt \\\n  -L my-bedrock-profile \\\n  --format jsonl \\\n  -c 4 \\\n  reviews.jsonl\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimmmmyy223%2Fllm-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkimmmmyy223%2Fllm-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimmmmyy223%2Fllm-batch/lists"}