The Product Data Emitter is a Python-based application designed to simulate updates to product data dynamically and store the updated data in GridGain's vector stores. It leverages LangChain's OpenAIEmbeddings
model for embedding generation and feeds the product content along with the vectors generated by the embedding model to the GridGain Vector Store.
For the up-to-date Langflow integration documentation, visit the GridGain docs.
- Predefined Product Updates: Updates the availability, price, and delivery time of predefined products.
- GridGain Integration: Uses GridGain for vector storage.
- LangChain Integration: Leverages LangChain's embeddings for vectorization.
- Initial Data Load: Adds data to the GridGain Vector store.
- Dynamic Data Emission: Emits product data updates to simulate real-time updates.
- API Key-Based Configuration: Uses OpenAI API keys for initializing embeddings.
- Python 3.11.7+
- A running GridGain Enterprise or Ultimate Edition, at least 8.9.17 (release notes)
- Make sure your license includes access to the vector search feature.
- If you see any error about gridgain-vector-query or vector search not enabled, you need to enable it by moving libs/optional/gridgain-vector-query to the libs/ folder
- OpenAI API key
- Visit https://platform.openai.com/signup
- Create an account (or sign in if you already have one)
- Once logged in, go to the Settings->API section: https://platform.openai.com/settings/organization/api-keys
- Click "Create new secret key"
- Add your billing information (required for API access)
- Make sure to copy and save your API key immediately after creation - you won't be able to see it again after leaving the page
- If you’re seeing quota issues with respect to OpenAI, you need to purchase OpenAI credits
-
Clone the repository:
git clone https://github.com/GridGain-Demos/langflow_example.git cd langflow_example python3.11 -m venv .venv .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Get the Early Access Langflow version:
- Download the latest version from the GridGain website.
- Unpack the downloaded archive.
For details on setting up your local environment: Detailed instructions are available in the DEVELOPMENT.md file within the zip file.
The following steps are excerpts from the DEVELOPMENT.md file.
-
Install Pre-Requisites:
-
Operating System: macOS or Linux; Windows users MUST develop under WSL.
-
git: The project uses the ubiquitous git tool for change control.- make: The project uses make to coordidinate packaging.
-
uv: This project uses uv (>=0.4), a Python package and project manager from Astral. Install instructions at https://docs.astral.sh/uv/getting-started/installation/.
-
npm: The frontend files are built with Node.js (v22.12 LTS) and npm (v10.9). Install instructions at https://nodejs.org/en/download/package-manager.
- Windows (WSL) users: ensure npm is installed within WSL environment; which npm should resolve to a Linux location, not a Windows location.
- WSL users: ensure to use system IP as host for GridGain connection in Langflow UI
-
-
Initialize and Run Langflow:
This runs perfectly for macOS and Linux, but for windows you will need WSL setup.
make init
This command performs the following operations:
- Installs backend dependencies
- Installs frontend dependencies
- Builds frontend static files
- Initializes the project
- Starts the application using
uv run langflow run
╭───────────────────────────────────────────────────────────────────╮ │ Welcome to ⛓ Langflow │ │ │ │ │ │ Collaborate, and contribute at our GitHub Repo 🌟 │ │ │ │ We collect anonymous usage data to improve Langflow. │ │ You can opt-out by setting DO_NOT_TRACK=true in your environment. │ │ │ │ Access http://127.0.0.1:7860 │ ╰───────────────────────────────────────────────────────────────────╯
In the Langflow Example project, run the following command:
cd src
python main.py --use_api_key <YOUR_API_KEY> --num_products <NUMBER> --interval <INTERVAL_IN_SECONDS> [--load_data <true|false>] [--json_file <PATH_TO_JSON_FILE>]
--use_api_key
: (Required) OpenAI API key for embedding initialization.--num_products
: (Optional) Number of products to emit. Default is 20.--interval
: (Optional) Time interval (in seconds) between emissions. Default is 5.--load_data
: (Optional) Load initial product data. Default isfalse
.--json_file
: (Optional) Path to a JSON file containing initial product data.
python main.py --use_api_key YOUR_API_KEY --num_products 10 --interval 10 --load_data true --json_file "data/products.json"
Wait for Langflow to initialize. Once initialized, it will show a box with the URL: http://127.0.0.1:7860/all.
Once langflow is up and running, import the predesigned flow from the assets folder directly in langflow as follows:
-
Step 1: Access the UI at: http://127.0.0.1:7860/all and click on create a new flow
-
Step 2: Create a blank flow
-
Step 3: Go back to my projects
-
Step 4: Click on the upload button next to folders
-
Step 5: Select the Gridgain Vector Store RAG json file from the assets folder and import
-
Step 6: Click on the newly Imported Project
-
Step 7: The following flow would get loaded
-
Step 8: Add the OpenAI Key Variable in the OpenAI Embeddings Component
-
Step 9: Create a new Variable, and add your key and save
-
Step 10: Select the key from the dropdown
-
Step 11: Select the same variable for the OpenAI LLM component just before the Chat Output
-
Step 12: Once the variables are set, click on the Playground button
-
Step 13: The Chat window should get loaded, where you can add your queries, like:
- Organic Apple
- Organic Bananas
Block Diagram of workflow
Architecture:
-
Initialization:
- Connects to GridGain at
localhost:10800
. - Initializes OpenAI embeddings and GridGain stores.
- Connects to GridGain at
-
Dynamic Product Updates:
- Randomly selects predefined products.
- Simulates updates to price, availability, and delivery time.
- Updates data in the key-value and vector stores.
-
Data Storage:
- Key-value store: Stores structured product information.
- Vector store: Stores product embeddings for semantic search.
-
Components:
-
GridGain Vector Store:
A vector store implementation that provides:
- Document storage and similarity search
- CSV file ingestion with automatic document processing
- Configurable similarity search with score thresholds
- Metadata handling for documents
Key features:
- Simple connection configuration with host/port settings
- CSV processing with title and text field support
- Automatic metadata extraction from CSV files
- Configurable number of search results
-
GridGain Chat Memory
A chat memory component that stores conversation history in GridGain:
Key features:
- Persistent storage of chat messages across sessions
- Support for multiple message types (Human, AI, System, Chat)
- JSON serialization for efficient storage and retrieval
- Session-based message management
-