Skip to content

Commit

Permalink
feat(ts): expose template for getFormattedChat
Browse files Browse the repository at this point in the history
closes #84
  • Loading branch information
jhen0409 committed Nov 16, 2024
1 parent 38fa660 commit c473995
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 49 deletions.
22 changes: 11 additions & 11 deletions docs/API/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ llama.rn

#### Defined in

[index.ts:57](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L57)
[index.ts:58](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L58)

___

### CompletionParams

Ƭ **CompletionParams**: `Omit`<`NativeCompletionParams`, ``"emit_partial_completion"`` \| ``"prompt"``\> & { `messages?`: `RNLlamaOAICompatibleMessage`[] ; `prompt?`: `string` }
Ƭ **CompletionParams**: `Omit`<`NativeCompletionParams`, ``"emit_partial_completion"`` \| ``"prompt"``\> & { `chatTemplate?`: `string` ; `messages?`: `RNLlamaOAICompatibleMessage`[] ; `prompt?`: `string` }

#### Defined in

[index.ts:49](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L49)
[index.ts:49](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L49)

___

Expand All @@ -65,7 +65,7 @@ ___

#### Defined in

[index.ts:43](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L43)
[index.ts:43](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L43)

___

Expand All @@ -75,7 +75,7 @@ ___

#### Defined in

[index.ts:47](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L47)
[index.ts:47](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L47)

___

Expand All @@ -92,7 +92,7 @@ ___

#### Defined in

[index.ts:33](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L33)
[index.ts:33](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L33)

## Functions

Expand All @@ -116,7 +116,7 @@ ___

#### Defined in

[grammar.ts:824](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L824)
[grammar.ts:824](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L824)

___

Expand All @@ -137,7 +137,7 @@ ___

#### Defined in

[index.ts:225](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L225)
[index.ts:225](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L225)

___

Expand All @@ -157,7 +157,7 @@ ___

#### Defined in

[index.ts:210](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L210)
[index.ts:210](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L210)

___

Expand All @@ -171,7 +171,7 @@ ___

#### Defined in

[index.ts:269](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L269)
[index.ts:275](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L275)

___

Expand All @@ -191,4 +191,4 @@ ___

#### Defined in

[index.ts:196](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L196)
[index.ts:196](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L196)
33 changes: 17 additions & 16 deletions docs/API/classes/LlamaContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#### Defined in

[index.ts:78](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L78)
[index.ts:79](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L79)

## Properties

Expand All @@ -52,7 +52,7 @@

#### Defined in

[index.ts:70](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L70)
[index.ts:71](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L71)

___

Expand All @@ -62,7 +62,7 @@ ___

#### Defined in

[index.ts:68](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L68)
[index.ts:69](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L69)

___

Expand All @@ -78,7 +78,7 @@ ___

#### Defined in

[index.ts:74](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L74)
[index.ts:75](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L75)

___

Expand All @@ -88,7 +88,7 @@ ___

#### Defined in

[index.ts:72](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L72)
[index.ts:73](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L73)

## Methods

Expand All @@ -111,7 +111,7 @@ ___

#### Defined in

[index.ts:171](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L171)
[index.ts:171](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L171)

___

Expand All @@ -132,7 +132,7 @@ ___

#### Defined in

[index.ts:115](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L115)
[index.ts:115](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L115)

___

Expand All @@ -152,7 +152,7 @@ ___

#### Defined in

[index.ts:160](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L160)
[index.ts:160](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L160)

___

Expand All @@ -173,27 +173,28 @@ ___

#### Defined in

[index.ts:164](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L164)
[index.ts:164](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L164)

___

### getFormattedChat

**getFormattedChat**(`messages`): `Promise`<`string`\>
**getFormattedChat**(`messages`, `template?`): `Promise`<`string`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `messages` | `RNLlamaOAICompatibleMessage`[] |
| `template?` | `string` |

#### Returns

`Promise`<`string`\>

#### Defined in

[index.ts:104](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L104)
[index.ts:105](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L105)

___

Expand All @@ -215,7 +216,7 @@ Load cached prompt & completion state from a file.

#### Defined in

[index.ts:88](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L88)
[index.ts:89](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L89)

___

Expand All @@ -229,7 +230,7 @@ ___

#### Defined in

[index.ts:191](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L191)
[index.ts:191](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L191)

___

Expand All @@ -253,7 +254,7 @@ Save current cached prompt & completion state to a file.

#### Defined in

[index.ts:97](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L97)
[index.ts:98](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L98)

___

Expand All @@ -267,7 +268,7 @@ ___

#### Defined in

[index.ts:152](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L152)
[index.ts:152](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L152)

___

Expand All @@ -287,4 +288,4 @@ ___

#### Defined in

[index.ts:156](https://github.com/mybigday/llama.rn/blob/20a1819/src/index.ts#L156)
[index.ts:156](https://github.com/mybigday/llama.rn/blob/38fa660/src/index.ts#L156)
32 changes: 16 additions & 16 deletions docs/API/classes/SchemaGrammarConverter.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#### Defined in

[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L211)
[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L211)

## Properties

Expand All @@ -56,7 +56,7 @@

#### Defined in

[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L201)
[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L201)

___

Expand All @@ -66,7 +66,7 @@ ___

#### Defined in

[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L203)
[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L203)

___

Expand All @@ -76,7 +76,7 @@ ___

#### Defined in

[grammar.ts:199](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L199)
[grammar.ts:199](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L199)

___

Expand All @@ -90,7 +90,7 @@ ___

#### Defined in

[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L207)
[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L207)

___

Expand All @@ -100,7 +100,7 @@ ___

#### Defined in

[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L209)
[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L209)

___

Expand All @@ -114,7 +114,7 @@ ___

#### Defined in

[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L205)
[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L205)

## Methods

Expand All @@ -135,7 +135,7 @@ ___

#### Defined in

[grammar.ts:693](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L693)
[grammar.ts:693](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L693)

___

Expand All @@ -156,7 +156,7 @@ ___

#### Defined in

[grammar.ts:224](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L224)
[grammar.ts:224](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L224)

___

Expand All @@ -179,7 +179,7 @@ ___

#### Defined in

[grammar.ts:710](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L710)
[grammar.ts:710](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L710)

___

Expand All @@ -200,7 +200,7 @@ ___

#### Defined in

[grammar.ts:312](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L312)
[grammar.ts:312](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L312)

___

Expand All @@ -220,7 +220,7 @@ ___

#### Defined in

[grammar.ts:518](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L518)
[grammar.ts:518](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L518)

___

Expand All @@ -241,7 +241,7 @@ ___

#### Defined in

[grammar.ts:323](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L323)
[grammar.ts:323](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L323)

___

Expand All @@ -255,7 +255,7 @@ ___

#### Defined in

[grammar.ts:813](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L813)
[grammar.ts:813](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L813)

___

Expand All @@ -276,7 +276,7 @@ ___

#### Defined in

[grammar.ts:247](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L247)
[grammar.ts:247](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L247)

___

Expand All @@ -297,4 +297,4 @@ ___

#### Defined in

[grammar.ts:529](https://github.com/mybigday/llama.rn/blob/20a1819/src/grammar.ts#L529)
[grammar.ts:529](https://github.com/mybigday/llama.rn/blob/38fa660/src/grammar.ts#L529)
1 change: 1 addition & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default function App() {
model: file.uri,
use_mlock: true,
n_gpu_layers: Platform.OS === 'ios' ? 0 : 0, // > 0: enable GPU
lora: '/Users/jhen/Library/Containers/6A136561-8ED9-4BEF-A7BD-E39F19C67FA1/Data/tmp/org.reactjs.native.example.RNLlamaExample-Inbox/lora-Llama-3-Instruct-abliteration-LoRA-8B-f16.gguf',
// embedding: true,
},
(progress) => {
Expand Down
Loading

0 comments on commit c473995

Please sign in to comment.