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アシストセットアップを使用してプラグインをインストールできます。次のコマンドを使用して、CapgoスキルをAIツールに追加します。
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.Manualセットアップを使用する場合は、次のコマンドを実行して、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-llmbunx cap syncImport
「Import」のセクションimport { CapgoLLM } from '@capgo/capacitor-llm';createChat
Section titled “createChat”新しいチャットセッションを作成します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.createChat();sendMessage
Section titled “sendMessage”特定のチャットセッション内でAIにメッセージを送信します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.sendMessage({} as { chatId: string; message: string });getReadiness
Section titled “getReadiness”LLMのリードネス状態を取得します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.getReadiness();setModel
Section titled “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
「モデルダウンロード結果」のセクションモデルダウンロードの結果
export interface DownloadModelResult { /** Path where the model was saved */ path: string; /** Path where the companion file was saved (if applicable) */ companionPath?: string;}TextFromAiEvent
「テキストからAIイベント」のセクション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
「AI完了イベント」のセクションAIの完了イベントデータ
export interface AiFinishedEvent { /** The chat session ID that finished */ chatId: string;}DownloadProgressEvent
ダウンロード進捗イベントダウンロード進捗のイベントデータ
export interface DownloadProgressEvent { /** Percentage of download completed (0-100) */ progress: number; /** Total bytes to download */ totalBytes?: number; /** Bytes downloaded so far */ downloadedBytes?: number;}ReadinessChangeEvent
リードネスチェンジイベントリードネスの状態変更のイベントデータ
export interface ReadinessChangeEvent { /** The readiness status */ readiness: string;}ソースオブトゥース
ソースオブトゥースこのページはプラグインの src/definitions.tsパブリックAPIがアップストリームで変更されたときに、再度同期を実行してください。
続けて、Getting Startedから
「Getting Started」から続けてあなたが使用している Getting Started ダッシュボードとAPIの操作を計画するために Using @capgo/capacitor-llm Using @capgo/capacitor-llmのネイティブ機能 API Overview APIの実装詳細 Introduction Introductionの実装詳細 API Keys APIの実装詳細 デバイス デバイスの実装詳細について