From 17a3e9ce04fa6f072053969ff26272c955d68e0c Mon Sep 17 00:00:00 2001 From: Khurdhula-Harshavardhan Date: Tue, 2 Jun 2026 17:16:56 -0700 Subject: [PATCH 1/2] feat(ocr): new param for returning bounds --- src/vision/interfaces.ts | 2 ++ tests/vision.test.ts | 26 -------------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/vision/interfaces.ts b/src/vision/interfaces.ts index bf4b8a2..4cbc8c7 100644 --- a/src/vision/interfaces.ts +++ b/src/vision/interfaces.ts @@ -7,6 +7,8 @@ export type VOCRParams = { page_range?: Array; /** High fidelity word-level bounding boxes within complex documents. Default: false. */ fine_grained?: boolean; + /** Include line and word level bounding box coordinates. When false, the coordinates are omitted but the text and confidence are still returned. Default: true. */ + return_bounds?: boolean; }; export interface VOCRResponse extends BaseResponse { diff --git a/tests/vision.test.ts b/tests/vision.test.ts index d536757..abf860a 100644 --- a/tests/vision.test.ts +++ b/tests/vision.test.ts @@ -724,32 +724,6 @@ describe("Object Detection API", () => { }); }); - // Complex scenario tests - test("should work with comprehensive configuration", async () => { - const result = await client.vision.object_detection({ - url: TEST_URLS.image, - prompts: ["detect all objects", "find text elements"], - features: ["object", "gui"], - annotated_image: true, - return_type: "url", - }); - - expectSuccess(result); - expectType(result, "object"); - - if (result.objects !== undefined) { - expectArray(result.objects); - } - - if (result.gui_elements !== undefined) { - expectArray(result.gui_elements); - } - - if (result.annotated_image !== undefined) { - expectType(result.annotated_image, "string"); - } - }); - test("should work with file upload", async () => { const imageResponse = await fetch(TEST_URLS.image); const imageBlob = await imageResponse.blob(); From 7290f90c8a0a9df58455ec93f7008f632112a1ed Mon Sep 17 00:00:00 2001 From: Khurdhula-Harshavardhan Date: Tue, 2 Jun 2026 17:32:55 -0700 Subject: [PATCH 2/2] fix(types): bounds is now optional in response for ocr --- src/vision/interfaces.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vision/interfaces.ts b/src/vision/interfaces.ts index 4cbc8c7..d5ae8fc 100644 --- a/src/vision/interfaces.ts +++ b/src/vision/interfaces.ts @@ -21,11 +21,11 @@ export interface VOCRResponse extends BaseResponse { text: string; lines: Array<{ text: string; - bounds: BoundingBox; + bounds?: BoundingBox; // omitted when return_bounds is false average_confidence: number; words: Array<{ text: string; - bounds: BoundingBox; + bounds?: BoundingBox; // omitted when return_bounds is false confidence: number; }>; }>;