@@ -1166,4 +1166,52 @@ describe.concurrent("HfInference", () => {
11661166 } ,
11671167 TIMEOUT
11681168 ) ;
1169+
1170+ describe . concurrent (
1171+ "Novita" ,
1172+ ( ) => {
1173+ const client = new HfInference ( env . HF_NOVITA_KEY ) ;
1174+
1175+ HARDCODED_MODEL_ID_MAPPING [ "novita" ] = {
1176+ "meta-llama/llama-3.1-8b-instruct" : "meta-llama/llama-3.1-8b-instruct" ,
1177+ "deepseek/deepseek-r1-distill-qwen-14b" : "deepseek/deepseek-r1-distill-qwen-14b" ,
1178+ } ;
1179+
1180+ it ( "chatCompletion" , async ( ) => {
1181+ const res = await client . chatCompletion ( {
1182+ model : "meta-llama/llama-3.1-8b-instruct" ,
1183+ provider : "novita" ,
1184+ messages : [ { role : "user" , content : "Complete this sentence with words, one plus one is equal " } ] ,
1185+ } ) ;
1186+ if ( res . choices && res . choices . length > 0 ) {
1187+ const completion = res . choices [ 0 ] . message ?. content ;
1188+ expect ( completion ) . toContain ( "two" ) ;
1189+ }
1190+ } ) ;
1191+
1192+ it ( "chatCompletion stream" , async ( ) => {
1193+ const stream = client . chatCompletionStream ( {
1194+ model : "deepseek/deepseek-r1-distill-qwen-14b" ,
1195+ provider : "novita" ,
1196+ messages : [ { role : "user" , content : "Say this is a test" } ] ,
1197+ stream : true ,
1198+ } ) as AsyncGenerator < ChatCompletionStreamOutput > ;
1199+
1200+ let fullResponse = "" ;
1201+ for await ( const chunk of stream ) {
1202+ if ( chunk . choices && chunk . choices . length > 0 ) {
1203+ const content = chunk . choices [ 0 ] . delta ?. content ;
1204+ if ( content ) {
1205+ fullResponse += content ;
1206+ }
1207+ }
1208+ }
1209+
1210+ // Verify we got a meaningful response
1211+ expect ( fullResponse ) . toBeTruthy ( ) ;
1212+ expect ( fullResponse . length ) . toBeGreaterThan ( 0 ) ;
1213+ } ) ;
1214+ } ,
1215+ TIMEOUT
1216+ ) ;
11691217} ) ;
0 commit comments