Summarizing Financial Data with a RAG workflow using Weaviate, Red Hat OpenShift and Red Hat Build of Apache Camel.
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.
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.
- 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)
cluster-admin
access to Red Hat Openshift- An AlphaVantage API key
- This is optional if you want to refresh the stock symbol data.
- Weaviate Vector Database
- Ollama Model Server
- Stock Overview Ingestion Engine
- Gradio UI and application.
- Install a Weaviate instance in the
weaviate
namespace.
- Install an Ollama model server in the
ollama
namespace.- The
all-minilm
andgranite3-dense:8b
models should be pulled after install. This can be done usingcurl
or theollama
cli tool from an Openshift or DevSpaces terminal.
- The
The stock overview ingestion engine consists of two components.
-
A Caching Proxy
- Follow the instructions to install the caching proxy in
the
camel
namespace.
- Follow the instructions to install the caching proxy in
the
-
A Stock Overview Syncronizer
- Follow the instructions to install the AlphaVantage syncronizer in
the
camel
namespace. Configure theav-overview-sync-configmap
configmap to use thegranite3-dense:8b
model.
- Follow the instructions to install the AlphaVantage syncronizer in
the
- 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
- Expose the app with an external route and have fun.
oc create route edge --service rag --insecure-policy='Redirect'
oc delete all --selector=app=rag
helm uninstall weaviate
oc delete pvc weaviate-data-weaviate-0 weaviate-data-weaviate-1
- Create a mini-cluster by installing Code Ready Containers
- Install an OKD cluster and Eclipse-Che.
- Install an Openshift cluster and DevSpaces.
- As a managed service from any of the major cloud providers.