@ratley/react-native-apple-foundation-models
Version:
Access Apple’s on-device Foundation Models (text + image AI)
33 lines • 1.98 kB
TypeScript
import type { ObjectGenerationOptions, ObjectGenerationResult, TextGenerationOptions, TextGenerationResult, TextModelAvailability } from "./AppleFoundationModels.types";
import AppleFoundationModelsModule from "./AppleFoundationModelsModule.ios";
export * from "./AppleFoundationModels.types";
export { default as AppleFoundationModelsView } from "./AppleFoundationModelsView";
export { isTextGenerationError, TextGenerationError, toTextGenerationError, } from "./errors";
export declare function isTextModelAvailable(): Promise<boolean>;
/**
* Get precise availability of the on-device language model.
* - When `status === "available"`, the model is ready to use.
* - When `status === "unavailable"`, inspect `reasonCode` to choose a fallback UX:
* - `deviceNotEligible`: hardware doesn’t support Apple Intelligence.
* - `appleIntelligenceNotEnabled`: user has not enabled Apple Intelligence in Settings.
* - `modelNotReady`: model is downloading or otherwise not yet ready.
* - `unknown`: an unrecognized system-reported reason.
* - `unsupported`: platform/OS does not support the on-device model.
*
* `reasonMessage` may include a human-readable explanation suitable for display or logging.
*/
export declare function getTextModelAvailability(): Promise<TextModelAvailability>;
/**
* Generate a single text response. Returns the text and the sessionId used.
*/
export declare function generateText(options: TextGenerationOptions): Promise<TextGenerationResult>;
export default AppleFoundationModelsModule;
export { LLMSession } from "./LLMSession";
export { useLLMSession } from "./useLLMSession";
/**
* Generate a structured object matching `schema`.
* Prefers native guided generation when available, otherwise falls back to
* prompt-then-parse with runtime validation against the schema.
*/
export declare function generateObject<T = unknown>(options: ObjectGenerationOptions): Promise<ObjectGenerationResult<T>>;
//# sourceMappingURL=index.d.ts.map