liveBook · Manning

Classification prompt

As explained in Knowledge Graphs and LLMs in Action

A classification prompt is a textual instruction that specifies categories, examples, and output requirements for classifying inputs.

A classification prompt instructs an LLM to assign an input to defined categories and return a consistent result. It supports intent detection by routing user requests to appropriate visualization or knowledge-management pipelines. section 14.5.1 section 14.5.2

Build a reliable classification prompt by specifying:

  • A clear task definition at the beginning. section 14.5.1
  • Distinct, explicitly defined categories and boundary cases that clarify difficult distinctions. section 14.5.1
  • Few-shot examples demonstrating the intended classification behavior. section 14.5.1 section 14.5.2
  • A required output format, optionally including a reason field for reviewing potential misclassifications. section 14.5.1 section 14.5.2
  • A fallback category when no defined class fits, preventing forced classifications. section 14.5.1

Routing a knowledge-management question

Classify each question as Data-Related, System-Related, or Feedback/Complaints. For System-Related questions, choose Documentation-Related or Schema-Related and return the question, category, optional subcategory, and reason. The question “How often is the knowledge graph updated to reflect the latest information?” can be classified as System-Related and Documentation-Related when update frequency is treated as documented system behavior rather than inferred from data timestamps. section 14.5.2

Figure 14.5 Intent detection system architecture for data visualization requests, showing how user requests are mapped to appropriate visualization formats (graph, chart, table, or map)
figure

Maps user intent to graph, table, chart, or map output formats. section 14.5.1

Figure 14.6 Classification of system-related questions in the intent detection system, showing how requests are routed either to documentation (for system functionality and feature questions) or to the schema (for KG structure queries). The system also identifies feedback and issues as a separate category for user complaints or enhancement requests.
figure

Shows how system-related questions divide into documentation, schema, and feedback or issue routes. section 14.5.2

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains prompt components, boundary handling, output formats, and misclassification review through concrete implementations.
Examples
Uses graph, table, chart, and map selection plus knowledge-graph update-frequency classification.
What it assumes
Assumes defined intents and destination pipelines while demonstrating category design and prompt structure explicitly.
What you can do after
Apply it via an LLM to classify questions, produce structured reasons, and route requests to appropriate downstream pipelines.
How it connects
Connects intent detection with few-shot prompting, knowledge graphs, data classification, documentation, schema, and visualization.

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.