Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat 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
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud 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

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • 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

AI-driven data extraction using Apache Camel and LangChain4J

September 5, 2024
Alexandre Gallice
Related topics:
Artificial intelligenceIntegrationJavaQuarkus
Related products:
Red Hat build of Apache CamelRed Hat build of Quarkus

Share:

    Always curious about the kind of challenges information technology companies are facing, I noticed a trend about unstructured data related topic these days. Explaining in details the differences between structured and unstructured data is beyond the scope of this blog post. Basically, examples of structured data could be dates, addresses and credit card numbers while unstructured data examples are more like natural language texts, videos and social media posts. Exploiting the value of unstructured data is a huge topic. And actually, explaining all the possibilities and limitations would take time. For the sake of brevity, let's just remind that large part of today's data is unstructured, the volume is growing quickly and companies are struggling to deal with it.

    As a contributor to the Red Hat Build of Apache Camel, I decided to experiment with Quarkus LangChain4j to extract such a structured information from raw text. Let's imagine a situation where an insurance company records the transcript of the discussion between customers and hotline. With Red Hat Build of Apache Camel, we could consume the conversation transcripts as raw text data from a lot of different systems. But how could we extract information like the customer name and birth date from the conversation transcripts to later store them in let's say a relational database? Is it possible at all anyway?

    AI-driven unstructured data extraction integration flow

    So, in search of answers, I started to build a prototype as shown in the schema above. In input, we have a raw text conversation between an operator and a customer. This conversation is injected inside a large language model prompt through the use of a LangChain4j AI service as demonstrated here. Then, the large language model answers with a JSON document containing the extracted customer satisfaction, name, birthday and also a short summary of the input conversation. As a last step, LangChain4j transforms this JSON document into a Java object.

    Building this prototype was a good opportunity to learn. After an initial period of infancy, I eventually realized that explicitly configuring the model to output JSON only responses was paramount. Step by step, I had success in extracting structured information from 3 conversations transcripts with a 7 billion parameter model. It takes quite some time for the model to give answers as I don't have any dedicated graphical processor units on hand to speed up computation. Still, I was able to create a Camel Quarkus community example where you can find all technical details.

    Now, beyond a simple proof of concept, it would be interesting to see what it takes to implement a true business like scenario. From previous experience in a handwriting recognition company, I would say that the key is to check whether the extraction accuracy is high enough to trigger return on investment. As such, it would be interesting to see what accuracy could be achieved by changing the model, using a 30 billion parameter model or improving the prompt for instance. For such an experience to be realistic, it would need at least a set of 100 conversations with expected output, plus some graphical processing units compute power. Anyone interested?

    If yes, I would propose my readers to review the unstructured data they have at disposal and imagine the value that could be derived from it. Anyone having an interest could then play with the community example. And there is a good news here for Red Hat customers entitled to use the last supported version of Red Hat Build of Apache Camel Quarkus. Indeed, you don't need to migrate to the latest upstream version and can experiment data extraction straight away with the Red Hat version.

    I've tested this setup at this commit level with Openjdk 21 and Apache Maven 3.9.6. You simply need to amend the pom.xml file with the setup below:

    <properties>
     <quarkus.platform.version>3.8.5.SP1-redhat-00001</quarkus.platform.version>
     <camel-quarkus.platform.version>3.8.5.SP1-redhat-00001</camel-quarkus.platform.version>
     <quarkus.platform.group-id>com.redhat.quarkus.platform</quarkus.platform.group-id>
     <camel-quarkus.platform.group-id>${quarkus.platform.group-id}</camel-quarkus.platform.group-id>
     <camel-quarkus.platform.artifact-id>quarkus-camel-bom</camel-quarkus.platform.artifact-id>
    </properties>
    
    <pluginRepositories>
     <pluginRepository>
      <id>redhat-ga</id>
      <url>https://maven.repository.redhat.com/ga</url>
     </pluginRepository>
    </pluginRepositories>
    <repositories>
     <repository>
      <id>redhat-ga</id>
      <url>https://maven.repository.redhat.com/ga</url>
     </repository>
    </repositories>

    Of course, Quarkus LangChain4j is not supported yet, still it's possible to experiment and contact Red Hat in case of interest.

    That's it for today. So far, I hope we have learned a bit about unstructured data and seen a prototype in action. Maybe it would give ideas for people to experiment data extraction with true business data.

    Last updated: September 9, 2024
    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 to implement and monitor circuit breakers in OpenShift Service Mesh 3

    • Analysis of OpenShift node-system-admin-client lifespan

    • What's New in OpenShift GitOps 1.18

    • Beyond a single cluster with OpenShift Service Mesh 3

    • Kubernetes MCP server: AI-powered cluster management

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2025 Red Hat

    Red Hat legal and privacy links

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

    Report a website issue