in packages/inference/src/providers/hf-inference.ts [244:269]
override async getResponse(response: AudioToAudioOutput[]): Promise<AudioToAudioOutput[]> {
if (!Array.isArray(response)) {
throw new InferenceClientProviderOutputError(
"Received malformed response from HF-Inference audio-to-audio API: expected Array"
);
}
if (
!response.every((elem): elem is AudioToAudioOutput => {
return (
typeof elem === "object" &&
elem &&
"label" in elem &&
typeof elem.label === "string" &&
"content-type" in elem &&
typeof elem["content-type"] === "string" &&
"blob" in elem &&
typeof elem.blob === "string"
);
})
) {
throw new InferenceClientProviderOutputError(
"Received malformed response from HF-Inference audio-to-audio API: expected Array<{label: string, audio: Blob}>"
);
}
return response;
}