Repository navigation
feat(ocr): multi-provider /v1/ocr with transformation layer (Azure Document Intelligence) - #10283
Merged
Merged
Conversation
The test's own title ("returns a sanitized 500") describes the new
behavior mandated by HR#12 (never leak err.message in a response body).
The old regex asserted the pre-sanitization leak (`OCR request failed:
socket closed`) as expected output, which contradicted its own title
and the sanitization this task intentionally introduced in
open-sse/handlers/ocr.ts. Scoped to this single assertion only.
pollOcrOperation now checks pollRes.ok and returns a sanitized 502 immediately (logging the upstream status via console.error) instead of looping until the 30-attempt cap and surfacing a misleading timeout for what was actually an auth/upstream error during polling.
- Route: map the connection's providerSpecificData.baseUrl onto credentials.baseUrl (resolveOcrCredentials) so azure-document-intelligence connections resolve their endpoint the same way every other custom-endpoint provider does (src/lib/providers/validation/*); previously handleOcr only saw a baseUrl when a caller set it directly, so the DB-backed Azure connection endpoint was never forwarded. - v1OcrSchema.model is already a free-form string, no schema change needed. - Docs: add the /v1/ocr provider table + example + Azure poll-flow note to API_REFERENCE.md, and describe the provider/model prefix + async poll behavior in openapi.yaml. - Test: tests/unit/ocr-route-contract.test.ts covers getAllOcrModels/ parseOcrModel for both providers and resolveOcrCredentials's mapping.
This was referenced Aug 13, 2026
…/v1/ocr The generated agent skill mirrors docs/reference/API_REFERENCE.md; updating the /v1/ocr section left it stale and tripped the merge-integrity gate.
This was referenced Aug 14, 2026
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…cument Intelligence) (cheaper-inference#10283) * feat(ocr): transformation layer on ocrRegistry (Mistral shape canonical) * feat(ocr): Azure Document Intelligence provider (prebuilt-read, analyze+poll) * feat(ocr): generic dispatch with per-provider transformation and DI poll loop * test(ocr): align sanitized-500 assert with HR#12 error sanitization The test's own title ("returns a sanitized 500") describes the new behavior mandated by HR#12 (never leak err.message in a response body). The old regex asserted the pre-sanitization leak (`OCR request failed: socket closed`) as expected output, which contradicted its own title and the sanitization this task intentionally introduced in open-sse/handlers/ocr.ts. Scoped to this single assertion only. * fix(ocr): fail fast on non-ok poll responses instead of misleading 504 pollOcrOperation now checks pollRes.ok and returns a sanitized 502 immediately (logging the upstream status via console.error) instead of looping until the 30-attempt cap and surfacing a misleading timeout for what was actually an auth/upstream error during polling. * feat(ocr): route/docs for multi-provider /v1/ocr - Route: map the connection's providerSpecificData.baseUrl onto credentials.baseUrl (resolveOcrCredentials) so azure-document-intelligence connections resolve their endpoint the same way every other custom-endpoint provider does (src/lib/providers/validation/*); previously handleOcr only saw a baseUrl when a caller set it directly, so the DB-backed Azure connection endpoint was never forwarded. - v1OcrSchema.model is already a free-form string, no schema change needed. - Docs: add the /v1/ocr provider table + example + Azure poll-flow note to API_REFERENCE.md, and describe the provider/model prefix + async poll behavior in openapi.yaml. - Test: tests/unit/ocr-route-contract.test.ts covers getAllOcrModels/ parseOcrModel for both providers and resolveOcrCredentials's mapping. * chore(quality): rebaseline deadExports for the OCR/image-to-text series * docs(skills): regenerate omni-inference skill for the multi-provider /v1/ocr The generated agent skill mirrors docs/reference/API_REFERENCE.md; updating the /v1/ocr section left it stale and tripped the merge-integrity gate. --------- Co-authored-by: Xiangzhe <bakryun0718@proton.me>
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…cument Intelligence) (cheaper-inference#10283) * feat(ocr): transformation layer on ocrRegistry (Mistral shape canonical) * feat(ocr): Azure Document Intelligence provider (prebuilt-read, analyze+poll) * feat(ocr): generic dispatch with per-provider transformation and DI poll loop * test(ocr): align sanitized-500 assert with HR#12 error sanitization The test's own title ("returns a sanitized 500") describes the new behavior mandated by HR#12 (never leak err.message in a response body). The old regex asserted the pre-sanitization leak (`OCR request failed: socket closed`) as expected output, which contradicted its own title and the sanitization this task intentionally introduced in open-sse/handlers/ocr.ts. Scoped to this single assertion only. * fix(ocr): fail fast on non-ok poll responses instead of misleading 504 pollOcrOperation now checks pollRes.ok and returns a sanitized 502 immediately (logging the upstream status via console.error) instead of looping until the 30-attempt cap and surfacing a misleading timeout for what was actually an auth/upstream error during polling. * feat(ocr): route/docs for multi-provider /v1/ocr - Route: map the connection's providerSpecificData.baseUrl onto credentials.baseUrl (resolveOcrCredentials) so azure-document-intelligence connections resolve their endpoint the same way every other custom-endpoint provider does (src/lib/providers/validation/*); previously handleOcr only saw a baseUrl when a caller set it directly, so the DB-backed Azure connection endpoint was never forwarded. - v1OcrSchema.model is already a free-form string, no schema change needed. - Docs: add the /v1/ocr provider table + example + Azure poll-flow note to API_REFERENCE.md, and describe the provider/model prefix + async poll behavior in openapi.yaml. - Test: tests/unit/ocr-route-contract.test.ts covers getAllOcrModels/ parseOcrModel for both providers and resolveOcrCredentials's mapping. * chore(quality): rebaseline deadExports for the OCR/image-to-text series * docs(skills): regenerate omni-inference skill for the multi-provider /v1/ocr The generated agent skill mirrors docs/reference/API_REFERENCE.md; updating the /v1/ocr section left it stale and tripped the merge-integrity gate. --------- Co-authored-by: Xiangzhe <bakryun0718@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR-A of the OCR/image-to-text migration series (plan:
_tasks/superpowers/plans/2026-08-13-ocr-image-to-text-migration.md, mirrors research over_references/_sistemas_proxys— litellm'sBaseOCRConfigpattern).Generalizes the existing Mistral-only
/v1/ocrinto a multi-provider endpoint:open-sse/config/ocrRegistry.ts:OcrTransformation { buildRequest, parseResponse, pollUrl? }withMISTRAL_PASSTHROUGHas the default (Mistral response shape stays the canonical/v1/ocrcontract).azure-document-intelligence/prebuilt-read):documentModels/prebuilt-read:analyze?api-version=2024-11-30&outputContentFormat=markdown,Ocp-Apim-Subscription-Keyauth, async analyze+poll viaOperation-Location(30 × 1s cap; non-ok poll → fail-fast 502; exhaustion → 504). Endpoint comes from the connection'sproviderSpecificData.baseUrlvia the new pureresolveOcrCredentials()helper in the route.err.message; the sibling assert intests/unit/ocr-route.test.ts("returns a sanitized 500") was aligned to prove the internal detail no longer leaks — its title already described the new behavior.API_REFERENCE.md/v1/ocrsection (both providers + poll flow) andopenapi.yamldescription.Validation (TDD, DI-only — no network in tests)
ocr-registry-transformations(5),ocr-handler-dispatch(6, incl. poll-401 fail-fast with call-count proof and 30-attempt 504),ocr-route-contract(5, incl.resolveOcrCredentialsmalformed-input safety),ocr-route(14).typecheck:coreexit 0 · prettier/eslint clean on touched files ·check:docs-allexit 0.Refs #10282