@@ -1516,6 +1516,116 @@ describe.skip("InferenceClient", () => {
1516
1516
TIMEOUT
1517
1517
) ;
1518
1518
1519
+ describe . concurrent (
1520
+ "Scaleway" ,
1521
+ ( ) => {
1522
+ const client = new InferenceClient ( env . HF_SCALEWAY_KEY ?? "dummy" ) ;
1523
+
1524
+ HARDCODED_MODEL_INFERENCE_MAPPING . scaleway = {
1525
+ "meta-llama/Llama-3.1-8B-Instruct" : {
1526
+ provider : "scaleway" ,
1527
+ hfModelId : "meta-llama/Llama-3.1-8B-Instruct" ,
1528
+ providerId : "llama-3.1-8b-instruct" ,
1529
+ status : "live" ,
1530
+ task : "conversational" ,
1531
+ } ,
1532
+ "BAAI/bge-multilingual-gemma2" : {
1533
+ provider : "scaleway" ,
1534
+ hfModelId : "BAAI/bge-multilingual-gemma2" ,
1535
+ providerId : "bge-multilingual-gemma2" ,
1536
+ task : "feature-extraction" ,
1537
+ status : "live" ,
1538
+ } ,
1539
+ "google/gemma-3-27b-it" : {
1540
+ provider : "scaleway" ,
1541
+ hfModelId : "google/gemma-3-27b-it" ,
1542
+ providerId : "gemma-3-27b-it" ,
1543
+ task : "conversational" ,
1544
+ status : "live" ,
1545
+ } ,
1546
+ } ;
1547
+
1548
+ it ( "chatCompletion" , async ( ) => {
1549
+ const res = await client . chatCompletion ( {
1550
+ model : "meta-llama/Llama-3.1-8B-Instruct" ,
1551
+ provider : "scaleway" ,
1552
+ messages : [ { role : "user" , content : "Complete this sentence with words, one plus one is equal " } ] ,
1553
+ tool_choice : "none" ,
1554
+ } ) ;
1555
+ if ( res . choices && res . choices . length > 0 ) {
1556
+ const completion = res . choices [ 0 ] . message ?. content ;
1557
+ expect ( completion ) . toMatch ( / ( t o ) ? ( t w o | 2 ) / i) ;
1558
+ }
1559
+ } ) ;
1560
+
1561
+ it ( "chatCompletion stream" , async ( ) => {
1562
+ const stream = client . chatCompletionStream ( {
1563
+ model : "meta-llama/Llama-3.1-8B-Instruct" ,
1564
+ provider : "scaleway" ,
1565
+ messages : [ { role : "system" , content : "Complete the equation 1 + 1 = , just the answer" } ] ,
1566
+ } ) as AsyncGenerator < ChatCompletionStreamOutput > ;
1567
+ let out = "" ;
1568
+ for await ( const chunk of stream ) {
1569
+ if ( chunk . choices && chunk . choices . length > 0 ) {
1570
+ out += chunk . choices [ 0 ] . delta . content ;
1571
+ }
1572
+ }
1573
+ expect ( out ) . toMatch ( / ( t w o | 2 ) / i) ;
1574
+ } ) ;
1575
+
1576
+ it ( "chatCompletion multimodal" , async ( ) => {
1577
+ const res = await client . chatCompletion ( {
1578
+ model : "google/gemma-3-27b-it" ,
1579
+ provider : "scaleway" ,
1580
+ messages : [
1581
+ {
1582
+ role : "user" ,
1583
+ content : [
1584
+ {
1585
+ type : "image_url" ,
1586
+ image_url : {
1587
+ url : "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" ,
1588
+ } ,
1589
+ } ,
1590
+ { type : "text" , text : "What is this?" } ,
1591
+ ] ,
1592
+ } ,
1593
+ ] ,
1594
+ } ) ;
1595
+ expect ( res . choices ) . toBeDefined ( ) ;
1596
+ expect ( res . choices ?. length ) . toBeGreaterThan ( 0 ) ;
1597
+ expect ( res . choices ?. [ 0 ] . message ?. content ) . toContain ( "Statue of Liberty" ) ;
1598
+ } ) ;
1599
+
1600
+ it ( "textGeneration" , async ( ) => {
1601
+ const res = await client . textGeneration ( {
1602
+ model : "meta-llama/Llama-3.1-8B-Instruct" ,
1603
+ provider : "scaleway" ,
1604
+ inputs : "Once upon a time," ,
1605
+ temperature : 0 ,
1606
+ max_tokens : 19 ,
1607
+ } ) ;
1608
+
1609
+ expect ( res ) . toMatchObject ( {
1610
+ generated_text :
1611
+ " in a small village nestled in the rolling hills of the countryside, there lived a young girl named" ,
1612
+ } ) ;
1613
+ } ) ;
1614
+
1615
+ it ( "featureExtraction" , async ( ) => {
1616
+ const res = await client . featureExtraction ( {
1617
+ model : "BAAI/bge-multilingual-gemma2" ,
1618
+ provider : "scaleway" ,
1619
+ inputs : "That is a happy person" ,
1620
+ } ) ;
1621
+
1622
+ expect ( res ) . toBeInstanceOf ( Array ) ;
1623
+ expect ( res [ 0 ] ) . toEqual ( expect . arrayContaining ( [ expect . any ( Number ) ] ) ) ;
1624
+ } ) ;
1625
+ } ,
1626
+ TIMEOUT
1627
+ ) ;
1628
+
1519
1629
describe . concurrent ( "3rd party providers" , ( ) => {
1520
1630
it ( "chatCompletion - fails with unsupported model" , async ( ) => {
1521
1631
expect (
0 commit comments