Skip to content

feat(providers): derive imageToText from the OCR registry + chutes dots.ocr seed - #10400

Merged
diegosouzapw merged 13 commits into
release/v3.8.50from
feat/imagetotext-derivation
Aug 14, 2026
Merged

feat(providers): derive imageToText from the OCR registry + chutes dots.ocr seed#10400
diegosouzapw merged 13 commits into
release/v3.8.50from
feat/imagetotext-derivation

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Summary

PR-D (final) of the OCR/image-to-text migration series (plan: _tasks/superpowers/plans/2026-08-13-ocr-image-to-text-migration.md; heuristic pattern from aisbf, implemented in this repo's registry-derived style).

(Replaces #10291, which GitHub auto-closed when #10283 merged with --delete-branch and removed its base branch. Same commits, now targeting the release directly — #10283 is merged, so the azure-document-intelligence provider the derivation test covers is on the base.)

  • imageToText derived from the OCR registry (open-sse/config/mediaServiceKinds.ts): any provider registered in OCR_PROVIDERS now resolves the imageToText serviceKind automatically — mistral and azure-document-intelligence appear in /dashboard/media-providers/imageToText with no manual catalog edit, and future OCR providers surface on registration (no drift). Complements feat(providers): declare imageToText serviceKind on major vision providers #10275, which declares the kind on the 7 major vision LLM providers.
  • Chutes seed: serviceKinds: ["llm", "imageToText"] on the chutes gateway entry (hosts rednote-hilab/dots.ocr — cheap OCR-specialized model, 131k ctx; arrives via model discovery since chutes is passthroughModels: true, so no static registry entry). "llm" declared alongside for the same ProviderCard reason as feat(providers): declare imageToText serviceKind on major vision providers #10275.

Validation (TDD)

  • imagetotext-derivation 3/3: mistral + azure derive with declared: undefined; groq with undefined does NOT (isolates derivation from feat(providers): declare imageToText serviceKind on major vision providers #10275's declarations); chutes resolves both imageToText and llm.
  • Siblings green: provider-service-kind-filter-4240, minimax-media-servicekinds (16 total).
  • check:provider-consistency OK (259 registry entries, 339 canonical providers) · typecheck:core 0 · eslint/prettier clean.
  • serviceKindIndex.ts memoization verified safe: derivation is a pure function of providerId over the constant OCR_PROVIDERS map.

⚠️ base-red inherited: #9985 (ESLint errors from #10240/#9448 — unrelated to this diff)

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.
…iceKinds

Same rebaseline as #10275 (frozen 1250 -> 1252): this branch adds the chutes
serviceKinds declaration, the second of the two data lines.
@diegosouzapw
diegosouzapw merged commit fa0b0ef into release/v3.8.50 Aug 14, 2026
21 of 22 checks passed
@diegosouzapw
diegosouzapw deleted the feat/imagetotext-derivation branch August 14, 2026 18:19
@diegosouzapw diegosouzapw mentioned this pull request Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants