File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ import {
1111 View ,
1212} from 'react-native' ;
1313import SendIcon from '../../assets/icons/send_icon.svg' ;
14- import { useLLM , LLAMA3_2_1B_SPINQUANT } from 'react-native-executorch' ;
14+ import {
15+ useLLM ,
16+ LLAMA3_2_1B_SPINQUANT ,
17+ SlidingWindowContextStrategy ,
18+ } from 'react-native-executorch' ;
1519import PauseIcon from '../../assets/icons/pause_icon.svg' ;
1620import ColorPalette from '../../colors' ;
1721import Messages from '../../components/Messages' ;
@@ -32,6 +36,15 @@ function LLMScreen() {
3236
3337 const llm = useLLM ( { model : LLAMA3_2_1B_SPINQUANT } ) ;
3438
39+ useEffect ( ( ) => {
40+ llm . configure ( {
41+ chatConfig : {
42+ contextStrategy : new SlidingWindowContextStrategy ( 2048 , 512 ) ,
43+ } ,
44+ } ) ;
45+ // eslint-disable-next-line react-hooks/exhaustive-deps
46+ } , [ ] ) ;
47+
3548 useEffect ( ( ) => {
3649 if ( llm . error ) {
3750 console . log ( 'LLM error:' , llm . error ) ;
You can’t perform that action at this time.
0 commit comments