Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Exploring an insurance use case with AI and Node.js

February 7, 2025
Lucas Holmquist
Related topics:
Artificial intelligenceNode.jsRuntimes
Related products:
Red Hat build of Node.js

Share:

    Welcome back to this ongoing series of posts about using Large Language Models(LLMs) with Node.js.  This post will serve as the conclusion as we see how all the previous posts come  together to illustrate how AI can be integrated into an existing Claims Management System for an insurance company

    Before we start, here is what the series looks like up to this point:

    Experimenting with a Large Language Model powered Chatbot with Node.js | Red Hat Developer

    Experimenting with Email generation and summarization with Node.js and Large Language Models | Red Hat Developer

    Improving Chatbot result with Retrieval Augmented Generation (RAG) and Node.js | Red Hat Developer

    Chatbot, I Choose You….. to call a function

    Application Overview Review

    The application that was used to demonstrate all the features was a very basic claims management system. It is similar to something that an insurance company might use to process their insured's claims.

    Parasol Insurance Application

     

    The application front-end was written in react and the backend in node.js, using the Fastify framework for the REST apis and langchain.js as the interface between the application and the Large Language Models(LLMs)

    Adding a chatbot

    As mentioned in the first post, a chatbot was constructed for users of the application to ask it questions about the claims to better service their customers.  The user could ask something like: “What happened here?” and the chat bot would give a succinct summary of this claim.

    Throughout that post, we explored some of the basic building blocks when writing AI applications.  Some of those concepts were about connecting to models, constructing prompts and creating chains.    We also added the ability for the chatbot to store the message history using methods from the lanchain.js framework.  This added to the chatbot's ability to have a more natural conversation as well as having some context of previous questions asked.

    Email Generation and Output Parsers 

    The next post in the series had us adding the ability to generate email summaries that could potentially be sent out to a customer.  However, generating summaries wasn’t just the main concept of this post.  

    We learned how we could leverage the use of output parsers to have our response from the LLM to be formatted a certain way.  Our Web UI wanted our response to be in JSON and by leveraging langchain.js’s output parsers, as well as defining a schema to send to our model using the popular Zod schema framework, we were able to output the format we wanted.

    Retrieval Augmented Generation

    In the third post, we expanded our chatbot with extra knowledge without having to retrain the model it was using.  This concept is called Retrieval Augmented Generation or RAG.  Each insured might have different information in their policies and retraining models can be expensive.  Policy data is also very sensitvie, so storing that information in a model might not be possible.  So being able to add some more context based on some external resource can be very handy.

    As the article stated, there are two main concepts of RAG, Indexing and Retrieval, and we saw how each of those concepts could be added to our chatbot code to give it a little more context when answering questions.

    In the example, we wanted the chatbot to be able to answer questions from an insurance policy that was in a pdf.  We saw that by using the langchain.js framework, we could easily load the pdf.  We used an in-memory vector store to index it.  Then a retriever was created that could easily be added to our current chain.

    Tools/Functions

    The last post in the series gave a brief overview of the concept of having our LLM call a function when responding to a request.

    The chatbot was updated so when a user said something like “Update this claims status to approved”, our LLM would parse that request, see that we’ve created a function called “UpdateClaimStatus” and would call that.  This function would then update that claims’ status in the database.

    Conclusion

    While the claims management system we added the chatbot and other features to was fictitious, it illustrates a real world scenario of how a small amount of code can add some powerful AI features to aid in day-to-day scenarios.

    As always if you want to learn more about what the Red Hat Node.js team is up to check these out:

    https://developers.redhat.com/topics/nodejs

    https://developers.redhat.com/topics/nodejs/ai

    https://developers.redhat.com/blog/2024/11/20/essential-ai-tutorials-nodejs-developers

    https://github.com/nodeshift/nodejs-reference-architecture

    https://developers.redhat.com/e-books/developers-guide-nodejs-reference-architecture

     

    Last updated: February 10, 2025
    Disclaimer: Please note the content in this blog post has not been thoroughly reviewed by the Red Hat Developer editorial team. Any opinions expressed in this post are the author's own and do not necessarily reflect the policies or positions of Red Hat.

    Recent Posts

    • How Trilio secures OpenShift virtual machines and containers

    • How to implement observability with Node.js and Llama Stack

    • How to encrypt RHEL images for Azure confidential VMs

    • How to manage RHEL virtual machines with Podman Desktop

    • Speech-to-text with Whisper and Red Hat AI Inference Server

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue