Skip to main content
For example, say you have a stack of customer order forms in PDF format, each with an identical layout but different content per order. You might want to extract common fields like customer IDs, item quantities, and order totals. Normally, that would require you to write custom logic yourself. With Transform, you can include natural language instructions for how to extract these fields—either in your initial prompt, or a follow-up prompt after you’ve had Transform perform the initial partitioning of your files. For detailed information on how the structured data extractor works, see Structured data extraction.
Transform uses the LLM capabilities of the Unstructured structured data extractor. To use regex expressions to extract structured data, use the Pipelines API. For more information, see Choose an extraction method: LLM or Regex.

Selecting and structuring the data

Transform enables you be as specific as you need to be about what data gets extracted from your files, and how that data is structured (that is, its schema.) When extracting data from files, you can use Transform to:
  • Have your agent suggest a schema for your review and approval, based on the information in the files themselves.
  • Have your agent draft a schema based on what information you tell it you want extracted.
  • Explicitly provide a schema to use when extracting the data.

Prompt examples

For example, let’s use the Caring for houseplants infographic example from Additional examples: Caring for houseplants To have your agent suggest a data schema based on the file contents, use a general prompt like the following:
To get more specific about what types of data you want included, state which data types are important in the prompt:
To get even more specific about the data formatting, include information such as data type and data structure in your prompt:
And finally, to specify the actual schema to use, include it in the prompt as in the following example, or include a file location where it can be uploaded:

Additional extraction prompt patterns

If you want to process a batch of several similar documents, ask for one consistent structure across all of them:
If you just want a specific output shape without specifying schema terminology:
For patterns that apply across all of Transform’s capabilities see Prompting strategies.

Considerations

Things to consider when writing prompts for structured data extraction:
  • Image, PDF, and PPT input files benefit from saying “extract” in the prompt, rather than just “read” or “summarize”. This phrasing nudges the agent toward using extraction functionality rather than a standard parsing of the file(s).
  • If your first extraction attempt comes back sparse, use wording similar to the prompt below to get your agent to redo the job with the High Res partitioning strategy plus relevant enrichments. This should lead to better results.

Next steps

  • Control Transform file parsing output: Control how the Unstructured Transform MCP server instructs Transform to partition, enrich, chunk, and embed the data based on your files.
  • Control Transform generated sample code: Control how the Unstructured Transform MCP server generates sample curl or Python code that demonstrates how to use Transform to partition, enrich, chunk, and embed the data based on your files.

Questions? Need help?