A schema formally specifies the structure and permitted content of a data representation. In retrieval systems, it turns source records into searchable fields; in prompt engineering, it constrains generated JSON to an intended shape. section 8.3 section 6.4.1
A schema can assign different roles to fields:
- Tag fields store categorical labels that support Boolean filtering. section 8.3
- Text fields store titles, descriptions, dates, and content for full-text search. section 8.3
- Vector fields store embeddings with an indexing algorithm, numeric type, dimension, and distance metric. section 8.3
- A JSON schema prompt lists allowed output fields and discourages additional fields. section 6.4.1
Blog retrieval index
A Redis index named posts defines url as a tag, title and content as text, and embedding as an HNSW vector with FLOAT32 values, 1536 dimensions, and cosine distance. The schema is then supplied when creating the index.
Constrained entity extraction
A system instruction asks an AI assistant to extract entities as JSON using only the_name, the_company, and a_phone_number. Tightening the schema prevents an unwanted the_email field from being added.











































