chapter seventeen

17 Question Answering System using LangGraph and Streamlit

 

This chapter covers

  • Implementing the expert-emulated approach
  • Practical example of investigation through question answering
  • How to adapt and improve the system

In this chapter, we'll create a practical application for querying knowledge graphs using large language models. Drawing together the concepts and techniques explored in chapter 16 - visualized in the mental model in figure 17.1 - we'll demonstrate how to build an integrated solution. Using LangGraph as our orchestration framework, we'll show how each stage can be combined into a seamless pipeline. To make this accessible and user-friendly, we will use Streamlit as a front-end interface.

Figure 17.1 Overview of the system architecture introduced in the previous chapter. We'll implement this using Streamlit to handle user input (questions and user selection) and output (visualization and summaries), while LangGraph will orchestrate the core pipeline.

For hands-on learning, this chapter is accompanied by a code repository containing the complete implementation and configuration files, allowing you to easily follow along and reference the code as we progress through the concepts.

17.1 Building the LangGraph pipeline

17.1.1 System Architecture Overview

17.1.2 Configuring Pipeline Components

17.1.3 Schema Translation Service

17.1.4 State Management Design

17.1.5 Pipeline Agent Implementation

17.1.6 Pipeline Integration Layer

17.2 Streamlit application

17.2.1 Application overview

17.2.2 LangGraph Integration

17.3 Expert-emulated investigation

17.3.1 Identifying the initial case

17.3.2 Spatial analysis of surveillance coverage

17.3.3 Vehicle pattern detection

17.3.4 Context-aware request refinement

17.3.5 Historical record analysis

17.4 Future directions and enhancements

17.4.1 Learning from usage

17.4.2 Enhancing core capabilities

17.4.3 Advanced evolution paths

17.5 Summary

17.6 Reference