Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FallbackReader ¶
type FallbackReader struct {
// contains filtered or unexported fields
}
FallbackReader tries multiple Readers in order, returning the first result where at least one page produced non-empty text.
func NewFallbackReader ¶
func NewFallbackReader(readers ...Reader) *FallbackReader
NewFallbackReader creates a Reader that tries each reader in order.
func (*FallbackReader) Close ¶
func (f *FallbackReader) Close() error
Close closes all underlying readers, collecting any errors.
func (*FallbackReader) Read ¶
func (f *FallbackReader) Read(ctx context.Context, pages []ai.BinaryContent, opts *ReadOptions) ([]string, error)
Read tries each reader in order, returning the first result where any page produced non-empty text. If all readers fail or return empty results, returns the last error (or empty strings if no errors occurred).
type ReadOptions ¶
type ReadOptions struct {
// Prompt is a custom extraction prompt (empty = default OCR).
Prompt string
// MaxTokens is the max output tokens per page (0 = provider default).
MaxTokens int
}
ReadOptions configures a Read call.
type Reader ¶
type Reader interface {
// Read extracts text from one or more pages. Each page should be a
// single image (PNG, JPEG) or a single-page PDF as ai.BinaryContent.
// Returns one string per input page.
Read(ctx context.Context, pages []ai.BinaryContent, opts *ReadOptions) ([]string, error)
// Close releases any resources held by the reader (sessions, connections, etc.)
Close() error
}
Reader extracts text from images and single-page PDFs using OCR models.
Click to show internal directories.
Click to hide internal directories.