Repository navigation
feat(samples): add Dozer + LLM + Vector DB + LangChain real-time RAG sample (#1690) - #2563
Open
andreikharytonenka-lab wants to merge 1 commit into
Conversation
|
Caliber Foundry seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1690
/claim #1690
Summary
Adds a complete, self-contained Dozer + LLM + Vector Database + LangChain real-time Retrieval-Augmented Generation (RAG) banking & credit-card advisory sample in
examples/llm-vector-langchain/, implementing the architecture from the Dozer engineering article Hyper-personalization with LLMs, Vector Databases, and Dozer.Architecture & Component Breakdown
Key Highlights
Canonical
dozer-config.yamlSchema (examples/llm-vector-langchain/dozer-config.yaml):config: !Postgrestag connection (banking_postgres) and enablespush_events: true,dynamic: true,grpc_web: true.customers,transactions,credit_card_products,documents).sql:withSELECT ... INTO customer_spending_profilesandSELECT ... INTO eligible_card_recommendations./customer_profiles,/eligible_cards,/credit_card_products,/documents,/transactions,/customers) with explicitindex.primary_keydefinitions.PostgreSQL Logical Replication Seed (
examples/llm-vector-langchain/seed.sql):ALTER TABLE ... REPLICA IDENTITY FULL;on all 4 source tables so PostgreSQL emits full before/after row payloads for Dozer CDC.CUST-001Ava Sharma,CUST-002Marcus Vance,CUST-003Elena Rostova,CUST-004David Chen), 5 credit card tiers, 14 categorized transactions, and 8 detailed policy & product disclosure documents (DOC-001throughDOC-008).Dozer REST & Incremental CDC Synchronizer (
examples/llm-vector-langchain/dozer_client.py):load_and_validate_dozer_config(): PyYAML!Postgrestag loader and schema validator ensuring all sources,SELECT ... INTOviews, and endpoint primary keys are valid.DozerClient: queries Dozer REST endpoints (POST /<endpoint>/queryandPOST /<endpoint>/countwith$filter,$order_by,$limit,$skip) and includes anInMemoryDozerBackendfallback that parsesseed.sqland evaluates the exact streaming SQL views for zero-dependency CI/offline testing.DozerCDCSynchronizer: tracks primary-key state snapshots and dispatches incrementalCDCEventmutations (CDCOperation.INSERT,CDCOperation.UPDATE,CDCOperation.DELETE) to downstream vector store listeners.LangChain VectorStore with Real-Time CDC Index Mutations (
examples/llm-vector-langchain/vector_store.py):DozerLangChainVectorStore(VectorStore): fulllangchain_core.vectorstores.VectorStoreimplementation supporting real-timeapply_cdc_event()(INSERT,UPDATE,DELETE) without full corpus re-indexing, plus credit-score eligibility metadata filtering (max_min_credit_scoreandcard_ids).DeterministicBankingEmbeddings(Embeddings): 128-dimensionallangchain_core.embeddings.Embeddingsimplementation for deterministic local & CI semantic retrieval (while supportingOpenAIEmbeddings/ChatOpenAIwhenOPENAI_API_KEYis provided).LangChain LCEL Hyper-Personalized RAG Pipeline (
examples/llm-vector-langchain/rag_pipeline.py):/customer_profilesand/eligible_cardswith vector-retrieved policy documents.$) computed directly from the customer's live Dozer category spend (travel_spend,dining_spend,groceries_spend,tech_spend) minusannual_fee./customers,/transactions, and/documents.Docker Compose & CLI (
docker-compose.yml,Dockerfile,app.py):docker-compose.ymlorchestrates PostgreSQL 15 (wal_level=logical), Qdrant (v1.9.0), Dozer (getdozer/dozer:latest), and the Python RAG service.app.pysupports--mode demo,--mode ask, and--mode sync(both against live Dozer:8080and with--offline).Verification & Automated Test Suite (
pytest)Added 17 comprehensive unit and integration tests in
examples/llm-vector-langchain/tests/test_dozer_rag.py: