expo-ai-kit 0.3.6 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -1106
- package/build/ExpoAiKitModule.d.ts +1 -1
- package/build/ExpoAiKitModule.d.ts.map +1 -1
- package/build/ExpoAiKitModule.js.map +1 -1
- package/build/index.d.ts +1 -436
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -737
- package/build/index.js.map +1 -1
- package/build/types.d.ts +3 -244
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/package.json +3 -2
- package/src/ExpoAiKitModule.ts +2 -2
- package/src/index.ts +1 -943
- package/src/types.ts +3 -284
- package/android/build/.transforms/05637efea134638df3d3fc7b19d5dfdb/results.bin +0 -1
- package/android/build/.transforms/05637efea134638df3d3fc7b19d5dfdb/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/cd4ecc077e8795b855097bce5bf059b1/results.bin +0 -1
- package/android/build/.transforms/cd4ecc077e8795b855097bce5bf059b1/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/expo/modules/aikit/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/expo-ai-kit_debug.kotlin_module +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/expo/modules/aikit/BuildConfig.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +0 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -14
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/expo-ai-kit_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$1$11$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$1$2$conversationPrompt$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$1$3$conversationPrompt$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$1$3$job$1$streamCallback$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$1$3$job$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$5.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$6.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$AsyncFunction$7.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$10.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$11.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$12.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$5.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$6.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$7.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$8.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Coroutine$9.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Function$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$Function$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$FunctionWithoutArgs$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$FunctionWithoutArgs$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$FunctionWithoutArgs$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule$definition$lambda$20$$inlined$FunctionWithoutArgs$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/ExpoAiKitModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$deleteModelFile$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$downloadModelFile$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$downloadModelFile$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateText$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateText$2$1$1$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateText$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateTextStream$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateTextStream$2$1$1$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$generateTextStream$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$loadModel$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$loadModel$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient$unloadModel$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/GemmaInferenceClient.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient$generateText$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient$generateTextStream$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient$generateTextStream$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient$isAvailable$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient$isAvailableBlocking$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/aikit/PromptApiClient.class +0 -0
- package/build/hooks.d.ts +0 -147
- package/build/hooks.d.ts.map +0 -1
- package/build/hooks.js +0 -426
- package/build/hooks.js.map +0 -1
- package/build/memory.d.ts +0 -235
- package/build/memory.d.ts.map +0 -1
- package/build/memory.js +0 -353
- package/build/memory.js.map +0 -1
- package/src/__tests__/index.test.js +0 -630
- package/src/hooks.ts +0 -502
- package/src/memory.ts +0 -394
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventSubscription } from 'expo-modules-core';
|
|
2
|
-
import {
|
|
2
|
+
import { BuiltInModel, DownloadableModelStatus, LLMMessage, LLMResponse, LLMStreamEvent, ModelDownloadProgressEvent, ModelStateChangeEvent } from './types';
|
|
3
3
|
export type ExpoAiKitModuleEvents = {
|
|
4
4
|
onStreamToken: (event: LLMStreamEvent) => void;
|
|
5
5
|
onDownloadProgress: (event: ModelDownloadProgressEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAiKitModule.d.ts","sourceRoot":"","sources":["../src/ExpoAiKitModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,UAAU,EACV,WAAW,EACX,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"ExpoAiKitModule.d.ts","sourceRoot":"","sources":["../src/ExpoAiKitModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,UAAU,EACV,WAAW,EACX,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C,kBAAkB,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAChE,kBAAkB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAEpC,WAAW,IAAI,OAAO,CAAC;IACvB,WAAW,CACT,QAAQ,EAAE,UAAU,EAAE,EACtB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,cAAc,CACZ,QAAQ,EAAE,UAAU,EAAE,EACtB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGhD,gBAAgB,IAAI,YAAY,EAAE,CAAC;IACnC,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACrE,iBAAiB,IAAI,MAAM,CAAC;IAK5B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,cAAc,IAAI,MAAM,CAAC;IAGzB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAG7B,aAAa,CACX,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG5C,WAAW,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC/C,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACjC,iBAAiB,CAAC;CACtB;AAED,QAAA,MAAM,eAAe,uBACoC,CAAC;AAE1D,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAiKitModule.js","sourceRoot":"","sources":["../src/ExpoAiKitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA6DxD,MAAM,eAAe,GACnB,mBAAmB,CAAwB,WAAW,CAAC,CAAC;AAE1D,eAAe,eAAe,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport type { EventSubscription } from 'expo-modules-core';\nimport {\n
|
|
1
|
+
{"version":3,"file":"ExpoAiKitModule.js","sourceRoot":"","sources":["../src/ExpoAiKitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA6DxD,MAAM,eAAe,GACnB,mBAAmB,CAAwB,WAAW,CAAC,CAAC;AAE1D,eAAe,eAAe,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport type { EventSubscription } from 'expo-modules-core';\nimport {\n BuiltInModel,\n DownloadableModelStatus,\n LLMMessage,\n LLMResponse,\n LLMStreamEvent,\n ModelDownloadProgressEvent,\n ModelStateChangeEvent,\n} from './types';\n\nexport type ExpoAiKitModuleEvents = {\n onStreamToken: (event: LLMStreamEvent) => void;\n onDownloadProgress: (event: ModelDownloadProgressEvent) => void;\n onModelStateChange: (event: ModelStateChangeEvent) => void;\n};\n\nexport interface ExpoAiKitNativeModule {\n // Existing inference API\n isAvailable(): boolean;\n sendMessage(\n messages: LLMMessage[],\n systemPrompt: string\n ): Promise<LLMResponse>;\n startStreaming(\n messages: LLMMessage[],\n systemPrompt: string,\n sessionId: string\n ): Promise<void>;\n stopStreaming(sessionId: string): Promise<void>;\n\n // Model discovery\n getBuiltInModels(): BuiltInModel[];\n getDownloadableModelStatus(modelId: string): DownloadableModelStatus;\n getDeviceRamBytes(): number;\n\n // Model selection & memory management\n // setModel is async: switching to a downloadable model loads it into memory.\n // Auto-unloads the previous downloadable model (only one loaded at a time).\n setModel(modelId: string, minRamBytes: number, backend: string): Promise<void>;\n getActiveModel(): string;\n // Explicitly free memory from the loaded downloadable model.\n // Reverts to the platform built-in model.\n unloadModel(): Promise<void>;\n\n // Model lifecycle (downloadable models only)\n downloadModel(\n modelId: string,\n url: string,\n sha256: string\n ): Promise<void>;\n deleteModel(modelId: string): Promise<void>;\n\n // Event subscription\n addListener<K extends keyof ExpoAiKitModuleEvents>(\n eventName: K,\n listener: ExpoAiKitModuleEvents[K]\n ): EventSubscription;\n}\n\nconst ExpoAiKitModule =\n requireNativeModule<ExpoAiKitNativeModule>('ExpoAiKit');\n\nexport default ExpoAiKitModule;\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { LLMMessage, LLMSendOptions, LLMResponse, LLMStreamOptions, LLMStreamCallback,
|
|
1
|
+
import { LLMMessage, LLMSendOptions, LLMResponse, LLMStreamOptions, LLMStreamCallback, BuiltInModel, DownloadableModel, SetModelOptions } from './types';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export * from './memory';
|
|
4
|
-
export * from './hooks';
|
|
5
3
|
export * from './models';
|
|
6
4
|
/**
|
|
7
5
|
* Check if on-device AI is available on the current device.
|
|
@@ -76,444 +74,11 @@ export declare function sendMessage(messages: LLMMessage[], options?: LLMSendOpt
|
|
|
76
74
|
* // Cancel after 5 seconds
|
|
77
75
|
* setTimeout(() => stop(), 5000);
|
|
78
76
|
* ```
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* // React state update pattern
|
|
83
|
-
* const [text, setText] = useState('');
|
|
84
|
-
*
|
|
85
|
-
* streamMessage(
|
|
86
|
-
* [{ role: 'user', content: 'Hello!' }],
|
|
87
|
-
* (event) => setText(event.accumulatedText)
|
|
88
|
-
* );
|
|
89
|
-
* ```
|
|
90
77
|
*/
|
|
91
78
|
export declare function streamMessage(messages: LLMMessage[], onToken: LLMStreamCallback, options?: LLMStreamOptions): {
|
|
92
79
|
promise: Promise<LLMResponse>;
|
|
93
80
|
stop: () => void;
|
|
94
81
|
};
|
|
95
|
-
/**
|
|
96
|
-
* Summarize text content using on-device AI.
|
|
97
|
-
*
|
|
98
|
-
* @param text - The text to summarize
|
|
99
|
-
* @param options - Optional settings for summary style and length
|
|
100
|
-
* @returns Promise with the generated summary
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* // Basic summarization
|
|
105
|
-
* const result = await summarize(longArticle);
|
|
106
|
-
* console.log(result.text);
|
|
107
|
-
* ```
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```ts
|
|
111
|
-
* // Short bullet-point summary
|
|
112
|
-
* const result = await summarize(longArticle, {
|
|
113
|
-
* length: 'short',
|
|
114
|
-
* style: 'bullets'
|
|
115
|
-
* });
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* // TL;DR style
|
|
121
|
-
* const result = await summarize(longArticle, {
|
|
122
|
-
* style: 'tldr'
|
|
123
|
-
* });
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare function summarize(text: string, options?: LLMSummarizeOptions): Promise<LLMResponse>;
|
|
127
|
-
/**
|
|
128
|
-
* Summarize text with streaming output.
|
|
129
|
-
*
|
|
130
|
-
* @param text - The text to summarize
|
|
131
|
-
* @param onToken - Callback for each token received
|
|
132
|
-
* @param options - Optional settings for summary style and length
|
|
133
|
-
* @returns Object with stop() function and promise
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* ```ts
|
|
137
|
-
* const { promise } = streamSummarize(
|
|
138
|
-
* longArticle,
|
|
139
|
-
* (event) => setSummary(event.accumulatedText),
|
|
140
|
-
* { style: 'bullets' }
|
|
141
|
-
* );
|
|
142
|
-
* await promise;
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
export declare function streamSummarize(text: string, onToken: LLMStreamCallback, options?: LLMSummarizeOptions): {
|
|
146
|
-
promise: Promise<LLMResponse>;
|
|
147
|
-
stop: () => void;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Translate text to another language using on-device AI.
|
|
151
|
-
*
|
|
152
|
-
* @param text - The text to translate
|
|
153
|
-
* @param options - Translation options including target language
|
|
154
|
-
* @returns Promise with the translated text
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* // Basic translation
|
|
159
|
-
* const result = await translate('Hello, world!', { to: 'Spanish' });
|
|
160
|
-
* console.log(result.text); // "¡Hola, mundo!"
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```ts
|
|
165
|
-
* // Formal translation with source language
|
|
166
|
-
* const result = await translate('Hey, what\'s up?', {
|
|
167
|
-
* to: 'French',
|
|
168
|
-
* from: 'English',
|
|
169
|
-
* tone: 'formal'
|
|
170
|
-
* });
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
export declare function translate(text: string, options: LLMTranslateOptions): Promise<LLMResponse>;
|
|
174
|
-
/**
|
|
175
|
-
* Translate text with streaming output.
|
|
176
|
-
*
|
|
177
|
-
* @param text - The text to translate
|
|
178
|
-
* @param onToken - Callback for each token received
|
|
179
|
-
* @param options - Translation options including target language
|
|
180
|
-
* @returns Object with stop() function and promise
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* const { promise } = streamTranslate(
|
|
185
|
-
* 'Hello, world!',
|
|
186
|
-
* (event) => setTranslation(event.accumulatedText),
|
|
187
|
-
* { to: 'Japanese' }
|
|
188
|
-
* );
|
|
189
|
-
* await promise;
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
export declare function streamTranslate(text: string, onToken: LLMStreamCallback, options: LLMTranslateOptions): {
|
|
193
|
-
promise: Promise<LLMResponse>;
|
|
194
|
-
stop: () => void;
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Rewrite text in a different style using on-device AI.
|
|
198
|
-
*
|
|
199
|
-
* @param text - The text to rewrite
|
|
200
|
-
* @param options - Rewrite options specifying the target style
|
|
201
|
-
* @returns Promise with the rewritten text
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```ts
|
|
205
|
-
* // Make text more formal
|
|
206
|
-
* const result = await rewrite('hey can u help me out?', {
|
|
207
|
-
* style: 'formal'
|
|
208
|
-
* });
|
|
209
|
-
* console.log(result.text); // "Would you be able to assist me?"
|
|
210
|
-
* ```
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
* ```ts
|
|
214
|
-
* // Simplify complex text
|
|
215
|
-
* const result = await rewrite(technicalText, { style: 'simple' });
|
|
216
|
-
* ```
|
|
217
|
-
*/
|
|
218
|
-
export declare function rewrite(text: string, options: LLMRewriteOptions): Promise<LLMResponse>;
|
|
219
|
-
/**
|
|
220
|
-
* Rewrite text with streaming output.
|
|
221
|
-
*
|
|
222
|
-
* @param text - The text to rewrite
|
|
223
|
-
* @param onToken - Callback for each token received
|
|
224
|
-
* @param options - Rewrite options specifying the target style
|
|
225
|
-
* @returns Object with stop() function and promise
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```ts
|
|
229
|
-
* const { promise } = streamRewrite(
|
|
230
|
-
* 'hey whats up',
|
|
231
|
-
* (event) => setRewritten(event.accumulatedText),
|
|
232
|
-
* { style: 'professional' }
|
|
233
|
-
* );
|
|
234
|
-
* await promise;
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
export declare function streamRewrite(text: string, onToken: LLMStreamCallback, options: LLMRewriteOptions): {
|
|
238
|
-
promise: Promise<LLMResponse>;
|
|
239
|
-
stop: () => void;
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* Extract key points from text using on-device AI.
|
|
243
|
-
*
|
|
244
|
-
* @param text - The text to extract key points from
|
|
245
|
-
* @param options - Optional settings for extraction
|
|
246
|
-
* @returns Promise with the key points as text
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```ts
|
|
250
|
-
* // Extract key points from an article
|
|
251
|
-
* const result = await extractKeyPoints(article);
|
|
252
|
-
* console.log(result.text);
|
|
253
|
-
* // "• Point 1\n• Point 2\n• Point 3"
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* @example
|
|
257
|
-
* ```ts
|
|
258
|
-
* // Limit to 3 key points
|
|
259
|
-
* const result = await extractKeyPoints(article, { maxPoints: 3 });
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
export declare function extractKeyPoints(text: string, options?: LLMExtractKeyPointsOptions): Promise<LLMResponse>;
|
|
263
|
-
/**
|
|
264
|
-
* Extract key points with streaming output.
|
|
265
|
-
*
|
|
266
|
-
* @param text - The text to extract key points from
|
|
267
|
-
* @param onToken - Callback for each token received
|
|
268
|
-
* @param options - Optional settings for extraction
|
|
269
|
-
* @returns Object with stop() function and promise
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* ```ts
|
|
273
|
-
* const { promise } = streamExtractKeyPoints(
|
|
274
|
-
* article,
|
|
275
|
-
* (event) => setKeyPoints(event.accumulatedText),
|
|
276
|
-
* { maxPoints: 5 }
|
|
277
|
-
* );
|
|
278
|
-
* await promise;
|
|
279
|
-
* ```
|
|
280
|
-
*/
|
|
281
|
-
export declare function streamExtractKeyPoints(text: string, onToken: LLMStreamCallback, options?: LLMExtractKeyPointsOptions): {
|
|
282
|
-
promise: Promise<LLMResponse>;
|
|
283
|
-
stop: () => void;
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* Answer a question based on provided context using on-device AI.
|
|
287
|
-
*
|
|
288
|
-
* @param question - The question to answer
|
|
289
|
-
* @param context - The context/document to base the answer on
|
|
290
|
-
* @param options - Optional settings for the answer
|
|
291
|
-
* @returns Promise with the answer
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```ts
|
|
295
|
-
* // Answer a question about a document
|
|
296
|
-
* const result = await answerQuestion(
|
|
297
|
-
* 'What is the main topic?',
|
|
298
|
-
* documentText
|
|
299
|
-
* );
|
|
300
|
-
* console.log(result.text);
|
|
301
|
-
* ```
|
|
302
|
-
*
|
|
303
|
-
* @example
|
|
304
|
-
* ```ts
|
|
305
|
-
* // Get a detailed answer
|
|
306
|
-
* const result = await answerQuestion(
|
|
307
|
-
* 'Explain the methodology',
|
|
308
|
-
* researchPaper,
|
|
309
|
-
* { detail: 'detailed' }
|
|
310
|
-
* );
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
313
|
-
export declare function answerQuestion(question: string, context: string, options?: LLMAnswerQuestionOptions): Promise<LLMResponse>;
|
|
314
|
-
/**
|
|
315
|
-
* Answer a question with streaming output.
|
|
316
|
-
*
|
|
317
|
-
* @param question - The question to answer
|
|
318
|
-
* @param context - The context/document to base the answer on
|
|
319
|
-
* @param onToken - Callback for each token received
|
|
320
|
-
* @param options - Optional settings for the answer
|
|
321
|
-
* @returns Object with stop() function and promise
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* ```ts
|
|
325
|
-
* const { promise } = streamAnswerQuestion(
|
|
326
|
-
* 'What are the key findings?',
|
|
327
|
-
* documentText,
|
|
328
|
-
* (event) => setAnswer(event.accumulatedText),
|
|
329
|
-
* { detail: 'detailed' }
|
|
330
|
-
* );
|
|
331
|
-
* await promise;
|
|
332
|
-
* ```
|
|
333
|
-
*/
|
|
334
|
-
export declare function streamAnswerQuestion(question: string, context: string, onToken: LLMStreamCallback, options?: LLMAnswerQuestionOptions): {
|
|
335
|
-
promise: Promise<LLMResponse>;
|
|
336
|
-
stop: () => void;
|
|
337
|
-
};
|
|
338
|
-
/**
|
|
339
|
-
* Generate text suggestions based on partial input using on-device AI.
|
|
340
|
-
*
|
|
341
|
-
* Useful for text completion, writing assistance, and predictive text features.
|
|
342
|
-
*
|
|
343
|
-
* @param partialText - The text the user has typed so far
|
|
344
|
-
* @param options - Optional settings for suggestions
|
|
345
|
-
* @returns Promise with an array of suggestions
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* ```ts
|
|
349
|
-
* // Basic suggestions
|
|
350
|
-
* const result = await suggest('I think we should');
|
|
351
|
-
* result.suggestions.forEach(s => console.log(s.text));
|
|
352
|
-
* // "schedule a meeting to discuss this further"
|
|
353
|
-
* // "consider an alternative approach"
|
|
354
|
-
* // "move forward with the plan"
|
|
355
|
-
* ```
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* ```ts
|
|
359
|
-
* // With context and tone
|
|
360
|
-
* const result = await suggest('Dear Mr. Johnson,', {
|
|
361
|
-
* count: 5,
|
|
362
|
-
* context: 'writing a business email about project delays',
|
|
363
|
-
* tone: 'formal'
|
|
364
|
-
* });
|
|
365
|
-
* ```
|
|
366
|
-
*/
|
|
367
|
-
export declare function suggest(partialText: string, options?: LLMSuggestOptions): Promise<LLMSuggestResponse>;
|
|
368
|
-
/**
|
|
369
|
-
* Generate text suggestions with streaming output.
|
|
370
|
-
*
|
|
371
|
-
* @param partialText - The text the user has typed so far
|
|
372
|
-
* @param onToken - Callback for each token received
|
|
373
|
-
* @param options - Optional settings for suggestions
|
|
374
|
-
* @returns Object with stop() function and promise
|
|
375
|
-
*
|
|
376
|
-
* @example
|
|
377
|
-
* ```ts
|
|
378
|
-
* const { promise } = streamSuggest(
|
|
379
|
-
* 'The best way to',
|
|
380
|
-
* (event) => setRawSuggestions(event.accumulatedText)
|
|
381
|
-
* );
|
|
382
|
-
* const result = await promise;
|
|
383
|
-
* // Parse suggestions from result.text
|
|
384
|
-
* ```
|
|
385
|
-
*/
|
|
386
|
-
export declare function streamSuggest(partialText: string, onToken: LLMStreamCallback, options?: LLMSuggestOptions): {
|
|
387
|
-
promise: Promise<LLMResponse>;
|
|
388
|
-
stop: () => void;
|
|
389
|
-
};
|
|
390
|
-
/**
|
|
391
|
-
* Generate smart reply suggestions for a conversation using on-device AI.
|
|
392
|
-
*
|
|
393
|
-
* Analyzes the conversation history and generates contextually appropriate
|
|
394
|
-
* reply options, similar to Gmail/Messages smart replies.
|
|
395
|
-
*
|
|
396
|
-
* @param messages - The conversation history to generate replies for
|
|
397
|
-
* @param options - Optional settings for reply generation
|
|
398
|
-
* @returns Promise with an array of reply suggestions
|
|
399
|
-
*
|
|
400
|
-
* @example
|
|
401
|
-
* ```ts
|
|
402
|
-
* // Basic smart replies
|
|
403
|
-
* const result = await smartReply([
|
|
404
|
-
* { role: 'user', content: 'Hey, are you free for lunch tomorrow?' }
|
|
405
|
-
* ]);
|
|
406
|
-
* result.suggestions.forEach(s => console.log(s.text));
|
|
407
|
-
* // "Sure, what time works for you?"
|
|
408
|
-
* // "Sorry, I already have plans."
|
|
409
|
-
* // "Let me check my schedule and get back to you."
|
|
410
|
-
* ```
|
|
411
|
-
*
|
|
412
|
-
* @example
|
|
413
|
-
* ```ts
|
|
414
|
-
* // With persona and tone
|
|
415
|
-
* const result = await smartReply(
|
|
416
|
-
* [
|
|
417
|
-
* { role: 'user', content: 'We need the report by Friday.' },
|
|
418
|
-
* { role: 'assistant', content: 'I will do my best.' },
|
|
419
|
-
* { role: 'user', content: 'Can you confirm the deadline works?' }
|
|
420
|
-
* ],
|
|
421
|
-
* { tone: 'professional', persona: 'project manager', count: 4 }
|
|
422
|
-
* );
|
|
423
|
-
* ```
|
|
424
|
-
*/
|
|
425
|
-
export declare function smartReply(messages: LLMMessage[], options?: LLMSmartReplyOptions): Promise<LLMSuggestResponse>;
|
|
426
|
-
/**
|
|
427
|
-
* Generate smart reply suggestions with streaming output.
|
|
428
|
-
*
|
|
429
|
-
* @param messages - The conversation history to generate replies for
|
|
430
|
-
* @param onToken - Callback for each token received
|
|
431
|
-
* @param options - Optional settings for reply generation
|
|
432
|
-
* @returns Object with stop() function and promise
|
|
433
|
-
*
|
|
434
|
-
* @example
|
|
435
|
-
* ```ts
|
|
436
|
-
* const { promise } = streamSmartReply(
|
|
437
|
-
* [{ role: 'user', content: 'Want to grab coffee?' }],
|
|
438
|
-
* (event) => setRawReplies(event.accumulatedText)
|
|
439
|
-
* );
|
|
440
|
-
* const result = await promise;
|
|
441
|
-
* ```
|
|
442
|
-
*/
|
|
443
|
-
export declare function streamSmartReply(messages: LLMMessage[], onToken: LLMStreamCallback, options?: LLMSmartReplyOptions): {
|
|
444
|
-
promise: Promise<LLMResponse>;
|
|
445
|
-
stop: () => void;
|
|
446
|
-
};
|
|
447
|
-
/**
|
|
448
|
-
* Autocomplete the user's current text using on-device AI.
|
|
449
|
-
*
|
|
450
|
-
* Generates short, natural completions that seamlessly continue from
|
|
451
|
-
* the user's partial input. Ideal for real-time typing suggestions.
|
|
452
|
-
*
|
|
453
|
-
* @param partialText - The text the user has typed so far
|
|
454
|
-
* @param options - Optional settings for autocompletion
|
|
455
|
-
* @returns Promise with an array of completion suggestions
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```ts
|
|
459
|
-
* // Basic autocomplete
|
|
460
|
-
* const result = await autocomplete('How do I');
|
|
461
|
-
* result.suggestions.forEach(s => console.log(s.text));
|
|
462
|
-
* // "reset my password"
|
|
463
|
-
* // "contact support"
|
|
464
|
-
* // "cancel my subscription"
|
|
465
|
-
* ```
|
|
466
|
-
*
|
|
467
|
-
* @example
|
|
468
|
-
* ```ts
|
|
469
|
-
* // With context for better suggestions
|
|
470
|
-
* const result = await autocomplete('The patient presents with', {
|
|
471
|
-
* context: 'medical notes',
|
|
472
|
-
* maxWords: 15,
|
|
473
|
-
* count: 5
|
|
474
|
-
* });
|
|
475
|
-
* ```
|
|
476
|
-
*/
|
|
477
|
-
export declare function autocomplete(partialText: string, options?: LLMAutocompleteOptions): Promise<LLMSuggestResponse>;
|
|
478
|
-
/**
|
|
479
|
-
* Autocomplete text with streaming output.
|
|
480
|
-
*
|
|
481
|
-
* @param partialText - The text the user has typed so far
|
|
482
|
-
* @param onToken - Callback for each token received
|
|
483
|
-
* @param options - Optional settings for autocompletion
|
|
484
|
-
* @returns Object with stop() function and promise
|
|
485
|
-
*
|
|
486
|
-
* @example
|
|
487
|
-
* ```ts
|
|
488
|
-
* const { promise } = streamAutocomplete(
|
|
489
|
-
* 'I would like to',
|
|
490
|
-
* (event) => setRawCompletions(event.accumulatedText)
|
|
491
|
-
* );
|
|
492
|
-
* const result = await promise;
|
|
493
|
-
* ```
|
|
494
|
-
*/
|
|
495
|
-
export declare function streamAutocomplete(partialText: string, onToken: LLMStreamCallback, options?: LLMAutocompleteOptions): {
|
|
496
|
-
promise: Promise<LLMResponse>;
|
|
497
|
-
stop: () => void;
|
|
498
|
-
};
|
|
499
|
-
/**
|
|
500
|
-
* Parse suggestion text from a suggest/smartReply/autocomplete response.
|
|
501
|
-
*
|
|
502
|
-
* Use this to parse the raw text from streaming responses into structured suggestions.
|
|
503
|
-
*
|
|
504
|
-
* @param raw - Raw text response from the model
|
|
505
|
-
* @returns Array of parsed suggestions
|
|
506
|
-
*
|
|
507
|
-
* @example
|
|
508
|
-
* ```ts
|
|
509
|
-
* const { promise } = streamSuggest('Hello', (event) => {
|
|
510
|
-
* setText(event.accumulatedText);
|
|
511
|
-
* });
|
|
512
|
-
* const result = await promise;
|
|
513
|
-
* const suggestions = parseSuggestResponse(result.text);
|
|
514
|
-
* ```
|
|
515
|
-
*/
|
|
516
|
-
export declare function parseSuggestResponse(raw: string): LLMSuggestResponse;
|
|
517
82
|
/**
|
|
518
83
|
* Get all built-in models available on the current platform.
|
|
519
84
|
*
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAEhB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAEhB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAEjB,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AAczB;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAKpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,CAgBtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB;IAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAiErD;AAMD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAKhE;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA6B1E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACpD,OAAO,CAAC,IAAI,CAAC,CAiDf;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAEjD"}
|