import type { ClassificationOutcome, ClassifierEmbeddingModel } from "./types.js"; export interface ZeroShotClassifyParams { apiKey: string; text: string; labels: string[]; model?: ClassifierEmbeddingModel; timeoutMs?: number; signal?: AbortSignal; } /** * Classify `text` against a list of semantic labels. * * Returns `null` when: * - the response shape is unexpected (Jina rev mismatch), * - the predicted label does not exactly match any provided label (we * refuse to invent a class — the router treats this as "unknown"). * * Throws on network / API errors so the caller's fail-open path can react. */ export declare function classifyZeroShot({ apiKey, text, labels, model, timeoutMs, signal, }: ZeroShotClassifyParams): Promise; export interface FewShotClassifyParams { apiKey: string; text: string; classifierId: string; /** * Optional whitelist used by the defensive parser to verify that the * returned label is one the caller expects. When omitted, any non-empty * string returned by Jina is accepted (caller knows what was trained). */ expectedLabels?: string[]; timeoutMs?: number; signal?: AbortSignal; } /** * Classify `text` using a pre-trained few-shot classifier identified by * `classifierId`. Same `null`-vs-throw contract as `classifyZeroShot`. */ export declare function classifyFewShot({ apiKey, text, classifierId, expectedLabels, timeoutMs, signal, }: FewShotClassifyParams): Promise; /** * Extract the predicted label + optional score from a Classifier response. * * Known shapes (in order tried): * 1. `{ data: [ { predictions: [ { label, score } ] } ] }` * 2. `{ results: [ { label, score } ] }` * 3. `{ data: [ { label, score } ] }` * 4. `{ data: [ { prediction, confidence } ] }` * * The first match wins. When `allowedLabels` is provided, the picked label * MUST be an exact (case-sensitive) member — otherwise we return `null` and * the caller falls back to its safe default. * * @internal exported only for unit testing */ export declare function parseClassificationResponse(raw: unknown, allowedLabels?: string[]): ClassificationOutcome | null;