Skip to content

QDocs

Verified against source (20)

  • Extensions/AttachmentExtensions.cs
  • qbo4.Document.Aspose.Bridge/PdfSplitterBatchEngine.cs
  • qbo4.Document.Aspose.Bridge/PdfSplitterBatchEngineOptions.cs
  • qbo4.Document.AsposePDF/AsposePdfSplitter.cs
  • qbo4.Document.AsposePDF/AsposePdfSplitterOptions.cs
  • qbo4.Document.AsposePDF/AiSplitter.cs
  • qbo4.Document.AsposePDF/AiSplitterOptions.cs
  • Extensions/AttachmentExtensions.cs
  • Extensions/AttachmentExtensions.cs
  • Extensions/LabelExtensions.cs
  • qbo4.AI.Bridge/AIScoreEngine.cs
  • qbo4.AI.Bridge/AiModalEngine.cs
  • qbo4.AI.Bridge/AiBatchEngine.cs
  • qbo4.AI.Bridge/AiBatchEngineOptions.cs
  • qbo4.AI.Bridge/ClassificationBatchEngine.cs
  • qbo4.AI.Bridge/ClassificationBatchEngineOptions.cs
  • Usage/LedgerUsageHandler.cs
  • Extensions/DictionaryExtensions.cs
  • attachment/Attachment.cs
  • Attachment/SplitPDF.xslt

QDocs is a set of standard QBO operations on documents (Attachment records) and scores, with no separate service to call. Each stage of the pipeline is one operation:

Stage Operation Module Implemented in
Split pdfsplit (and pdfsplitbypage, pdfsplitbyoutline, pdfsplitbysize, pdfsplitbysemantics) attachment qbo4.Document (Aspose PDF)
Split, fan-out splitpdf attachment qbo3 attachment
Read ocrtodescription attachment qbo3 attachment
Classify aiclassify attachment qbo4.AI
Label ailabel any (here attachment) qbo4.AI
Transcribe aitranscribe attachment qbo4.AI
Extract calculate with an AI scoring engine score qbo3 score, qbo4.AI engines
Batch import on an import file whose template uses a batch engine importfile qbo4.AI, qbo4.Document

All operations follow the standard route pattern:

  • /api/{module}/{operation} runs synchronously on the web server.
  • /api/{module}/queue/{operation} queues the operation for an app server. Use it for splitting, extraction, and anything that touches many documents.

Every call runs as the authenticated user, against records that user can reach. Classification, labels, extraction, transcription, agents, and token tracking are documented in full in the AI developer reference; this page covers how QDocs uses them, and documents splitting in full.

GET /api/attachment/pdfsplit?ID=2207
GET /api/attachment/queue/pdfsplit?ID=2207&Target_Object=Process&Target_ObjectID=42&LedgerID=310
GET /api/attachment/splitpdf?ID=2207,2208,2209&SplitQueueName=DocumentQueue

pdfsplit runs the configured splitters in order and stops at the first one that can split the PDF. The default order is the outline (bookmark) splitter, then the AI splitter, so a PDF with bookmarks is split by them and any other PDF goes to the model. It returns the new documents.

splitpdf is a fan-out: it queues one pdfsplit per ID on SplitQueueName (default: the installation’s default queue), passing every other parameter through. The Documents panel’s Split PDF option calls it through the queue.

Parameter Purpose
ID The document to split.
Target_* The parent of the new documents, e.g. Target_Object=Process&Target_ObjectID=42. Defaults to the package’s own parent.
Options_* Binds to the splitter options with the prefix removed, e.g. Options_Splitters=Ai, Options_DestinationPath=…, Options_Outline:NestLevel=1.
ImportFileTemplate Name of an import template whose Description replaces the AI splitter’s instructions. InstructionTemplate is a synonym.
PromptSignature A method signature whose JSON result is a list of document definitions. QBO builds classify-and-extract instructions from it (see below). Ignored when ImportFileTemplate is set.
SingleSplitDelete Default true: when the model finds only one document, the original is updated in place and the duplicate removed.
LedgerID Posts the call’s token usage to this ledger.

Each new document is saved with SetDocumentInfo, linked to the package with the link type Document Package Source, and stamped with the segment’s metadata. Metadata keys that match Attachment columns are set as fields (with MergeXmlData); keys that don’t are written to XmlData.

Option Default Purpose
Ai:AgentName PdfAnalysis The agent (IAgentManager) that receives the PDF. It must accept PDF content.
Ai:Chat Temperature 0, built-in instructions Chat options forwarded to the agent, including Instructions.
Ai:MaxResolution / Ai:ImageQuality 72 / 80 A downsampled copy is sent to reduce tokens; page numbers are unchanged. 0 disables downsampling.
Ai:MaxPageCount / Ai:MaxChunkBytes 500 / 40 MB Larger PDFs are cut into size-bounded chunks and sent together in one request, with a map of each chunk’s page range.
Ai:AddOutlineToSource false Adds a bookmark per segment to the original package.

The model must return a JSON array of segments:

[
{ "StartPage": 1, "EndPage": 3, "FileName": "FirstNoticeOfLoss", "DocumentType": "First notice of loss" },
{ "StartPage": 4, "EndPage": 9, "FileName": "RepairEstimate", "DocumentType": "Repair estimate",
"EstimateTotal": "8412.50 :: 0.94" }
]

StartPage and EndPage are required and 1-based. Extracted values use the value :: confidence convention. An empty array means the PDF isn’t compound, and nothing is split.

With PromptSignature, QBO invokes the signature, inserts its JSON as Document Definitions, and asks the model to match each segment to a definition’s DocumentTemplate, return its AttachmentTemplateID, and extract each of its ExtractionFields as its ValueType with a confidence. Segments must not overlap and must cover every page.

GET /api/attachment/pdfsplitbypage?ID=17&Pages=[{"startPage":1,"title":"Intro"},{"startPage":6,"title":"Body"}]
GET /api/attachment/pdfsplitbyoutline?ID=17&NestLevel=1
GET /api/attachment/pdfsplitbysize?ID=17&MaxFileSize=5000000
GET /api/attachment/pdfsplitbysemantics?ID=17&MaxFileSize=20000000

All accept Target_*. pdfsplitbypage, pdfsplitbysize, and pdfsplitbysemantics link each new document to the package as Document Package Source; pdfsplitbyoutline does not.

GET /api/attachment/queue/aiclassify?ID=2208,2209&AgentName=Gemini&DefaultTemplateID=4
GET /api/attachment/ailabel?ID=2208&AgentName=Gemini
GET /api/attachment/queue/aitranscribe?ID=2210&ScoreTemplateID=12
  • aiclassify chooses among attachment templates that have a Description (narrow with Template_* filters; add Template_nocache=true after editing descriptions). It OCRs first when the document has no text and OCR is configured.
  • ailabel applies every label (collection) whose SourceObject is Attachment and whose description fits. Narrow with Label_* filters.
  • aitranscribe appends a transcript of an mp3 to Description, then optionally calculates ScoreTemplateID.

Parameters and behavior: AI developer reference → Operations.

Extraction is a score calculated on the document with an AI engine:

GET /api/score/calculate?Template=Repair Estimate&Object=Attachment&ObjectID=2208
GET /api/score/queue/calculate?Template=Repair Estimate&Object=Attachment&ObjectID=2208
Engine Input Registry
AIScoreEngine Attachment.Description (converted to text if empty) Completion service (ICompleteManager)
AiModalEngine The original file, sent as document content Agent (IAgentManager)

Set AgentName, UseConfidence (default on), and, for the modal engine, FileExpirationMinutes in ScoreTemplate.EngineParameters. Each ScoreItem stores the typed value and its Confidence; Score.Confidence is the weighted average. Recalculate confidence with /api/score/calculateconfidence?ID=…. See Scoring developer reference and Scoring and import engines.

Batch engines are import engines. Create an import file from a template that uses one, then run it:

GET /api/importfile/queue/import?ID=1234
Engine Instructions Documents Each result
PdfSplitterBatchEngine ImportFileTemplate.Description ImportStatement, or Attachment/Search with the call’s parameters Attachment/ProcessPdfSplitterResult: one segment updates the document in place; several create linked child documents
ClassificationBatchEngine ImportFileTemplate.Description ImportStatement, or Attachment/Search One JSON object per document. Top-level properties are applied with SetProperties; the full object is saved to XmlData
AiBatchEngine Instructions parameter, or ImportFileTemplate.Description ImportStatement (required) ResponseMethod, a method signature substituted from each row, unless the statement returns a Response column

Engine options come from configuration (for example AsposePDF:PdfSplitterBatchEngine and GenerativeAI:ClassificationBatchEngine) and are overridden per template in ImportFileTemplate.ParameterString:

Option Default Purpose
Agent default (AI batch only) Agent name. It must implement IBatchChatClient (Claude, Gemini, OpenAI, or Bedrock with batch enabled).
PollIntervalMinutes 60 Time between status polls.
ProcessPartialResults true Recover and apply truncated responses.
QueueResults true Queue each result through ImportFileQueue instead of processing inline.
ProgressLogInterval 1000 Results between progress log entries.

Submission saves the provider’s batch ID in ImportFile.ExternalReference and schedules a poll. When a submission spans several provider jobs, each extra job gets a child import file. Per-document errors are written to the import log and counted in ErrorCount.

Pass LedgerID to pdfsplit, or Chat_LedgerID to agent-based operations, to post input, cached input, output, and reasoning tokens to a ledger. On Gemini, long instructions are folded into a cachedContent entry keyed by content hash, so a large set of document definitions isn’t re-sent with every request. See Token cost tracking.