내용으로 건너뛰기

__CAPGO_KEEP_1__

설치

설치
터미널 창
bun add @capgo/capacitor-llm
bunx cap sync

import

import
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);

URL에서 모델을 다운로드하고 적절한 위치에 저장합니다.

  • iOS: 앱의 문서 폴더에 다운로드합니다.
  • Android: 앱의 파일 폴더에 다운로드합니다.
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.downloadModel({} as DownloadModelOptions);

모델 구성 옵션입니다.

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;
}

다운로드 모델 옵션입니다.

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__

__CAPGO_KEEP_2__

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_3__

__CAPGO_KEEP_4__

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_5__

__CAPGO_KEEP_0__

export interface AiFinishedEvent {
/** The chat session ID that finished */
chatId: string;
}

DownloadProgressEvent

__CAPGO_KEEP_0__

__CAPGO_KEEP_7__

export interface DownloadProgressEvent {
/** Percentage of download completed (0-100) */
progress: number;
/** Total bytes to download */
totalBytes?: number;
/** Bytes downloaded so far */
downloadedBytes?: number;
}

준비 상태 변경 이벤트 데이터.

export interface ReadinessChangeEvent {
/** The readiness status */
readiness: string;
}

이 페이지는 플러그인의 src/definitions.tsAPI의 공개 버전이 업스트림에서 변경될 때 다시 싱크를 실행하세요.

Getting Started에서 계속

« Getting Started에서 계속 » 섹션

__CAPGO_KEEP_0__이 업스트림에서 변경되었을 때 다시 싱크를 실행하세요. Getting Started를 사용 중이라면 대시보드와 API 운영을 계획하고 연결하세요. Using @capgo/capacitor-llm Using @capgo/capacitor-llm API 개요 API 개요 소개 소개 API 키 API 키 기기 기기