DocumentExtractor
org.llm4s.extract.DocumentExtractor
trait DocumentExtractor
Service for extracting text content from documents.
DocumentExtractor is source-agnostic - it works with raw bytes from any source (filesystem, S3, HTTP, database, etc.). This allows the same extraction logic to be used regardless of where the document is stored. extractFromPath is the one filesystem-aware entry point, provided because loading a local file is common enough that every caller would otherwise write the same three lines.
Supported formats:
- Plain text files (.txt, .md, .json, .xml, .csv, .html)
- PDF documents (.pdf)
- Word documents (.docx, .doc)
Usage:
val extractor = TikaDocumentExtractor
// Extract from bytes (common for S3, HTTP responses)
val result = extractor.extract(bytes, "report.pdf")
// Extract from stream (for large files)
val result = extractor.extractFromStream(inputStream, "report.pdf")
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object TikaDocumentExtractor
Members list
In this article