Skip to content

Summarize Financial Data with a RAG workflow using Weaviate, Red Hat OpenShift and Red Hat Build of Apache Camel.

License

Notifications You must be signed in to change notification settings

redhat-na-ssa/demo-ai-weaviate

Repository files navigation

Summarizing Financial Data with a RAG workflow using Weaviate, Red Hat OpenShift and Red Hat Build of Apache Camel.

rag-demo High Level Components

Overview

This demonstration imports and syncronizes financial data from AlphaVantage into Weaviate's vector database which in turn uses a large language model to generate a summary in a traditional RAG workflow.

The Weaviate database is installed on Openshift as a stateful set providing a data parallel enterprise deployment. For the application developer, Openshift DevSpaces offers a full IDE experience within a Kubernetes environment. Finally, a simple example application based on Hugging Face's Gradio framework provides a user front-end.

dataflow Dataflow

To build the vector database, a number of company overviews are downloaded using AlphaVantage's Stock Market API and imported into Weaviate. This represents a private knowledgebase. Each overview consists of a short description along with sampling of financial metrics such as market capitalization, book value and earnings per share just to name a few. A user can then query the database using a natural language and Weaviate will return companies that are most similar to the concept. Finally, a generative search is performed using the granite3-dense:8b large language model (LLM) to generate a financial summary which is presented to the user. It is important to note that the summary is based on the financial data from the original company overview database and not the LLM.

financial-rag Application Screen Shot

Why run Weaviate On Openshift?

  • Support for Distributed Architectures.
  • A Great Developer Experience (Easily move code -> containers)
  • Access your cluster via the Weaviate Cloud Console with external routes.
  • Security (Doesn't run your containers as root)

Prereqs:

Manual Installation Steps

Install the following services on Openshift.

  1. Weaviate Vector Database
  2. Ollama Model Server
  3. Stock Overview Ingestion Engine
  4. Gradio UI and application.
Install Weaviate
Install Ollama
  • Install an Ollama model server in the ollama namespace.
    • The all-minilm and granite3-dense:8b models should be pulled after install. This can be done using curl or the ollama cli tool from an Openshift or DevSpaces terminal.
Stock Overview Ingestion Engine

The stock overview ingestion engine consists of two components.

  • A Caching Proxy

    • Follow the instructions to install the caching proxy in the camel namespace.
  • A Stock Overview Syncronizer

    • Follow the instructions to install the AlphaVantage syncronizer in the camel namespace. Configure the av-overview-sync-configmap configmap to use the granite3-dense:8b model.
Deploy the application.
  1. From a terminal, create an Openshift application.
oc new-app python~https://github.com/redhat-na-ssa/demo-ai-weaviate --context-dir=/src --name=rag \
--env WEAVIATE_API_KEY=your_weaviate_admin-api-key
  1. Expose the app with an external route and have fun.
oc create route edge --service rag --insecure-policy='Redirect'

Automated Installation (work in progress)

Clean up

oc delete all --selector=app=rag
helm uninstall weaviate

Remove the Openshift storage.

oc delete pvc weaviate-data-weaviate-0 weaviate-data-weaviate-1

Additional ways to get access to Openshift.

About

Summarize Financial Data with a RAG workflow using Weaviate, Red Hat OpenShift and Red Hat Build of Apache Camel.

Resources

License

Stars

Watchers

Forks

Languages