Structured extraction converts unstructured text into a predetermined format such as fields, records, tables, or key–value pairs. It addresses a limitation of text embeddings: semantic similarity supports retrieval, but not reliable filtering, sorting, counting, or aggregation. LLMs can identify required information and produce structured data for analysis, retrieval, or knowledge graph construction. section 6.0 section 6.1
A practical extraction workflow typically follows these steps:
- Define the target schema, including field names, types, descriptions, required values, nested objects, and permitted enum values. section 6.1.1
- Process source documents with an LLM and request output that conforms to the schema through function calling or schema definitions. section 6.1 section 6.1.1
- Store the resulting structured records in a graph database such as Neo4j, where entities and relationships support more precise queries. section 6.1 section 6.2.3
- Preserve useful source context by combining extracted structure with unstructured data; for legal documents, split text by clauses rather than only by token or word count. section 6.2.3
Extracting contract records
A contract schema can represent the contract type, parties, effective date, term, and scope. Each party can be a nested organization object containing its name, location, and role. An enum can constrain contract types to values such as Service Agreement, Licensing Agreement, Non-Disclosure Agreement, Partnership Agreement, or Lease Agreement. The extracted JSON can then populate a legal knowledge graph for filtering contracts, relating organizations, and answering multihop questions. section 6.2.3



