diff --git a/docs/API/README.md b/docs/API/README.md index d282527f..42060ff8 100644 --- a/docs/API/README.md +++ b/docs/API/README.md @@ -11,6 +11,7 @@ llama.rn ### Type Aliases +- [BenchResult](README.md#benchresult) - [CompletionParams](README.md#completionparams) - [ContextParams](README.md#contextparams) - [TokenData](README.md#tokendata) @@ -24,13 +25,35 @@ llama.rn ## Type Aliases +### BenchResult + +Ƭ **BenchResult**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `modelDesc` | `string` | +| `modelNParams` | `number` | +| `modelSize` | `number` | +| `ppAvg` | `number` | +| `ppStd` | `number` | +| `tgAvg` | `number` | +| `tgStd` | `number` | + +#### Defined in + +[index.ts:43](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L43) + +___ + ### CompletionParams Ƭ **CompletionParams**: `Omit`<`NativeCompletionParams`, ``"emit_partial_completion"``\> #### Defined in -[index.ts:40](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L40) +[index.ts:41](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L41) ___ @@ -40,7 +63,7 @@ ___ #### Defined in -[index.ts:38](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L38) +[index.ts:39](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L39) ___ @@ -57,7 +80,7 @@ ___ #### Defined in -[index.ts:28](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L28) +[index.ts:29](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L29) ## Functions @@ -79,7 +102,7 @@ ___ #### Defined in -[grammar.ts:134](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L134) +[grammar.ts:134](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L134) ___ @@ -99,7 +122,7 @@ ___ #### Defined in -[index.ts:127](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L127) +[index.ts:160](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L160) ___ @@ -113,7 +136,7 @@ ___ #### Defined in -[index.ts:143](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L143) +[index.ts:176](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L176) ___ @@ -133,4 +156,4 @@ ___ #### Defined in -[index.ts:123](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L123) +[index.ts:156](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L156) diff --git a/docs/API/classes/LlamaContext.md b/docs/API/classes/LlamaContext.md index 0666076a..1d199156 100644 --- a/docs/API/classes/LlamaContext.md +++ b/docs/API/classes/LlamaContext.md @@ -16,6 +16,7 @@ ### Methods +- [bench](LlamaContext.md#bench) - [completion](LlamaContext.md#completion) - [detokenize](LlamaContext.md#detokenize) - [embedding](LlamaContext.md#embedding) @@ -39,7 +40,7 @@ #### Defined in -[index.ts:49](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L49) +[index.ts:60](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L60) ## Properties @@ -49,7 +50,7 @@ #### Defined in -[index.ts:45](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L45) +[index.ts:56](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L56) ___ @@ -59,7 +60,7 @@ ___ #### Defined in -[index.ts:43](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L43) +[index.ts:54](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L54) ___ @@ -69,10 +70,33 @@ ___ #### Defined in -[index.ts:47](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L47) +[index.ts:58](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L58) ## Methods +### bench + +▸ **bench**(`pp`, `tg`, `pl`, `nr`): `Promise`<[`BenchResult`](../README.md#benchresult)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `pp` | `number` | +| `tg` | `number` | +| `pl` | `number` | +| `nr` | `number` | + +#### Returns + +`Promise`<[`BenchResult`](../README.md#benchresult)\> + +#### Defined in + +[index.ts:129](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L129) + +___ + ### completion ▸ **completion**(`params`, `callback?`): `Promise`<`NativeCompletionResult`\> @@ -90,7 +114,7 @@ ___ #### Defined in -[index.ts:73](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L73) +[index.ts:84](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L84) ___ @@ -110,7 +134,7 @@ ___ #### Defined in -[index.ts:110](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L110) +[index.ts:121](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L121) ___ @@ -130,13 +154,13 @@ ___ #### Defined in -[index.ts:114](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L114) +[index.ts:125](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L125) ___ ### loadSession -▸ **loadSession**(`filepath`): `Promise`<`number`\> +▸ **loadSession**(`filepath`): `Promise`<`NativeSessionLoadResult`\> Load cached prompt & completion state from a file. @@ -148,11 +172,11 @@ Load cached prompt & completion state from a file. #### Returns -`Promise`<`number`\> +`Promise`<`NativeSessionLoadResult`\> #### Defined in -[index.ts:62](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L62) +[index.ts:73](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L73) ___ @@ -166,13 +190,13 @@ ___ #### Defined in -[index.ts:118](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L118) +[index.ts:151](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L151) ___ ### saveSession -▸ **saveSession**(`filepath`): `Promise`<`number`\> +▸ **saveSession**(`filepath`, `options?`): `Promise`<`number`\> Save current cached prompt & completion state to a file. @@ -181,6 +205,8 @@ Save current cached prompt & completion state to a file. | Name | Type | | :------ | :------ | | `filepath` | `string` | +| `options?` | `Object` | +| `options.tokenSize` | `number` | #### Returns @@ -188,7 +214,7 @@ Save current cached prompt & completion state to a file. #### Defined in -[index.ts:69](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L69) +[index.ts:80](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L80) ___ @@ -202,7 +228,7 @@ ___ #### Defined in -[index.ts:102](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L102) +[index.ts:113](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L113) ___ @@ -222,4 +248,4 @@ ___ #### Defined in -[index.ts:106](https://github.com/mybigday/llama.rn/blob/8738c99/src/index.ts#L106) +[index.ts:117](https://github.com/mybigday/llama.rn/blob/427a856/src/index.ts#L117) diff --git a/docs/API/classes/SchemaGrammarConverter.md b/docs/API/classes/SchemaGrammarConverter.md index e7062a51..9d559643 100644 --- a/docs/API/classes/SchemaGrammarConverter.md +++ b/docs/API/classes/SchemaGrammarConverter.md @@ -33,7 +33,7 @@ #### Defined in -[grammar.ts:39](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L39) +[grammar.ts:39](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L39) ## Properties @@ -43,7 +43,7 @@ #### Defined in -[grammar.ts:35](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L35) +[grammar.ts:35](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L35) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[grammar.ts:37](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L37) +[grammar.ts:37](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L37) ## Methods @@ -74,7 +74,7 @@ ___ #### Defined in -[grammar.ts:45](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L45) +[grammar.ts:45](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L45) ___ @@ -88,7 +88,7 @@ ___ #### Defined in -[grammar.ts:125](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L125) +[grammar.ts:125](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L125) ___ @@ -109,4 +109,4 @@ ___ #### Defined in -[grammar.ts:65](https://github.com/mybigday/llama.rn/blob/8738c99/src/grammar.ts#L65) +[grammar.ts:65](https://github.com/mybigday/llama.rn/blob/427a856/src/grammar.ts#L65) diff --git a/example/src/Bubble.tsx b/example/src/Bubble.tsx index f8865e0e..e4d8812c 100644 --- a/example/src/Bubble.tsx +++ b/example/src/Bubble.tsx @@ -1,9 +1,9 @@ import React, { useContext } from 'react' import type { ReactNode } from 'react' import { View, Text, TouchableOpacity } from 'react-native' +import Clipboard from '@react-native-clipboard/clipboard' import { ThemeContext, UserContext } from '@flyerhq/react-native-chat-ui' import type { MessageType } from '@flyerhq/react-native-chat-ui' -import Clipboard from '@react-native-clipboard/clipboard'; export const Bubble = ({ child,