@@ -884,6 +884,69 @@ describe.concurrent("InferenceClient", () => {
884884 TIMEOUT
885885 ) ;
886886
887+ describe . concurrent (
888+ "Featherless" ,
889+ ( ) => {
890+ HARDCODED_MODEL_ID_MAPPING [ 'featherless-ai' ] = {
891+ "meta-llama/Llama-3.1-8B" : "meta-llama/Meta-Llama-3.1-8B" ,
892+ "meta-llama/Llama-3.1-8B-Instruct" : "meta-llama/Meta-Llama-3.1-8B-Instruct" ,
893+ } ;
894+
895+ it ( "chatCompletion" , async ( ) => {
896+ const res = await chatCompletion ( {
897+ accessToken : env . HF_FEATHERLESS_KEY ?? "dummy" ,
898+ model : "meta-llama/Llama-3.1-8B-Instruct" ,
899+ provider : "featherless-ai" ,
900+ messages : [ { role : "user" , content : "Complete this sentence with words, one plus one is equal " } ] ,
901+ temperature : 0.1 ,
902+ } ) ;
903+
904+ expect ( res ) . toBeDefined ( ) ;
905+ expect ( res . choices ) . toBeDefined ( ) ;
906+ expect ( res . choices ?. length ) . toBeGreaterThan ( 0 ) ;
907+
908+ if ( res . choices && res . choices . length > 0 ) {
909+ const completion = res . choices [ 0 ] . message ?. content ;
910+ expect ( completion ) . toBeDefined ( ) ;
911+ expect ( typeof completion ) . toBe ( "string" ) ;
912+ expect ( completion ) . toContain ( "two" ) ;
913+ }
914+ } ) ;
915+
916+ it ( "chatCompletion stream" , async ( ) => {
917+ const stream = chatCompletionStream ( {
918+ accessToken : env . HF_FEATHERLESS_KEY ?? "dummy" ,
919+ model : "meta-llama/Llama-3.1-8B-Instruct" ,
920+ provider : "featherless-ai" ,
921+ messages : [ { role : "user" , content : "Complete the equation 1 + 1 = , just the answer" } ] ,
922+ } ) as AsyncGenerator < ChatCompletionStreamOutput > ;
923+ let out = "" ;
924+ for await ( const chunk of stream ) {
925+ if ( chunk . choices && chunk . choices . length > 0 ) {
926+ out += chunk . choices [ 0 ] . delta . content ;
927+ }
928+ }
929+ expect ( out ) . toContain ( "2" ) ;
930+ } ) ;
931+
932+ it ( "textGeneration" , async ( ) => {
933+ const res = await textGeneration ( {
934+ accessToken : env . HF_FEATHERLESS_KEY ?? "dummy" ,
935+ model : "meta-llama/Llama-3.1-8B" ,
936+ provider : "featherless-ai" ,
937+ inputs : "Paris is" ,
938+ parameters : {
939+ temperature : 0 ,
940+ top_p : 0.01 ,
941+ max_tokens : 10 ,
942+ } ,
943+ } ) ;
944+ expect ( res ) . toMatchObject ( { generated_text : " a city of romance, art, and culture." } ) ;
945+ } ) ;
946+ } ,
947+ TIMEOUT
948+ ) ;
949+
887950 describe . concurrent (
888951 "Replicate" ,
889952 ( ) => {
0 commit comments