From d577c5ad6dd2cd380e2a370828584a20dc878a35 Mon Sep 17 00:00:00 2001 From: Jhen-Jie Hong Date: Thu, 21 Nov 2024 12:04:03 +0800 Subject: [PATCH] docs(api): build --- docs/API/README.md | 51 ++++++------ docs/API/classes/LlamaContext.md | 81 +++++++++++++++---- docs/API/classes/SchemaGrammarConverter.md | 32 ++++---- .../SchemaGrammarConverterBuiltinRule.md | 6 +- example/ios/.xcode.env.local | 2 +- 5 files changed, 112 insertions(+), 60 deletions(-) diff --git a/docs/API/README.md b/docs/API/README.md index a837766..c307fb1 100644 --- a/docs/API/README.md +++ b/docs/API/README.md @@ -63,7 +63,7 @@ llama.rn #### Defined in -[index.ts:84](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L84) +[index.ts:103](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L103) ___ @@ -73,7 +73,7 @@ ___ #### Defined in -[index.ts:75](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L75) +[index.ts:94](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L94) ___ @@ -83,7 +83,7 @@ ___ #### Defined in -[index.ts:64](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L64) +[index.ts:67](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L67) ___ @@ -93,7 +93,7 @@ ___ #### Defined in -[index.ts:73](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L73) +[index.ts:92](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L92) ___ @@ -138,7 +138,7 @@ ___ #### Defined in -[NativeRNLlama.ts:50](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L50) +[NativeRNLlama.ts:60](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L60) ___ @@ -164,7 +164,7 @@ ___ #### Defined in -[NativeRNLlama.ts:195](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L195) +[NativeRNLlama.ts:205](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L205) ___ @@ -187,7 +187,7 @@ ___ #### Defined in -[NativeRNLlama.ts:184](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L184) +[NativeRNLlama.ts:194](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L194) ___ @@ -204,7 +204,7 @@ ___ #### Defined in -[NativeRNLlama.ts:179](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L179) +[NativeRNLlama.ts:189](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L189) ___ @@ -221,7 +221,7 @@ ___ #### Defined in -[NativeRNLlama.ts:174](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L174) +[NativeRNLlama.ts:184](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L184) ___ @@ -239,8 +239,9 @@ ___ | `embedding?` | `boolean` | - | | `flash_attn?` | `boolean` | Enable flash attention, only recommended in GPU device (Experimental in llama.cpp) | | `is_model_asset?` | `boolean` | - | -| `lora?` | `string` | - | -| `lora_scaled?` | `number` | - | +| `lora?` | `string` | Single LoRA adapter path | +| `lora_list?` | { `path`: `string` ; `scaled?`: `number` }[] | LoRA adapter list | +| `lora_scaled?` | `number` | Single LoRA adapter scale | | `model` | `string` | - | | `n_batch?` | `number` | - | | `n_ctx?` | `number` | - | @@ -256,7 +257,7 @@ ___ #### Defined in -[NativeRNLlama.ts:8](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L8) +[NativeRNLlama.ts:8](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L8) ___ @@ -272,7 +273,7 @@ ___ #### Defined in -[NativeRNLlama.ts:4](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L4) +[NativeRNLlama.ts:4](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L4) ___ @@ -288,7 +289,7 @@ ___ #### Defined in -[NativeRNLlama.ts:215](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L215) +[NativeRNLlama.ts:225](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L225) ___ @@ -307,7 +308,7 @@ ___ #### Defined in -[NativeRNLlama.ts:219](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L219) +[NativeRNLlama.ts:229](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L229) ___ @@ -324,7 +325,7 @@ ___ #### Defined in -[NativeRNLlama.ts:226](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L226) +[NativeRNLlama.ts:236](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L236) ___ @@ -340,7 +341,7 @@ ___ #### Defined in -[NativeRNLlama.ts:211](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/NativeRNLlama.ts#L211) +[NativeRNLlama.ts:221](https://github.com/mybigday/llama.rn/blob/276a90a/src/NativeRNLlama.ts#L221) ___ @@ -356,7 +357,7 @@ ___ #### Defined in -[chat.ts:3](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/chat.ts#L3) +[chat.ts:3](https://github.com/mybigday/llama.rn/blob/276a90a/src/chat.ts#L3) ___ @@ -373,7 +374,7 @@ ___ #### Defined in -[chat.ts:7](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/chat.ts#L7) +[chat.ts:7](https://github.com/mybigday/llama.rn/blob/276a90a/src/chat.ts#L7) ___ @@ -390,7 +391,7 @@ ___ #### Defined in -[index.ts:54](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L54) +[index.ts:57](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L57) ## Functions @@ -414,7 +415,7 @@ ___ #### Defined in -[grammar.ts:826](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L826) +[grammar.ts:826](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L826) ___ @@ -435,7 +436,7 @@ ___ #### Defined in -[index.ts:251](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L251) +[index.ts:295](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L295) ___ @@ -455,7 +456,7 @@ ___ #### Defined in -[index.ts:236](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L236) +[index.ts:280](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L280) ___ @@ -469,7 +470,7 @@ ___ #### Defined in -[index.ts:301](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L301) +[index.ts:354](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L354) ___ @@ -489,4 +490,4 @@ ___ #### Defined in -[index.ts:222](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L222) +[index.ts:266](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L266) diff --git a/docs/API/classes/LlamaContext.md b/docs/API/classes/LlamaContext.md index 5265475..c6e0ea6 100644 --- a/docs/API/classes/LlamaContext.md +++ b/docs/API/classes/LlamaContext.md @@ -17,13 +17,16 @@ ### Methods +- [applyLoraAdapters](LlamaContext.md#applyloraadapters) - [bench](LlamaContext.md#bench) - [completion](LlamaContext.md#completion) - [detokenize](LlamaContext.md#detokenize) - [embedding](LlamaContext.md#embedding) - [getFormattedChat](LlamaContext.md#getformattedchat) +- [getLoadedLoraAdapters](LlamaContext.md#getloadedloraadapters) - [loadSession](LlamaContext.md#loadsession) - [release](LlamaContext.md#release) +- [removeLoraAdapters](LlamaContext.md#removeloraadapters) - [saveSession](LlamaContext.md#savesession) - [stopCompletion](LlamaContext.md#stopcompletion) - [tokenize](LlamaContext.md#tokenize) @@ -42,7 +45,7 @@ #### Defined in -[index.ts:105](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L105) +[index.ts:124](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L124) ## Properties @@ -52,7 +55,7 @@ #### Defined in -[index.ts:97](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L97) +[index.ts:116](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L116) ___ @@ -62,7 +65,7 @@ ___ #### Defined in -[index.ts:95](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L95) +[index.ts:114](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L114) ___ @@ -78,7 +81,7 @@ ___ #### Defined in -[index.ts:101](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L101) +[index.ts:120](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L120) ___ @@ -88,10 +91,30 @@ ___ #### Defined in -[index.ts:99](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L99) +[index.ts:118](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L118) ## Methods +### applyLoraAdapters + +▸ **applyLoraAdapters**(`loraList`): `Promise`<`void`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `loraList` | { `path`: `string` ; `scaled?`: `number` }[] | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[index.ts:239](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L239) + +___ + ### bench ▸ **bench**(`pp`, `tg`, `pl`, `nr`): `Promise`<[`BenchResult`](../README.md#benchresult)\> @@ -111,7 +134,7 @@ ___ #### Defined in -[index.ts:197](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L197) +[index.ts:219](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L219) ___ @@ -132,7 +155,7 @@ ___ #### Defined in -[index.ts:141](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L141) +[index.ts:160](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L160) ___ @@ -152,7 +175,7 @@ ___ #### Defined in -[index.ts:186](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L186) +[index.ts:208](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L208) ___ @@ -173,7 +196,7 @@ ___ #### Defined in -[index.ts:190](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L190) +[index.ts:212](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L212) ___ @@ -194,7 +217,21 @@ ___ #### Defined in -[index.ts:131](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L131) +[index.ts:150](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L150) + +___ + +### getLoadedLoraAdapters + +▸ **getLoadedLoraAdapters**(): `Promise`<{ `path`: `string` ; `scaled?`: `number` }[]\> + +#### Returns + +`Promise`<{ `path`: `string` ; `scaled?`: `number` }[]\> + +#### Defined in + +[index.ts:255](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L255) ___ @@ -216,7 +253,7 @@ Load cached prompt & completion state from a file. #### Defined in -[index.ts:115](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L115) +[index.ts:134](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L134) ___ @@ -230,7 +267,21 @@ ___ #### Defined in -[index.ts:217](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L217) +[index.ts:261](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L261) + +___ + +### removeLoraAdapters + +▸ **removeLoraAdapters**(): `Promise`<`void`\> + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[index.ts:251](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L251) ___ @@ -254,7 +305,7 @@ Save current cached prompt & completion state to a file. #### Defined in -[index.ts:124](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L124) +[index.ts:143](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L143) ___ @@ -268,7 +319,7 @@ ___ #### Defined in -[index.ts:178](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L178) +[index.ts:200](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L200) ___ @@ -288,4 +339,4 @@ ___ #### Defined in -[index.ts:182](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/index.ts#L182) +[index.ts:204](https://github.com/mybigday/llama.rn/blob/276a90a/src/index.ts#L204) diff --git a/docs/API/classes/SchemaGrammarConverter.md b/docs/API/classes/SchemaGrammarConverter.md index c3aa05f..0daa36b 100644 --- a/docs/API/classes/SchemaGrammarConverter.md +++ b/docs/API/classes/SchemaGrammarConverter.md @@ -46,7 +46,7 @@ #### Defined in -[grammar.ts:213](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L213) +[grammar.ts:213](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L213) ## Properties @@ -56,7 +56,7 @@ #### Defined in -[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L203) +[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L203) ___ @@ -66,7 +66,7 @@ ___ #### Defined in -[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L205) +[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L205) ___ @@ -76,7 +76,7 @@ ___ #### Defined in -[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L201) +[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L201) ___ @@ -90,7 +90,7 @@ ___ #### Defined in -[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L209) +[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L209) ___ @@ -100,7 +100,7 @@ ___ #### Defined in -[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L211) +[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L211) ___ @@ -114,7 +114,7 @@ ___ #### Defined in -[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L207) +[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L207) ## Methods @@ -135,7 +135,7 @@ ___ #### Defined in -[grammar.ts:695](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L695) +[grammar.ts:695](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L695) ___ @@ -156,7 +156,7 @@ ___ #### Defined in -[grammar.ts:226](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L226) +[grammar.ts:226](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L226) ___ @@ -179,7 +179,7 @@ ___ #### Defined in -[grammar.ts:712](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L712) +[grammar.ts:712](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L712) ___ @@ -200,7 +200,7 @@ ___ #### Defined in -[grammar.ts:314](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L314) +[grammar.ts:314](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L314) ___ @@ -220,7 +220,7 @@ ___ #### Defined in -[grammar.ts:520](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L520) +[grammar.ts:520](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L520) ___ @@ -241,7 +241,7 @@ ___ #### Defined in -[grammar.ts:325](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L325) +[grammar.ts:325](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L325) ___ @@ -255,7 +255,7 @@ ___ #### Defined in -[grammar.ts:815](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L815) +[grammar.ts:815](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L815) ___ @@ -276,7 +276,7 @@ ___ #### Defined in -[grammar.ts:249](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L249) +[grammar.ts:249](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L249) ___ @@ -297,4 +297,4 @@ ___ #### Defined in -[grammar.ts:531](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L531) +[grammar.ts:531](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L531) diff --git a/docs/API/classes/SchemaGrammarConverterBuiltinRule.md b/docs/API/classes/SchemaGrammarConverterBuiltinRule.md index b6b8afc..c758d7e 100644 --- a/docs/API/classes/SchemaGrammarConverterBuiltinRule.md +++ b/docs/API/classes/SchemaGrammarConverterBuiltinRule.md @@ -28,7 +28,7 @@ #### Defined in -[grammar.ts:82](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L82) +[grammar.ts:82](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L82) ## Properties @@ -38,7 +38,7 @@ #### Defined in -[grammar.ts:78](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L78) +[grammar.ts:78](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L78) ___ @@ -48,4 +48,4 @@ ___ #### Defined in -[grammar.ts:80](https://github.com/mybigday/llama.rn/blob/0c04b5e/src/grammar.ts#L80) +[grammar.ts:80](https://github.com/mybigday/llama.rn/blob/276a90a/src/grammar.ts#L80) diff --git a/example/ios/.xcode.env.local b/example/ios/.xcode.env.local index b261bc2..c1591b7 100644 --- a/example/ios/.xcode.env.local +++ b/example/ios/.xcode.env.local @@ -1 +1 @@ -export NODE_BINARY=/var/folders/4z/1d45cfts3936kdm7v9jl349r0000gn/T/yarn--1732160897686-0.7191373753799657/node +export NODE_BINARY=/var/folders/4z/1d45cfts3936kdm7v9jl349r0000gn/T/yarn--1732161826513-0.08689866324640905/node