liveBook · Manning

Output specification

As explained in Knowledge Graphs and LLMs in Action

An output format specification defines the required structure, fields, data types, and validity constraints of a system response.

An output specification defines the required response structure, fields, data types, and validity constraints. In a natural-language-to-Cypher pipeline, it serves as the final prompt component that directs the model toward structured JSON output. section 14.7.2

A complete specification sits after the prompt has assembled:

  • The user’s question, delimited for clear instruction boundaries. section 14.7.2
  • The annotated graph schema that the generated Cypher query must follow. section 14.7.2
  • Intent-dependent requirements, examples, optional user selections, and knowledge-graph-specific annotations. section 14.7.2

Natural language to Cypher

A prompt asks an LLM to translate a user question into a Neo4j Cypher query, supplies the graph schema and requirements, and specifies structured JSON as the response format. section 14.7.2

Figure 14.11 The complete flow of transforming a natural language question into a Cypher query, showing how three inputs are processed through structured prompt components. The process is organized into three stages (Input processing, Context building, and Final guidelines) that culminate in structured JSON output.
figure

The pipeline diagram connects input processing, context building, and final guidelines before producing structured JSON output. section 14.7.2

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Defines the specification as a final prompt component and traces its role to JSON output, without detailing standalone validation procedures.
Examples
Uses a structured prompt containing a delimited question, annotated schema, requirements, examples, and a JSON response format.
What you can do after
Apply it via structured prompting to guide an LLM toward schema-following Cypher queries and structured JSON responses.
How it connects
Connects Cypher queries with Neo4j graph databases, natural-language questions, schema definitions, intent detection, and structured JSON output.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.