Getting Started
インストール手順とこのプラグインのフルマークダウンガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-llm`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/llm/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAI-Assistedセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-llm` plugin in my project.あなたがマニュアルセットアップを好む場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の説明を参照してください:
bun add @capgo/capacitor-llmbunx cap syncインポート
「インポート」のセクションimport { CapgoLLM } from '@capgo/capacitor-llm';APIの概要
「APIの概要」のセクションcreateChat
「createChat」のセクション会話セッションを作成します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.createChat();sendMessage
「sendMessage」を含むセクション特定のチャットセッション内のAIにメッセージを送信します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.sendMessage({} as { chatId: string; message: string });getReadiness
「getReadiness」を含むセクションLLMのリードネス状態を取得します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.getReadiness();setModel
「setModel」を含むセクションモデル設定を設定します
- iOS: システムモデル用の「Apple Intelligence」をパスとして使用するか、MediaPipeモデルへのパスを指定します
- Android: アセットまたはファイルディレクトリ内のMediaPipeモデルファイルへのパスを指定します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.setModel({} as ModelOptions);downloadModel
「ダウンロードモデル」セクションURLからモデルをダウンロードし、適切な場所に保存します。
- iOS: アプリのドキュメントディレクトリにダウンロードします。
- Android: アプリのファイルディレクトリにダウンロードします。
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.downloadModel({} as DownloadModelOptions);型参照
「型参照」セクションModelOptions
「モデルオプション」セクションモデル設定オプション。
export interface ModelOptions { /** Model path or "Apple Intelligence" for iOS system model */ path: string; /** Model file type/extension (e.g., "task", "bin", "litertlm"). If not provided, will be extracted from path. */ modelType?: string; /** Maximum number of tokens the model handles */ maxTokens?: number; /** Number of tokens the model considers at each step */ topk?: number; /** Amount of randomness in generation (0.0-1.0) */ temperature?: number; /** Random seed for generation */ randomSeed?: number;}DownloadModelOptions
「ダウンロードモデルオプション」セクションモデルダウンロードのオプション。
export interface DownloadModelOptions { /** URL of the model file to download */ url: string; /** Optional: URL of companion file (e.g., .litertlm for Android) */ companionUrl?: string; /** Optional: Custom filename (defaults to filename from URL) */ filename?: string;}DownloadModelResult
__CAPGO_KEEP_1__モデルダウンロードの結果
export interface DownloadModelResult { /** Path where the model was saved */ path: string; /** Path where the companion file was saved (if applicable) */ companionPath?: string;}TextFromAiEvent
__CAPGO_KEEP_2__AIから受信されたテキストのイベントデータ
export interface TextFromAiEvent { /** The text content from AI - this is an incremental chunk, not the full text */ text: string; /** The chat session ID */ chatId: string; /** Whether this is a complete chunk (true) or partial streaming data (false) */ isChunk?: boolean;}AiFinishedEvent
__CAPGO_KEEP_3__AIの完了イベントデータ
export interface AiFinishedEvent { /** The chat session ID that finished */ chatId: string;}DownloadProgressEvent
__CAPGO_KEEP_4__ダウンロードの進行状況イベントデータ
export interface DownloadProgressEvent { /** Percentage of download completed (0-100) */ progress: number; /** Total bytes to download */ totalBytes?: number; /** Bytes downloaded so far */ downloadedBytes?: number;}ReadinessChangeEvent
「ReadinessChangeEvent」セクション有効性の変化に伴うイベントデータ
export interface ReadinessChangeEvent { /** The readiness status */ readiness: string;}真実の源
「真実の源」セクションこのページはプラグインの src/definitions.ts API の上流で変更された場合に、パブリックを再度 Sync してください。
Getting Started から続けて
「Getting Started から続けて」セクションCapacitor を使用している場合 Getting Started ダッシュボードとAPIの作業を計画するには、 Using @capgo/capacitor-llm Using @capgo/capacitor-llmのネイティブ機能 APIの概要 APIの概要の実装詳細 導入 導入の実装詳細 APIのキー APIのキーに関する実装詳細 デバイス デバイスに関する実装詳細