@@ -34,11 +34,11 @@ describe("llama 3.2", () => {
3434 res1 ,
3535 res2
3636 ] = await Promise . all ( [
37- chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 20 } ) ,
38- chatSession2 . prompt ( "Remember: giraffes are not elephants" , { maxTokens : 20 } )
37+ chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 6 } ) ,
38+ chatSession2 . prompt ( "Remember: giraffes are not elephants" , { maxTokens : 5 } )
3939 ] ) ;
40- expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase. It's often used to emphasize that locks are a separate component from doors \"" ) ;
41- expect ( res2 ) . to . toMatchInlineSnapshot ( '"I appreciate the reminder. Yes, you are correct. Giraffes and elephants are two distinct and "' ) ;
40+ expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase.\"" ) ;
41+ expect ( res2 ) . to . toMatchInlineSnapshot ( '"I appreciate the reminder."' ) ;
4242
4343
4444 const stateFile1Path = await getTempTestFilePath ( "state1" ) ;
@@ -47,8 +47,8 @@ describe("llama 3.2", () => {
4747 test . onTestFinished ( ( ) => fs . remove ( stateFile1Path ) ) ;
4848
4949 expect ( contextSequence1 . contextTokens ) . to . eql ( state1Tokens ) ;
50- expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( ) ;
51- expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"13.02MB "' ) ;
50+ expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "105" ) ;
51+ expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"11.49MB "' ) ;
5252
5353
5454 const stateFile2Path = await getTempTestFilePath ( "state2" ) ;
@@ -57,8 +57,8 @@ describe("llama 3.2", () => {
5757 test . onTestFinished ( ( ) => fs . remove ( stateFile2Path ) ) ;
5858
5959 expect ( contextSequence2 . contextTokens ) . to . eql ( state2Tokens ) ;
60- expect ( contextSequence2 . contextTokens . length ) . toMatchInlineSnapshot ( ) ;
61- expect ( toBytes ( ( await fs . stat ( stateFile2Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"13.24MB "' ) ;
60+ expect ( contextSequence2 . contextTokens . length ) . toMatchInlineSnapshot ( "106" ) ;
61+ expect ( toBytes ( ( await fs . stat ( stateFile2Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"11.6MB "' ) ;
6262
6363
6464 await contextSequence1 . clearHistory ( ) ;
@@ -68,15 +68,15 @@ describe("llama 3.2", () => {
6868 expect ( contextSequence1TokensState1 ) . toMatchInlineSnapshot ( `
6969 {
7070 "usedInputTokens": 99,
71- "usedOutputTokens": 20 ,
71+ "usedOutputTokens": 6 ,
7272 }
7373 ` ) ;
7474
7575 const chatSession1_1 = new LlamaChatSession ( {
7676 contextSequence : contextSequence1
7777 } ) ;
78- const res1_1 = await chatSession1_1 . prompt ( "What did I tell you to remember?" , { maxTokens : 20 } ) ;
79- expect ( res1_1 ) . to . toMatchInlineSnapshot ( "\"You didn't tell me to remember anything. This is the beginning of our conversation, and I'm \"" ) ;
78+ const res1_1 = await chatSession1_1 . prompt ( "What did I tell you to remember?" , { maxTokens : 12 } ) ;
79+ expect ( res1_1 ) . to . toMatchInlineSnapshot ( "\"You didn't tell me to remember anything. This is the\"" ) ;
8080
8181 await contextSequence1 . clearHistory ( ) ;
8282 const contextSequence1TokensState2 = contextSequence1 . tokenMeter . getState ( ) ;
@@ -85,13 +85,13 @@ describe("llama 3.2", () => {
8585 expect ( TokenMeter . diff ( contextSequence1TokensState2 , contextSequence1TokensState1 ) ) . toMatchInlineSnapshot ( `
8686 {
8787 "usedInputTokens": 101,
88- "usedOutputTokens": 20 ,
88+ "usedOutputTokens": 12 ,
8989 }
9090 ` ) ;
9191
9292 await contextSequence1 . loadStateFromFile ( stateFile1Path , { acceptRisk : true } ) ;
9393 expect ( contextSequence1 . contextTokens ) . to . eql ( state1Tokens ) ;
94- expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( ) ;
94+ expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "105" ) ;
9595
9696 const contextSequence1TokensState3 = contextSequence1 . tokenMeter . getState ( ) ;
9797 expect ( TokenMeter . diff ( contextSequence1TokensState3 , contextSequence1TokensState2 ) ) . toMatchInlineSnapshot ( `
@@ -105,7 +105,7 @@ describe("llama 3.2", () => {
105105 contextSequence : contextSequence1
106106 } ) ;
107107 chatSession1_2 . setChatHistory ( chatSession1 . getChatHistory ( ) ) ;
108- const res1_2 = await chatSession1_2 . prompt ( "What did I tell you to remember?" , { maxTokens : 20 } ) ;
108+ const res1_2 = await chatSession1_2 . prompt ( "What did I tell you to remember?" , { maxTokens : 12 } ) ;
109109 const contextSequence1TokensState4 = contextSequence1 . tokenMeter . getState ( ) ;
110110
111111 expect ( res1_2 ) . to . toMatchInlineSnapshot ( '"You told me to remember that "locks are not doors"."' ) ;
@@ -114,7 +114,7 @@ describe("llama 3.2", () => {
114114 expect ( contextSequence1TokensState4Diff ) . toMatchInlineSnapshot ( `
115115 {
116116 "usedInputTokens": 18,
117- "usedOutputTokens": 13 ,
117+ "usedOutputTokens": 12 ,
118118 }
119119 ` ) ;
120120 } ) ;
@@ -139,8 +139,8 @@ describe("llama 3.2", () => {
139139 contextSequence : contextSequence1
140140 } ) ;
141141
142- const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 20 } ) ;
143- expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase. It's often used to emphasize that locks are a separate component from doors \"" ) ;
142+ const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 6 } ) ;
143+ expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase.\"" ) ;
144144
145145
146146 const stateFile1Path = await getTempTestFilePath ( "state1" ) ;
@@ -150,12 +150,12 @@ describe("llama 3.2", () => {
150150 const contextSequence1TokensState = contextSequence1 . tokenMeter . getState ( ) ;
151151
152152 expect ( contextSequence1 . contextTokens ) . to . eql ( state1Tokens ) ;
153- expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "119 " ) ;
154- expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"13.02MB "' ) ;
153+ expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "105 " ) ;
154+ expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"11.49MB "' ) ;
155155 expect ( contextSequence1TokensState ) . to . toMatchInlineSnapshot ( `
156156 {
157157 "usedInputTokens": 99,
158- "usedOutputTokens": 20 ,
158+ "usedOutputTokens": 6 ,
159159 }
160160 ` ) ;
161161
@@ -168,14 +168,14 @@ describe("llama 3.2", () => {
168168 chatSession2 . setChatHistory ( chatSession1 . getChatHistory ( ) ) ;
169169 await contextSequence2 . loadStateFromFile ( stateFile1Path , { acceptRisk : true } ) ;
170170
171- const res2 = await chatSession2 . prompt ( "What did I tell you to remember?" , { maxTokens : 20 } ) ;
171+ const res2 = await chatSession2 . prompt ( "What did I tell you to remember?" , { maxTokens : 12 } ) ;
172172 expect ( res2 ) . to . toMatchInlineSnapshot ( '"You told me to remember that "locks are not doors"."' ) ;
173173 const contextSequence2TokensState = contextSequence2 . tokenMeter . getState ( ) ;
174174 expect ( contextSequence2TokensState . usedInputTokens ) . to . be . lessThan ( contextSequence1TokensState . usedInputTokens ) ;
175175 expect ( contextSequence2TokensState ) . toMatchInlineSnapshot ( `
176176 {
177177 "usedInputTokens": 18,
178- "usedOutputTokens": 13 ,
178+ "usedOutputTokens": 12 ,
179179 }
180180 ` ) ;
181181 } ) ;
@@ -200,8 +200,8 @@ describe("llama 3.2", () => {
200200 contextSequence : contextSequence1
201201 } ) ;
202202
203- const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 20 } ) ;
204- expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase. It's often used to emphasize that locks are a separate component from doors \"" ) ;
203+ const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 6 } ) ;
204+ expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase.\"" ) ;
205205
206206
207207 const stateFile1Path = await getTempTestFilePath ( "state1" ) ;
@@ -211,12 +211,12 @@ describe("llama 3.2", () => {
211211 const contextSequence1TokensState = contextSequence1 . tokenMeter . getState ( ) ;
212212
213213 expect ( contextSequence1 . contextTokens ) . to . eql ( state1Tokens ) ;
214- expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "119 " ) ;
215- expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"13.02MB "' ) ;
214+ expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "105 " ) ;
215+ expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"11.49MB "' ) ;
216216 expect ( contextSequence1TokensState ) . to . toMatchInlineSnapshot ( `
217217 {
218218 "usedInputTokens": 99,
219- "usedOutputTokens": 20 ,
219+ "usedOutputTokens": 6 ,
220220 }
221221 ` ) ;
222222
@@ -258,8 +258,8 @@ describe("llama 3.2", () => {
258258 contextSequence : contextSequence1
259259 } ) ;
260260
261- const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 20 } ) ;
262- expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase. It's often used to emphasize that locks are a separate component from doors \"" ) ;
261+ const res1 = await chatSession1 . prompt ( "Remember: locks are not doors" , { maxTokens : 6 } ) ;
262+ expect ( res1 ) . to . toMatchInlineSnapshot ( "\"That's a clever phrase.\"" ) ;
263263
264264
265265 const stateFile1Path = await getTempTestFilePath ( "state1" ) ;
@@ -269,12 +269,12 @@ describe("llama 3.2", () => {
269269 const contextSequence1TokensState = contextSequence1 . tokenMeter . getState ( ) ;
270270
271271 expect ( contextSequence1 . contextTokens ) . to . eql ( state1Tokens ) ;
272- expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "119 " ) ;
273- expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"13.02MB "' ) ;
272+ expect ( contextSequence1 . contextTokens . length ) . toMatchInlineSnapshot ( "105 " ) ;
273+ expect ( toBytes ( ( await fs . stat ( stateFile1Path ) ) . size ) ) . to . toMatchInlineSnapshot ( '"11.49MB "' ) ;
274274 expect ( contextSequence1TokensState ) . to . toMatchInlineSnapshot ( `
275275 {
276276 "usedInputTokens": 99,
277- "usedOutputTokens": 20 ,
277+ "usedOutputTokens": 6 ,
278278 }
279279 ` ) ;
280280
0 commit comments