MachineCraft LogoMachineCraft
Retrieval (RAG)SHIPPED

Document Q&A

Load a document, ask questions, get answers grounded in the text — not the model's training. The simplest way to make a model speak from a source you trust.

The flow

What's in the pipeline.

Load one document and answer questions grounded in its contents.

  1. File
  2. Parse Data
  3. Chat Input
  4. Prompt
  5. Language Model
  6. Chat Output
Engine
Workflow EngineSHIPPED
Category
Retrieval (RAG)
Level
Intermediate
Components
6

Ask a model about a contract it has never seen and it will improvise. Document Q&A removes the guesswork for a single file: it loads the document, places the full text in front of the model, and asks it to answer from that — and only that. For one manageable document, it's the most direct path to grounded answers.

How it works

The document and the question travel two short paths that meet at the prompt:

  1. File loads the source — a PDF, a text file, a policy document.
  2. Parse Data extracts its text into a clean string the model can read.
  3. Chat Input takes the user's question.
  4. Prompt holds the full document text as the model's context, with instructions to answer only from it and to say so when the answer isn't there.
  5. Language Model answers the question against that context, and Chat Output returns the result.

Because the entire document goes into the prompt, the model sees everything at once — no retrieval step, no index to maintain. That's the strength and the limit: simple and complete for one document, but bounded by how much text fits in a single context window.

When to reach for it

Use Document Q&A for a single, self-contained document of reasonable size — a report, a contract, a spec, a paper — where you want answers that cite what's actually written. It's the fastest way to stand up grounded Q&A with nothing to configure beyond the file.

When to reach for something else

The whole document is loaded every time, so this approach stops fitting once a file is very long or once you have many files. At that point you want retrieval, not stuffing: Vector Store RAG indexes a whole corpus and pulls only the relevant passages per question. If there's no document at all and you just need a shaped response, that's Basic Prompting.

Try it

Load a document you know well and ask something only its contents could answer:

"What notice period does section 7 require, and what happens if it's missed?"

A grounded answer quotes or paraphrases the document. Then ask something the document doesn't cover — a well-built prompt makes the model say it can't find it rather than inventing a clause. That refusal is the behavior you want from a document assistant.

Stuffing vs. retrieval

Loading the full document into context is the right call for small files and the wrong one for large ones — long inputs cost more and eventually overflow the window. When that happens, it's the signal to move to Vector Store RAG.

Make this template yours.

MachineCraft is free during private beta. Join the waitlist and we’ll bring you in to start from this flow and adapt it to your work.