---
title: "Architecture patterns for Libraries"
description: "Methods for ensuring document extraction fidelity in Library cover manual extraction of critical documents and reporting extraction failures."
lang: en
status: public-preview
lastUpdated: 2026-09-04
url: https://duale.ai/en/docs/libraries/patterns
---

## AI-generated summary

Patterns for handling real documents where extraction fidelity matters, covering when to extract text yourself and when to report a failing document to support.

- Covers extracting critical documents outside the platform and uploading checked text instead.
- Explains when to use this pattern: complex charts, dense figures, engineering diagrams, or scans.
- Describes how to report a badly extracted document with evidence to technical support.
- States that extraction is best effort, not a fidelity guarantee, especially for visual content.

Summaries were generated by AI. Generative AI is experimental.

---

A pattern here is a situation you will meet with real documents, and the method that answers it. Each
one names what you get, what to do, and the check that proves it worked.

## Extract a critical document yourself, then upload the text

**Use it when** a document has to be exactly right. Examples include a complex
chart, a dense statistical figure, an engineering diagram, or a scan. Also use
it when meaning sits in the relationships between parts rather than in the
sentences.

**What you get.** You decide the fidelity of what your agent reads, and you can prove it before a
single answer depends on it.

The platform tries to extract text and pictures from each supported document you upload. Extraction is best effort,
not a fidelity guarantee, and the gap is widest where the meaning is visual. A chart carries
its meaning in the relationship between an axis and a series. A statistical table carries it in the
alignment of rows and columns. Those survive extraction less reliably than a paragraph does.

Two facts make this pattern work:

- **Prefer a source that already contains text.** The platform can read words directly from `.md`,
  `.txt`, `.docx`, and Apple Pages files. A scan or an image of a diagram relies on OCR and visual
  extraction. A PDF can contain text, pixels, or both.
- **Review critical visual content separately.** A person can check the relationships between
  labels, numbers, rows, columns, and pictures against the rendered source. This takes more work,
  so reserve it for documents where an extraction error changes an outcome.

Do this:

1. **Extract the document outside the platform**

   Use a person or a specialized extraction tool that reads the rendered page and writes out its content.
2. **Check the extraction against the original**

   Have a person compare them. The question is not whether the text reads well. It is whether every number, label,
   relationship, and caption still says what the original said.
3. **Upload the checked text version**

   Save it as Markdown, plain text, or a word-processor document, and upload that instead of the original.
4. **Ask the question that depends on it**

   Ask your agent for a value that appears only in the hardest part of the document. A correct answer proves the path
   end to end.

Keep the original file wherever you keep your records. This pattern changes what your agent reads,
not what your organization holds.

## Report a document that extracts badly

**Use it when** you find a document whose extracted text does not carry what the original said, and
you would rather the platform read it correctly than work around it.

**What you get.** A report with enough evidence for support to reproduce the problem, plus checked text that keeps
your task moving while support investigates.

Duale AI owns the extraction path, so a specific failing document gives the team evidence it can
act on.

1. **Confirm what extraction lost**

   Open the document preview in the Dashboard and compare it with the original. Record text that is wrong or missing,
   not text that the preview merely shortens.
2. **Record the minimum evidence**

   Note the document identifier, file name, file type, and the expected and observed text. Include the `request_id`
   when an error response provides one.
3. **Send the report to technical support**

   Email [contact+support@mail.duale.ai](mailto:contact+support@mail.duale.ai) with the evidence. Do not attach a
   sensitive source to ordinary email. Ask support for a secure transfer method if the team needs the original.
4. **Upload checked text as a temporary source**

   Follow the pattern above, then ask a question that depends on the missing content. A correct answer proves that the
   temporary source works end to end.

If the checked text still gives a wrong or incomplete answer, compare its Dashboard preview with
what you uploaded, then follow
[Troubleshoot a missing answer](https://duale.ai/en/docs/libraries/what-agents-can-do.md#troubleshoot-a-missing-answer).

## Related content

- [Get better answers from a Library](https://duale.ai/en/docs/libraries/best-practices.md)
- [How the platform protects and removes your documents](https://duale.ai/en/docs/libraries/security.md)
- [Model routing architecture patterns](https://duale.ai/en/docs/model-routing/architecture-patterns.md)
- [Manage Libraries and documents with the SDK](https://duale.ai/en/docs/sdk/manage-libraries.md)
- [Know what the platform defends](https://duale.ai/en/docs/security/threat-model.md)
- [Design your Libraries by reader group and agent reach](https://duale.ai/en/docs/libraries/design.md)

---

## Sitemap

See the full [Markdown sitemap](https://duale.ai/sitemap.md) for all pages.
