liveBook · Manning

Intent detection

As explained in Knowledge Graphs and LLMs in Action

Intent detection is the technique of identifying a user's goal, information need, or preferred answer format from a question.

Intent detection identifies what a user wants from a question, including the answer’s purpose and presentation format. In a knowledge-graph question-answering system, it runs first so the system can select an appropriate pipeline, imitate expert reasoning, and remain easy to inspect and debug. section 14.5

Implement intent detection as an evolving, staged classification pipeline:

  • Define classes that match available system routes and outputs; revise, merge, or extend them as production needs change. section 14.5.1
  • Classify broad question categories: data-related questions, system-related questions, and feedback or complaints. section 14.5.2 section 14.9
  • Subdivide system-related questions into documentation-related requests and schema-related questions, routing each to the relevant source of answers. section 14.5.2
  • For data questions, classify the desired visualization as graph, table, chart, or map. section 14.5.1 section 14.9
  • Prompt the LLM with clear instructions, category definitions, examples, boundary cases, an expected output format, and a fallback category. section 14.5.1
  • Pass the detected intent into query generation so graph and map requests return connected nodes and relationships, while table requests select and rename properties for columns. section 14.7.2

One question, different routes

A request about red Camaros spotted by cameras may require a graph showing vehicles, cameras, and their relationships, a table listing plates, locations, and capture times, or a map using camera locations. By contrast, “How do I export data to CSV?” is documentation-related, while “The system keeps freezing” is feedback or a complaint. section 14.5 section 14.5.2

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

Use the classification diagram and prompt listing to trace how system-related questions divide into documentation, schema, and feedback routes. section 14.5.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

Use the flow diagram to connect detected intent with schema-aware Cypher generation and structured JSON output. section 14.7.2

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains two classification layers, prompt safeguards, and intent-dependent Cypher requirements, but does not detail a trained classifier.
Examples
Uses red Camaro investigations, graph/table/chart/map outputs, CSV export, risk assessment, system complaints, and knowledge-graph update questions.
What it assumes
Assumes a knowledge graph, available visualization or documentation routes, an LLM, and an annotated schema that query generation can use.
What you can do after
Build it from scratch as a layered LLM classifier that routes questions and supplies output-specific requirements to query generation.
How it connects
Connects natural-language question answering with knowledge graphs, prompt engineering, visualization, schema extraction, and Cypher query generation.

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.