Versions in this module Expand all Collapse all v1 v1.0.0 Sep 12, 2026 v0 v0.3.0 Sep 5, 2026 Changes in this version + const CapDisagreement + const CapRuleFailed + const CapSuspicious + const CapUngrounded + const DefaultBreakerCooldown + const DefaultBreakerFailures + const DefaultMaxDecompressedBytes + const DefaultMaxDepth + const DefaultMaxObjects + const DefaultMaxPagePixels + const DefaultMaxPages + const DefaultMaxReplacementRatio + const DefaultMaxSourceBytes + const DefaultMaxStreamBytes + const DefaultMaxTextBytes + const DefaultMinDecodableRatio + const DefaultMinTextDensity + const DefaultReviewThreshold + const SignalAgreement + const SignalCrossField + const SignalFormat + const SignalGrounding + const SignalOCR + const SignalSchema + const WeightAgreement + const WeightCrossField + const WeightFormat + const WeightGrounding + const WeightOCR + const WeightSchema + var ErrAuth = errors.New("ovrin: provider authentication failed") + var ErrBadRequest = errors.New("ovrin: provider rejected the request") + var ErrBadResponse = errors.New("ovrin: provider returned an unusable response") + var ErrEncrypted = errors.New("ovrin: document is encrypted") + var ErrInternal = errors.New("ovrin: internal failure") + var ErrLimitExceeded = errors.New("ovrin: resource limit exceeded") + var ErrNoContent = errors.New("ovrin: no readable content in document") + var ErrNoProvider = errors.New("ovrin: no provider configured for this document") + var ErrRateLimit = errors.New("ovrin: provider rate limited") + var ErrSchema = errors.New("ovrin: invalid schema") + var ErrUnavailable = errors.New("ovrin: provider unavailable") + var ErrUnsupported = errors.New("ovrin: unsupported by this provider") + var ErrUnsupportedFormat = errors.New("ovrin: unsupported document format") + type BatchResult struct + Err error + Index int + Result *Result[T] + func ExtractBatch[T any](ctx context.Context, c *Client, srcs []Source, opts ...Option) []BatchResult[T] + type BreakerOption func(*breaker) + func WithBreakerCooldown(d time.Duration) BreakerOption + func WithBreakerFailures(n int) BreakerOption + type Candidate struct + Reading Reading + Source Provenance + Value any + type Cell struct + Box Rect + Column int + ColumnSpan int + Confidence float64 + Kind CellKind + Row int + RowSpan int + Text string + func (c Cell) Columns() int + func (c Cell) Covers(row, column int) bool + func (c Cell) Rows() int + type CellKind string + const CellColumnHeader + const CellData + const CellRowHeader + const CellUnknown + func (k CellKind) Header() bool + func (k CellKind) String() string + type Client struct + func New(opts ...Option) *Client + type Content struct + Image []byte + MediaType string + Page int + Reading Reading + Text string + type CrossFieldResult struct + Applicable bool + Fields []string + Message string + Name string + Passed bool + type CrossFieldRule interface + Check func(f CrossFields) CrossFieldResult + Name func() string + func Before(earlier, later string) CrossFieldRule + func CrossFieldFunc(name string, check func(CrossFields) CrossFieldResult) CrossFieldRule + func Sum(total string, tol Tolerance, parts ...string) CrossFieldRule + func SumItems(total, slice string, tol Tolerance, leaves ...string) CrossFieldRule + type CrossFields map[string]any + func (f CrossFields) Count(slice string) int + func (f CrossFields) Number(key string) (float64, bool) + func (f CrossFields) Text(key string) (string, bool) + func (f CrossFields) Time(key string) (time.Time, bool) + type DateOrder string + const DateOrderUnknown + const DayFirst + const MonthFirst + const YearFirst + type Document struct + Data []byte + Kind Kind + Pages int + Size int64 + type DocumentOCR interface + RecogniseDocument func(ctx context.Context, doc Document) ([]*Recognition, error) + type Error struct + Field string + Kind error + Message string + Op Op + Page int + Provider string + func (e *Error) Error() string + func (e *Error) Unwrap() []error + func (e *Error) WithCause(err error) *Error + type Event struct + Attempt int + Bytes int64 + Confidence float64 + Duration time.Duration + Err error + Fields int + Op Op + Page int + Pages int + Provider string + Review bool + Usage Usage + type Explanation struct + Candidates []Candidate + Confidence float64 + Field string + Found bool + Provenance []Provenance + Reasons []ReviewReason + Signals []Signal + Validation []RuleResult + Value any + func (e *Explanation) String() string + type FieldEvidence struct + Agreement *float64 + AgreementNote string + Ambiguous bool + Candidates []Candidate + Field string + Found bool + Grounding float64 + OCRConfidence *float64 + Provenance []Provenance + Reading Reading + Suspicious bool + Validation []RuleResult + Value any + type FieldResult struct + Candidates []Candidate + Confidence float64 + Errors []error + Found bool + Provenance []Provenance + Signals []Signal + Valid bool + Validation []RuleResult + Value any + type Hook func(ctx context.Context, ev Event) + type Kind string + const KindCSV + const KindDOCX + const KindJPEG + const KindPDF + const KindPNG + const KindTIFF + const KindUnknown + const KindWebP + const KindXLSX + func (k Kind) String() string + type Layout struct + Pairs []Pair + Tables []Table + func (l *Layout) Order() + func (l Layout) At(r Ref) (Cell, bool) + func (l Layout) Check() error + func (l Layout) Ref(i int, c Cell) Ref + type Line struct + Box Rect + Page int + Text string + type Metadata struct + Duration time.Duration + Kind Kind + Pages int + Providers map[Op]string + Readings []Reading + Retried bool + Usage Usage + type Model interface + Generate func(ctx context.Context, req ModelRequest) (*ModelResponse, error) + func BreakModel(m Model, opts ...BreakerOption) Model + func ModelChain(models ...Model) Model + type ModelRequest struct + Content []Content + Instruction string + Schema []byte + Temperature *float64 + type ModelResponse struct + JSON []byte + Raw any + Usage Usage + type OCR interface + Name func() string + Recognise func(ctx context.Context, page Page) (*Recognition, error) + func BreakOCR(o OCR, opts ...BreakerOption) OCR + func OCRChain(providers ...OCR) OCR + type Op string + const OpAcquire + const OpDetect + const OpGenerate + const OpGround + const OpNormalise + const OpOCR + const OpPrompt + const OpRender + const OpSchema + const OpScore + const OpUnknown + const OpValidate + func (o Op) String() string + type Option interface + func WithConcurrency(n int) Option + func WithCrossField(rules ...CrossFieldRule) Option + func WithDateOrder(d DateOrder) Option + func WithHook(h Hook) Option + func WithMaxDecompressedBytes(n int64) Option + func WithMaxDepth(n int) Option + func WithMaxObjects(n int) Option + func WithMaxPagePixels(n int) Option + func WithMaxPages(n int) Option + func WithMaxReplacementRatio(r float64) Option + func WithMaxSourceBytes(n int64) Option + func WithMaxStreamBytes(n int64) Option + func WithMaxTextBytes(n int64) Option + func WithMinDecodableRatio(r float64) Option + func WithMinTextDensity(d float64) Option + func WithModel(m Model) Option + func WithOCR(o OCR) Option + func WithReading(m ReadingMode) Option + func WithRenderer(r Renderer) Option + func WithReviewThreshold(t float64) Option + func WithScorer(s Scorer) Option + type Page struct + DPI int + Height float64 + Image image.Image + Number int + Width float64 + type Pair struct + Confidence float64 + Key Region + Page int + Value Region + func (p Pair) Box() Rect + type Provenance struct + Box *Rect + Exact bool + Method string + Page int + Reading Reading + Span *Span + type Reading string + const ReadingOCR + const ReadingText + const ReadingUnknown + const ReadingVision + func (r Reading) String() string + type ReadingMode string + const ModeBoth + const ModeOCR + const ModeText + const ModeVision + const ReadingAuto + type Recognition struct + Confidence float64 + Language string + Layout *Layout + Lines []Line + Raw any + Usage Usage + Words []Word + type Rect struct + MaxX float64 + MaxY float64 + MinX float64 + MinY float64 + type Ref struct + Column int + Page int + Row int + Table int + func (r Ref) String() string + type Region struct + Box Rect + Confidence float64 + Text string + type Renderer interface + Render func(ctx context.Context, doc Document, page, dpi int) (image.Image, error) + type Result struct + Confidence float64 + Data T + Fields map[string]FieldResult + Metadata Metadata + NeedsReview bool + Reasons []ReviewReason + Valid bool + func Extract[T any](ctx context.Context, c *Client, src Source, opts ...Option) (*Result[T], error) + func (r *Result[T]) Explain(field string) (*Explanation, bool) + type ReviewReason struct + Field string + Why string + type RuleResult struct + Message string + Passed bool + Rule string + type Scorer interface + Score func(f FieldEvidence) (confidence float64, signals []Signal) + type Signal struct + Name string + Note string + Value float64 + Weight float64 + type Source interface + func Bytes(b []byte) Source + func File(path string) Source + func Reader(r io.Reader) Source + type Span struct + End int + Start int + type Table struct + Box Rect + Cells []Cell + Columns int + Confidence float64 + Page int + Rows int + func (t Table) At(row, column int) (Cell, bool) + type Tolerance struct + Absolute float64 + Relative float64 + type Usage struct + InputTokens int + OutputTokens int + PageUnits int + type Word struct + Box Rect + Confidence float64 + Line int + Text string