Skip to main content

Natural-language querying of external data sources

Italy - Senate

Use case ID: 030

Author: Senate of Italy

Date: 12 June 2024 

Objective: 

Enable users to query external data sources, such as the Italian National Institute of Statistics (ISTAT) website or the Normattiva website (portal of current laws), using natural language, in order to enhance accessibility and the user experience by allowing intuitive, human-like interactions with external datasets. 

Actors: 

  • Senate website users (citizens, researchers and journalists)
  • Senate IT and web development team 

Prerequisites: 

  • Access to external data sources via application programming interfaces (APIs) or web scraping
  • Trained large language model (LLM)-based artificial intelligence (AI) model for understanding and processing natural-language queries
  • Internet accessibility for users 

Scenario: 

  1. The user accesses the Senate website.
  2. The user enters a query in natural language (e.g. “What is the latest unemployment rate according to ISTAT?”) in the search bar.
  3. The LLM-based AI model processes the natural-language query to understand the intent and key terms.
  4. The AI system sends a request to the relevant external data source (e.g. the ISTAT website) to retrieve the requested information.
  5. The external data source returns the relevant data to the AI system.
  6. The AI system formats the data and presents it to the user in a user-friendly format.
  7. The user can refine their search or ask follow-up questions in natural language to obtain more specific information.
  8. The system logs the query and results for continuous improvement of the LLM-based AI model. 

Alternate flows: 

  • If the LLM-based AI model cannot understand the query, it prompts the user to rephrase or provides suggestions.
  • If the external data source is unavailable or returns incomplete data, the system informs the user and suggests alternative sources. 

Expected results: 

  • User satisfaction is improved owing to quick and accurate responses to queries from external data sources.
  • Usage of the Senate website's search functionality for accessing external data is increased.
  • It takes less time and effort for users to find specific information from external datasets.
  • Accessibility for users unfamiliar with querying technical databases or websites is improved. 

Potential challenges: 

  • Ensuring the LLM-based AI model can accurately understand diverse phrasing and terminologies related to external datasets
  • Handling queries that require complex data processing or multiple external sources 

Data requirements: 

  • Historical queries and user interactions for training and improving the LLM-based AI model
  • Access to APIs or web scraping tools for retrieving data from external sources
  • Real-time user query data for ongoing learning and adaptation  

Integrations with other systems: 

  • LLM-based AI processing systems and models
  • APIs or web scraping tools for accessing external data sources
  • User interface components for displaying query results 

Success metrics: 

  • Query response time
  • User satisfaction ratings and feedback
  • Accuracy and relevance of query results from external data sources
  • Reduction in user queries requiring manual intervention or support

 

The Use cases for AI in parliaments collection is published by the IPU’s Centre for Innovation in Parliament as part of the Parliamentary Data Science Hub’s project to create guidelines for AI governance in parliaments.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International licence. It may be freely shared and reused with acknowledgement of the author and the IPU. 

A use case describes how a system should work. It is used to plan, develop and measure implementation. A use case is not the same as a case study, which is a descriptive text of an actual project’s implementation. Please note that this use case is provided “as is” and neither the IPU nor the author accepts any responsibility for its use.

For more information about the IPU’s work on artificial intelligence, please visit www.ipu.org/AI or contact [email protected]