Skip to main content
POST
Document question answering (image + optional word_boxes)

Body

application/json

Request for document (image) question answering pipelines.

image
required

Image of the document (PIL-like object, base64 string or binary upload). Required.

question
string
required

Question to ask about the document. Required.

word_boxes
(string | number[])[] | null

Optional list of (word, box) tuples or normalized bounding boxes to provide OCR words/boxes.

top_k
integer
default:1

Number of top answers to return.

doc_stride
integer
default:128

Stride size for splitting long documents into chunks with overlap.

max_answer_len
integer
default:15

Maximum length (in tokens) for returned answers.

max_seq_len
integer
default:384

Maximum total sequence length (context + question) in tokens.

max_question_len
integer
default:64

Maximum question length after tokenization.

handle_impossible_answer
boolean
default:false

If true, allow returning an 'impossible' / no-answer result.

lang
string | null

Language hint for OCR; default is English if omitted.

tesseract_config
string | null

Extra configuration flags to pass to Tesseract OCR (if used).

timeout
number | null

Maximum time in seconds to wait for external image fetching/processing.

Response

200 - application/json

Document QA response

score
number
start
integer
end
integer
answer
string
words
integer[]