@huggingface/inference
Version:
Typescript client for the Hugging Face Inference Providers and Inference Endpoints
81 lines • 3.29 kB
TypeScript
/**
* See the registered mapping of HF model ID => DeepInfra model ID here:
*
* https://huggingface.co/api/partners/deepinfra/models
*
* This is a publicly available mapping.
*
* If you want to try to run inference for a new model locally before
it's registered on huggingface.co,
* you can add it to the dictionary "HARDCODED_MODEL_ID_MAPPING" in
consts.ts, for dev purposes.
*
* - If you work at DeepInfra and want to update this mapping, please
use the model mapping API we provide on huggingface.co
* - If you're a community member and want to add a new supported HF
model to DeepInfra, please open an issue on the present repo
* and we will tag DeepInfra team members.
*
* Thanks!
*/
import type { AutomaticSpeechRecognitionOutput, FeatureExtractionOutput, TextGenerationOutput } from "@huggingface/tasks";
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
import type { BodyParams, RequestArgs } from "../types.js";
import { type AutomaticSpeechRecognitionTaskHelper, BaseConversationalTask, BaseTextGenerationTask, type FeatureExtractionTaskHelper, TaskProviderHelper, type TextToSpeechTaskHelper } from "./providerHelper.js";
interface DeepInfraCompletionChoice {
text?: string;
}
interface DeepInfraCompletionResponse {
choices: DeepInfraCompletionChoice[];
model: string;
}
interface DeepInfraAudioTranscriptionSegment {
start: number;
end: number;
text: string;
}
interface DeepInfraAudioTranscriptionResponse {
text: string;
segments?: DeepInfraAudioTranscriptionSegment[];
}
interface DeepInfraEmbeddingsResponse {
data: Array<{
embedding: number[];
index: number;
object: string;
}>;
model: string;
object: string;
}
export declare class DeepInfraConversationalTask extends BaseConversationalTask {
constructor();
makeRoute(): string;
}
export declare class DeepInfraTextGenerationTask extends BaseTextGenerationTask {
constructor();
makeRoute(): string;
preparePayload(params: BodyParams): Record<string, unknown>;
getResponse(response: DeepInfraCompletionResponse): Promise<TextGenerationOutput>;
}
export declare class DeepInfraAutomaticSpeechRecognitionTask extends TaskProviderHelper implements AutomaticSpeechRecognitionTaskHelper {
constructor();
makeRoute(): string;
preparePayload(params: BodyParams): Record<string, unknown>;
makeBody(params: BodyParams): BodyInit;
preparePayloadAsync(args: AutomaticSpeechRecognitionArgs): Promise<RequestArgs>;
getResponse(response: DeepInfraAudioTranscriptionResponse): Promise<AutomaticSpeechRecognitionOutput>;
}
export declare class DeepInfraTextToSpeechTask extends TaskProviderHelper implements TextToSpeechTaskHelper {
constructor();
makeRoute(): string;
preparePayload(params: BodyParams): Record<string, unknown>;
getResponse(response: Blob): Promise<Blob>;
}
export declare class DeepInfraFeatureExtractionTask extends TaskProviderHelper implements FeatureExtractionTaskHelper {
constructor();
makeRoute(): string;
preparePayload(params: BodyParams): Record<string, unknown>;
getResponse(response: DeepInfraEmbeddingsResponse): Promise<FeatureExtractionOutput>;
}
export {};
//# sourceMappingURL=deepinfra.d.ts.map