@@ -2,7 +2,7 @@ import { expect, it, describe, assert } from "vitest";
22
33import type { ChatCompletionStreamOutput } from "@huggingface/tasks" ;
44
5- import { chatCompletion , HfInference } from "../src" ;
5+ import { chatCompletion , FAL_AI_SUPPORTED_MODEL_IDS , HfInference } from "../src" ;
66import "./vcr" ;
77import { readTestFile } from "./test-files" ;
88
@@ -775,25 +775,30 @@ describe.concurrent("HfInference", () => {
775775 ( ) => {
776776 const client = new HfInference ( env . HF_FAL_KEY ) ;
777777
778- it ( "textToImage" , async ( ) => {
779- const res = await client . textToImage ( {
780- model : "black-forest-labs/FLUX.1-schnell" ,
781- provider : "fal-ai" ,
782- inputs : "black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot" ,
778+ for ( const model of Object . keys ( FAL_AI_SUPPORTED_MODEL_IDS [ "text-to-image" ] ?? { } ) ) {
779+ it ( `textToImage - ${ model } ` , async ( ) => {
780+ const res = await client . textToImage ( {
781+ model,
782+ provider : "fal-ai" ,
783+ inputs :
784+ "Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth." ,
785+ } ) ;
786+ expect ( res ) . toBeInstanceOf ( Blob ) ;
783787 } ) ;
784- expect ( res ) . toBeInstanceOf ( Blob ) ;
785- } ) ;
788+ }
786789
787- it ( "speechToText" , async ( ) => {
788- const res = await client . automaticSpeechRecognition ( {
789- model : "openai/whisper-large-v3" ,
790- provider : "fal-ai" ,
791- data : new Blob ( [ readTestFile ( "sample2.wav" ) ] , { type : "audio/x-wav" } ) ,
792- } ) ;
793- expect ( res ) . toMatchObject ( {
794- text : " he has grave doubts whether sir frederick leighton's work is really greek after all and can discover in it but little of rocky ithaca" ,
790+ for ( const model of Object . keys ( FAL_AI_SUPPORTED_MODEL_IDS [ "automatic-speech-recognition" ] ?? { } ) ) {
791+ it ( `automaticSpeechRecognition - ${ model } ` , async ( ) => {
792+ const res = await client . automaticSpeechRecognition ( {
793+ model : model ,
794+ provider : "fal-ai" ,
795+ data : new Blob ( [ readTestFile ( "sample2.wav" ) ] , { type : "audio/x-wav" } ) ,
796+ } ) ;
797+ expect ( res ) . toMatchObject ( {
798+ text : " he has grave doubts whether sir frederick leighton's work is really greek after all and can discover in it but little of rocky ithaca" ,
799+ } ) ;
795800 } ) ;
796- } ) ;
801+ }
797802 } ,
798803 TIMEOUT
799804 ) ;
0 commit comments