|
|
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js"; |
|
|
import { getProviderHelper } from "../../lib/getProviderHelper.js"; |
|
|
import type { BaseArgs, Options } from "../../types.js"; |
|
|
import { innerRequest } from "../../utils/request.js"; |
|
|
|
|
|
export type TabularClassificationArgs = BaseArgs & { |
|
|
inputs: { |
|
|
|
|
|
|
|
|
|
|
|
data: Record<string, string[]>; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type TabularClassificationOutput = number[]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function tabularClassification( |
|
|
args: TabularClassificationArgs, |
|
|
options?: Options |
|
|
): Promise<TabularClassificationOutput> { |
|
|
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl); |
|
|
const providerHelper = getProviderHelper(provider, "tabular-classification"); |
|
|
const { data: res } = await innerRequest<TabularClassificationOutput>(args, providerHelper, { |
|
|
...options, |
|
|
task: "tabular-classification", |
|
|
}); |
|
|
return providerHelper.getResponse(res); |
|
|
} |
|
|
|