Class DeterministicExtractTool
java.lang.Object
ai.redouble.nucleo.harness.AbstractJob<Extraction>
ai.redouble.nucleo.tools.AbstractTool<FileRef, Extraction>
ai.redouble.demo.extract.DeterministicExtractTool
- All Implemented Interfaces:
GuardedExecution, Identifiable, Job<Extraction>, Tool<FileRef, Extraction>
The tier that costs nothing: text the code can read without a model or a native toolkit. The
file's first bytes say what it is before its extension does: an Office document (a zip of XML)
is unzipped and its body parts are stripped of tags; anything unsigned is read as UTF-8 text,
and comes back with
textLayer false when too much of it failed to decode, which is what
a binary under a text extension looks like and what the classifier then judges. Images and PDFs
are not read here - they go whole to the model tier - so this tier pulls no font or graphics
toolkit and compiles to a native image on any OS. A file this tool cannot open is a fault of
the run, not of a model, and propagates as such.- Since:
- 0.1 (2026-09-14)
- Author:
- Andrey Santrosyan
-
Field Summary
FieldsModifier and TypeFieldDescriptionExtensions read as text without asking anyone.Fields inherited from class AbstractTool
inputFields inherited from class AbstractJob
timeout, upstreamRetriesFields inherited from interface Job
DEFAULT_UPSTREAM_RETRIESFields inherited from interface Tool
OBS_INPUT, OBS_OUTPUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(JobResources resources, JobContext<Extraction> context) Executes the job with the provided resources and context.static StringDefault requirements for tools.static StringofficeText(Path file) The text of an OOXML document (docx, xlsx, pptx) with its tags stripped, asreadOffice(Path, Extraction)reads it; for any reader of Office files that needs no POI.Methods inherited from class AbstractTool
getInput, getJobType, postExecute, preExecute, setInputMethods inherited from class AbstractJob
getId, getName, getParentJobId, getPriority, getTimeout, getUpstreamRetries, getUserId, getWorkflowId, randomIdSuffix, setTimeout, setUpstreamRetries, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface GuardedExecution
declareAdmissionGuardrails, declareAuthGuardrails, declareContentGuardrailsMethods inherited from interface Identifiable
getParentJobId, getUserId, getWorkflowIdMethods inherited from interface Job
getDisplayName, getId, getJobId, getName, getPriority, getTimeout, getUpstreamRetriesMethods inherited from interface Tool
guardedInputTarget
-
Field Details
-
TEXT
-
-
Constructor Details
-
DeterministicExtractTool
-
-
Method Details
-
extension
-
getRequirements
Description copied from class:AbstractToolDefault requirements for tools. Subclasses should override to add database, LLM, or other requirements. JobType is handled byAbstractTool.getJobType(), not here.- Specified by:
getRequirementsin interfaceJob<Extraction>- Overrides:
getRequirementsin classAbstractTool<FileRef, Extraction>- Returns:
- resource requirements, or null if the job needs no resources
-
execute
public Extraction execute(JobResources resources, JobContext<Extraction> context) throws LLMReadableCheckedException Description copied from interface:JobExecutes the job with the provided resources and context. A job reports progress and checks for cancellation through the context, and completes all its work before returning. A tool narrows this contract to the LLM-readable exceptions ofTool.execute(JobResources, JobContext).- Parameters:
resources- the allocated resourcescontext- the job execution context for monitoring- Returns:
- the job result, which may be null
- Throws:
LLMReadableCheckedException- if execution fails
-
officeText
The text of an OOXML document (docx, xlsx, pptx) with its tags stripped, asreadOffice(Path, Extraction)reads it; for any reader of Office files that needs no POI.- Throws:
IOException
-