ページ/エリア: Capgo マーケティング ウェブサイト。役割: ウェブサイト コピー文。見つける場所: コンポーネント doc/SignupCta.astro、コンポーネント Hero.astro。
このプラグインのセットアップコマンドとマークダウンガイドの全体をコピーできます。
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.
インストール
ソースガイドAI-Assisted セットアップを使用してプラグインをインストールできます。次のコマンドを使用して、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 Setupを使用する場合は、以下のコマンドを実行してください。以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-llmbunx cap syncインポート
__CAPGO_KEEP_0__の概要import { CapgoLLM } from '@capgo/capacitor-llm';APIの概要
APIガイドcreateChat
「createChat」新しいチャットセッションを作成します
import { CapgoLLM } from '@capgo/capacitor-llm';
const result = await CapgoLLM.createChat();console.log(result);sendMessage
sendMessage特定のチャットセッション内のAIにメッセージを送信します
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.sendMessage({ chatId: 'chat-id-123', message: 'Hello from Capacitor',});getReadiness
「準備状況」LLMの準備状態を取得します
import { CapgoLLM } from '@capgo/capacitor-llm';
const result = await CapgoLLM.getReadiness();console.log(result);setModel
セットモデルモデル設定を設定します
- iOS: Apple Intelligenceをシステムモデルとして使用するか、MediaPipeモデルへのパスを提供します
- Android: MediaPipe モデルファイルのパス (アセットまたはファイルディレクトリ)
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.setModel({ path: 'path/to/file', modelType: 'task',});downloadModel
「モデルダウンロード」セクションURLからモデルをダウンロードし、適切な場所に保存します
- iOS: アプリのドキュメントディレクトリにダウンロード
- Android: アプリのファイルディレクトリにダウンロード
import { CapgoLLM } from '@capgo/capacitor-llm';
const result = await CapgoLLM.downloadModel({ url: 'https://example.com' });console.log(result);型参照
「型参照」セクション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
「ReadinessChangeEvent」リードネス チェンジ イベント
export interface ReadinessChangeEvent { /** The readiness status */ readiness: string;}リードネス ステータス変更のイベントデータ
ソース オブ トゥースソース オブ トゥース src/definitions.ts.APIがアップストリームで変更されたときは、再度同期を実行してください。
パブリック __CAPGO_KEEP_0__ のアップストリームで変更されたときに、再度同期を実行してください。
続けて始めましょう: Getting StartedCapgoを使用している場合 Getting Started 計画ダッシュボードとAPIの運用を、 Using @capgo/capacitor-llm Capgoのネイティブ機能の使用に@capgo/capacitor-llmを使用します。 API まとめ for the API の実装詳細について Introduction 導入の詳細については、導入のページを参照してください。 API キー for API Keys の実装詳細について デバイス デバイスの実装詳細について。