Overview
Convert provider OCR responses into openparser@1 graphs and call cloud OCR providers.
@openparser/adapters converts provider OCR responses into openparser@1 document graphs and ships production HTTP/SDK clients for cloud OCR providers.
Inputs use provider-native model ids and options. Converters preserve hierarchy, text spans, coordinate spaces, styles, structured tables, returned image assets, and confidence at the closest granularity supplied by the provider. Original scores and scales remain available for lineage and review.
Configuration
This package never reads environment variables or discovers credentials on its own. Pass API keys, endpoints, regions, and auth objects into each client factory. Google and AWS clients may fall back to Application Default Credentials or the AWS default credential chain when you omit explicit auth.
Install
npm install @openparser/adaptersRuntime deps for cloud clients ship as package dependencies (google-auth-library, @aws-sdk/client-textract, pdf-lib, zod).
Subpath imports
Prefer subpath imports so bundlers only pull the provider you need:
| Provider | Import path | Adapter + client |
|---|---|---|
| Paddle HPS | @openparser/adapters/paddle | mapLayoutResultsToParsedDocument |
| Mistral OCR | @openparser/adapters/mistral | mapMistralOcrResponseToParsedDocument, createHttpMistralOcrClient |
| Azure Document Intelligence | @openparser/adapters/azure-document-intelligence | mapAzureDocumentIntelligenceToParsedDocument, createHttpAzureDiClient |
| Google Document AI | @openparser/adapters/google-document-ai | mapGoogleDocumentAiToParsedDocument, createGoogleDocumentAiClient |
| AWS Textract | @openparser/adapters/aws-textract | mapAwsTextractToParsedDocument, createAwsTextractClient |
The root entry @openparser/adapters re-exports all adapters and clients, plus package provenance helpers.
Converter provenance
import {
OPENPARSER_ADAPTERS_VERSION,
openparserAdapterConverterVersion,
} from '@openparser/adapters';
openparserAdapterConverterVersion('mistral');
// → `@openparser/adapters@<semver>#mistral`Provider-native options and output types
Each adapter exports strict Zod option schemas (with model/operation compatibility where it is a provider fact), request translators, and conservative output capability constants / ParsedDocumentWithElementKinds aliases. These describe possible converter element kinds — not guaranteed fields.
Provider guides
- Paddle HPS — map HPS
layoutParsingResults - Mistral OCR — HTTP client + converter
- Azure Document Intelligence
- Google Document AI
- AWS Textract — async S3-backed jobs
File-byte clients (mistral, azure, google) take bytes: Uint8Array. AWS remains S3-sourced. Each cloud parse returns { canonical: ParsedDocument, nativeResult: Record<string, unknown> }.