@@ -83,10 +83,9 @@ describe.skip("text generation", async () => {
8383 let testPass = false ;
8484 // console.log(textStream);
8585
86- for await ( const chunk of readStream . setEncoding ( "utf8" ) ) {
87- // console.log({ chunk });
86+ for await ( const tokens of readStream ) {
8887 if ( testPass === false ) {
89- testPass = typeof chunk === "string" ;
88+ testPass = typeof tokens === "string" ;
9089 assert ( testPass , "streams output" ) ;
9190 }
9291 }
@@ -95,9 +94,9 @@ describe.skip("text generation", async () => {
9594
9695 testPass = false ;
9796
98- for await ( const chunk of readStream . setEncoding ( "utf8" ) ) {
97+ for await ( const tokens of readStream ) {
9998 if ( testPass === false ) {
100- testPass = typeof chunk === "string" ;
99+ testPass = typeof tokens === "string" ;
101100 assert ( testPass , "streams output" ) ;
102101 }
103102 }
@@ -107,13 +106,13 @@ describe.skip("text generation", async () => {
107106 const browserClient = new Bytez ( process . env . BYTEZ_KEY ?? "" , true , true ) ;
108107 const model = browserClient . model ( "openai-community/gpt2" ) ;
109108 const readStream = await model . run ( "Jack and jill" , true ) ;
110- const textStream = readStream . pipeThrough ( new TextDecoderStream ( ) ) ;
109+
111110 let testPass = false ;
112111
113- for await ( const chunk of textStream ) {
114- // console.log({ chunk });
112+ for await ( const tokens of readStream ) {
113+ // console.log({ tokens });
115114 if ( testPass === false ) {
116- testPass = typeof chunk === "string" ;
115+ testPass = typeof tokens === "string" ;
117116
118117 assert ( testPass , "streams output" ) ;
119118 }
0 commit comments