/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { IRunConfig, TaskConfig } from "@workglow/task-graph"; import { CreateWorkflow } from "@workglow/task-graph"; import type { ImageValue } from "@workglow/util/media"; import { DataPortSchema } from "@workglow/util/schema"; import type { ModelConfig } from "../model/ModelSchema"; import { AiVisionTask } from "./base/AiVisionTask"; export declare const ObjectDetectionInputSchema: { readonly type: "object"; readonly properties: { readonly image: { readonly oneOf: readonly [{ readonly type: "string"; readonly format: "image:data-uri"; }, { readonly type: "object"; readonly format: "image"; }]; readonly title: "Image"; readonly description: "Image"; readonly format: "image"; }; readonly model: { readonly oneOf: readonly [{ readonly title: "Model"; readonly description: `The model ${string}`; } & Record & { readonly format: import(".").TypeModelSemantic; readonly type: "string"; }, { readonly type: "object"; readonly properties: { readonly model_id: { readonly type: "string"; }; readonly capabilities: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly "x-ui-editor": "multiselect"; }; readonly title: { readonly type: "string"; }; readonly description: { readonly type: "string"; readonly "x-ui-editor": "textarea"; }; readonly provider: { readonly type: "string"; }; readonly provider_config: { readonly type: "object"; readonly properties: { readonly credential_key: { readonly type: "string"; readonly format: "credential"; readonly "x-ui-hidden": true; }; readonly native_dimensions: { readonly type: "integer"; readonly description: "Native output vector dimensions for embedding models"; }; readonly mrl: { readonly type: "boolean"; readonly description: "Whether the model supports Matryoshka Representation Learning"; }; }; readonly additionalProperties: true; readonly default: {}; }; readonly metadata: { readonly type: "object"; readonly default: {}; readonly "x-ui-hidden": true; }; }; readonly required: readonly ["provider", "provider_config"]; readonly format: "model"; readonly additionalProperties: true; } & Record & { readonly format: import(".").TypeModelSemantic; }]; } & Record & { readonly format: import(".").TypeModelSemantic; }; readonly labels: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly title: "Labels"; readonly description: "List of object labels to detect (optional, if provided uses zero-shot detection)"; readonly "x-ui-group": "Configuration"; }; readonly threshold: { readonly type: "number"; readonly title: "Threshold"; readonly description: "The threshold for filtering detections by score"; readonly minimum: 0; readonly maximum: 1; readonly default: 0.5; readonly "x-ui-group": "Configuration"; }; }; readonly required: readonly ["image", "model"]; readonly additionalProperties: false; }; export declare const ObjectDetectionOutputSchema: { readonly type: "object"; readonly properties: { readonly detections: { readonly oneOf: readonly [{ readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly label: { readonly type: "string"; readonly title: "Label"; readonly description: "The label of the detected object"; }; readonly score: { readonly type: "number"; readonly title: "Confidence Score"; readonly description: "The confidence score for this detection"; readonly minimum: 0; readonly maximum: 1; }; readonly box: { readonly type: "object"; readonly properties: { readonly x: { readonly type: "number"; readonly title: "X coordinate"; readonly description: "Left edge of the bounding box"; }; readonly y: { readonly type: "number"; readonly title: "Y coordinate"; readonly description: "Top edge of the bounding box"; }; readonly width: { readonly type: "number"; readonly title: "Width"; readonly description: "Width of the bounding box"; }; readonly height: { readonly type: "number"; readonly title: "Height"; readonly description: "Height of the bounding box"; }; }; readonly required: readonly ["x", "y", "width", "height"]; readonly additionalProperties: false; readonly title: "Bounding Box"; readonly description: "Bounding box coordinates"; }; }; readonly required: readonly ["label", "score", "box"]; readonly additionalProperties: false; }; }, { readonly type: "array"; readonly items: { readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly label: { readonly type: "string"; readonly title: "Label"; readonly description: "The label of the detected object"; }; readonly score: { readonly type: "number"; readonly title: "Confidence Score"; readonly description: "The confidence score for this detection"; readonly minimum: 0; readonly maximum: 1; }; readonly box: { readonly type: "object"; readonly properties: { readonly x: { readonly type: "number"; readonly title: "X coordinate"; readonly description: "Left edge of the bounding box"; }; readonly y: { readonly type: "number"; readonly title: "Y coordinate"; readonly description: "Top edge of the bounding box"; }; readonly width: { readonly type: "number"; readonly title: "Width"; readonly description: "Width of the bounding box"; }; readonly height: { readonly type: "number"; readonly title: "Height"; readonly description: "Height of the bounding box"; }; }; readonly required: readonly ["x", "y", "width", "height"]; readonly additionalProperties: false; readonly title: "Bounding Box"; readonly description: "Bounding box coordinates"; }; }; readonly required: readonly ["label", "score", "box"]; readonly additionalProperties: false; }; }; }]; readonly title: "Detections"; readonly description: "The detected objects with their labels, scores, and bounding boxes"; }; }; readonly required: readonly ["detections"]; readonly additionalProperties: false; }; export type ObjectDetectionTaskInput = Omit<{ threshold?: number | undefined; labels?: string[] | undefined; model: string | ModelConfig; image: string | { [x: string]: unknown; }; }, "image"> & { image: ImageValue; }; export type ObjectDetectionTaskOutput = { detections: { score: number; box: { x: number; y: number; width: number; height: number; }; label: string; }[] | { score: number; box: { x: number; y: number; width: number; height: number; }; label: string; }[][]; }; export type ObjectDetectionTaskConfig = TaskConfig; /** * Detects objects in images using vision models. * Automatically selects between regular and zero-shot detection based on whether labels are provided. */ export declare class ObjectDetectionTask extends AiVisionTask { static type: string; /** Capabilities required of the model; gated in {@link AiTask.execute}. */ static readonly requires: ["image.object-detection"]; static category: string; static title: string; static description: string; static inputSchema(): DataPortSchema; static outputSchema(): DataPortSchema; } export declare const objectDetection: (input: ObjectDetectionTaskInput, config?: ObjectDetectionTaskConfig, runConfig?: Partial) => Promise; declare module "@workglow/task-graph" { interface Workflow { objectDetection: CreateWorkflow; } } //# sourceMappingURL=ObjectDetectionTask.d.ts.map