The text discusses the challenges of generating structured outputs from large language models (LLMs) and presents a solution using constrained sampling. Constrained sampling is a technique that incorporates constraints into the generation process to ensure outputs adhere to predefined structures, such as JSON or XML formats. This approach bridges the gap between LLMs' creative capabilities and the precision required for structured outputs. The text also introduces finite state machines (FSMs) as another tool for enforcing structural consistency in generated outputs. FSMs provide a formal framework for defining constraints and guiding the model to produce outputs that conform to specific structures. The combination of guided sampling and vector databases enables systems to handle both unstructured data processing and structured output generation, making it possible to build robust AI applications with high precision.