DEV Community

Cover image for Generative AI-driven Chatbot for the Factory Plant
Fabio Beoni
Fabio Beoni

Posted on • Updated on

Generative AI-driven Chatbot for the Factory Plant

This is the first article of a short series presenting a proof-of-concept (P.O.C) about the adoption of the generative AI technology to implement a digital agent to talk to an environmental pollution (PM2.5/PM10) monitoring system. Serving a fictitious cements factory, the main goal of the digital agent is safeguarding workers and machines, providing technical knowledge to adopt safe behaviors and guide maintenance actions.

The recent raising of AI and large language models like Chat-GPT enables dialog interaction between people and machines or systems, without learning new tools or software.

I had the opportunity to work on a similar system, for a real project in a different business domain, using technologies other than generative AI. Recently AWS released Amazon Bedrock Studio, a low-code tool to create gen-AI apps using top-class large language models from main market providers like Anthropic and Meta. I decided to roll up one's sleeves in give it try.

Business Context

In several businesses, many kind of processes to produce goods do generate particulate matter (PM) pollution, including PM 2.5 and PM 10. These particles are small enough to be inhaled and can cause serious health problems to workers, as well as have negative impacts on machinery and equipment. Fine particles can accumulate on surfaces and in moving parts, leading to wear and tear, reduced efficiency, and increased maintenance costs. PM can cause corrosion and damage to electronic components, which can lead to equipment failure and costly repairs.

In a cement factory where normally raw materials such as limestone, clay, and sand are processed and transformed into cement through a series of steps that include crushing, grinding, mixing, and heating in kilns, PM pollution must be monitored and reduced through the use of various air pollution control devices and techniques, such as electrostatic precipitators, fabric filters, and many more.

Business Problems

  • Current lack of real-time air quality monitoring poses a risk worker health and machines reliability,
  • Workers do not have easy access to procedures and guidelines, getting difficult and inefficient to take actions against a degrading air quality,
  • Missing of a track history of pollution data does not enable analysis and data-driven decision-making,
  • Failure to comply with relevant legislation and regulations can result in fines, penalties, and reputational damage.

P.O.C. Solution - Business View

  1. S.O.P., guides, relevant documents - to feed the generative AI model and chatbot agent with the company's know-how and procedures,
  2. Gen-AI chatbot agent - to answer workers' questions about environment air quality status, get guidelines and procedures,
  3. Cloud IoT digital platform & storage - to manage the PM sensors data flow and storage,
  4. IoT gateway and service - to get pollution data from the sensors, push them to the IoT digital platform,
  5. PM 2.5/10 sensors - distributed across the production plant, to gather pollution values from the working environment in near real-time.

Solution Diagram - Business View

The Invisible Super-Power of the Gen-AI

We all know how good it is to create new text, images/videos, charts. Following this use-case you can discover how powerful it becomes in combination with other actors like the IoT platform, or any other source of business data.

Normally, when you want a chatbot to interact with some source of data you must define logical flows (and code it). Coordinate the interactions between the user and software components (REST APIs or so), that's a lot of IT work.

This is how a standard project without gen-AI would handle the chatbot configuration, as well as the interaction between it and all sort of data needed to answer user's questions:

Professionals Tasks to Carry Out
Analyst + UX Expert
  • define all possible user/chatbot interactions (questions, answers, paths, side-cases, errors),
  • draw logical flows according to the use-cases,
  • define what kind of data the chatbot needs,
  • define all examples needed to train the chatbot engine (many),
  • define all tests to run against the chatbot.
Architect
  • define how to implement the integrations between the chatbot and the sources of data (can be internal REST APIs, databases, third-party tools and so on).
Developer
  • configures the project environment,
  • configures the chatbot flows and examples,
  • implement the integrations to the data sources,
  • runs the tests.
Developer + Analyst + UX Expert
  • re-do the process for every test failing, or
  • for every new side-case emerging during the production use by the end-user.

While adopting gen-AI, and specifically Amazon Bedrock Studio used in this P.O.C., you rely on the gen-AI semantic and reasoning capabilities to automatically figure-out:

  • chatbot answers
  • logical flows
  • test cases
  • data needed to answer
  • what external data sources are mandatory to answer, automatically selecting them from a known list (!)
  • logical flows to call the external data sources and get data (!)
  • automatic engagement of the end-user when some mandatory information was not provided in original question (!)

So that the IT professionals and tasks change as follows:

Professionals Tasks to Carry Out
Analyst
  • define a very few examples of questions, and some sample answers (optional),
  • define a very few tests.
IT Product Specialist
  • configures the project environment,
  • list and describe available sources of data to the gen-AI,
  • list examples and tests to the get-AI,
  • asks the get-AI (different LLM) to generate some additional synthetic examples and related tests
  • runs the tests.
Analyst + IT Product Specialist
  • refine gen-AI examples for every new side-case emerging during the production use by the end-user.

As a result, you gain:

  • a much cleaner configuration process,
  • easier work for IT people to carry out,
  • a much smaller risk of unanswered questions (happy users),
  • increased time to market.

P.O.C. Solution - Technologies & Architecture

  • Amazon Bedrock Studio (low code AI app builder):

    • LLMs: Amazon Titan Embeddings, Anthropic Claude
    • Chatbot Agent & Web chat app
    • Knowledge-base: AWS OpenSearch Serverless
    • PM Querying function: AWS Lambda
    • AA.: AWS Identity Center & Policies
  • AWS IoT Core (IoT platform):

    • Gateway twin: AWS IoT Thing
    • Message routing: AWS IoT Rule
    • Data storage: AWS DynamoDB
    • AA.: Certificates & Policies
  • Raspberry Pi4 (gateway):

    • Data reader service: NodeJS runtime, Nova sensor driver, mqtt client
  • Nova PM sensor SDS011 (pollution sensor)

Solution Diagram

Next

Coming Soon:

  • Part 2 - Configuring the Amazon Bedrock Studio Workspace (TCH)

  • Part 3 - Configuring application components: Chatbot Agent, LLM, Knowledge-base.

Top comments (0)