Summarization with Retreival Augmented Generation (RAG) AI workflow

This solution pattern integrates a number of open source technologies to create a solution that ingests and summarizes near real-time stock data. It mimics how a human would analyze and summarize financial information from a variety of companies that trade on the NYSE and NASDAQ markets. It is intended to be used as a starting point for your own solution.

Contributors: Bob Kozdemba and Josh Reagan, Principal Specialist Solution Architects, Red Hat, Inc.


Solutions Patterns help you understand the art of the possible with Red Hat’s portfolio, and not intended to be used as is for production environments. You are welcome use any part of this solution pattern for your own workloads.

1. Use cases

Addtional common use cases that can be address with this architecture are:

  • Summarization of unstructed data and documentation

  • Medical claims processing

    • Improvement in staff productivity through automation of repetitive tasks

    • Reduced error rates in claims validation

    • Elevated customer satisfaction scores due to faster and accurate claims processing

  • Customer Service

    • Chat Bots

    • Improve the Customer Experience

    • Access fresh/real-time product information

  • Summarizing Real Time Events

    • A sports writer wants to summarize their notes on an event that an LLM was not trained on.

2. The story behind this solution pattern

This solution pattern uses a Retreival Augmented Generation (RAG) AI workflow to to summarize financial data from a stock symbol API service. The use of AI in this scenario provides a financial analyst with a starting point and is especially helpfull when comparing a number of different stock symbols at once. Data returned from a stock symbol service is often terse including many acronyms and abreviations. The goal is to demonstrate how AI technologies can be used to summarize the financial data in a way that is more concise and meaningful in a short period of time with minimal human intervention.

The solution begins by using Red Hat Build of Apache Camel to ingest and syncronize publicly aviable financial data into a vector database powered by Weaviate. The json formatted data returned from the stock symbol service conists of a company description followed by a number of financial metrics such as revenue, profit, market capitalization, etc.

The RAG workflow consists of a vector database, an embeddings model (used to convert words into vectors) and a large language model (LLM) to summarize the results which is presented to the user. This approach is desirable when information changes frequently or in semi-real time. For example, new stock prices are published every 15 minutes. As an alternative to fine tuning an LLM to recognize your private knowledge, Retreival Augmented Generation (RAG) provides a reasonable approach to this solution with good accuracy.

3. The Solution

This solution patterns consists of the following open source components which are hosted on the Red Hat Openshift container platform:

  • Red Hat Build of Apache Camel

  • Weaviate Vector Database

  • The Ollama model server

  • A Cloud Native User Interface built with Gradio