debezium/dbz#2074 feat: add real-time RAG chatbot demonstration example#10
debezium/dbz#2074 feat: add real-time RAG chatbot demonstration example#10KMohnishM wants to merge 1 commit into
Conversation
277eaeb to
4d436fe
Compare
bb30493 to
805e8ff
Compare
4d436fe to
1ae91ff
Compare
805e8ff to
d13e308
Compare
1ae91ff to
279505c
Compare
d13e308 to
3042183
Compare
279505c to
1384ebd
Compare
vjuranek
left a comment
There was a problem hiding this comment.
Few miniro comments regarding code structure, otherwise LGTM
| <version>${debezium.version}</version> | ||
| </dependency>""" | ||
| </dependency>""", | ||
| """ <dependency> |
| ) | ||
|
|
||
| # 3. Create a Verbose Retriever Tool from Adapter | ||
| from langchain_core.tools import Tool |
There was a problem hiding this comment.
IF we don't expect module is not available and provide fallback (like one huggingface one above), the imports should be at the beginning.
| # 4. Decide Agent Mode (OpenAI vs. Local Ollama vs. Mock Fallback) | ||
| api_key = os.getenv("OPENAI_API_KEY") | ||
| agent_mode: str | None = None | ||
| from collections.abc import Callable |
|
|
||
| # Try OpenAI first | ||
| if api_key: | ||
| try: |
There was a problem hiding this comment.
This starts to be too long. I'd propose to split it into functions like "create_openai_agent()"
| print(f"Failed to load LangChain/OpenAI packages: {e}. Checking local alternatives...") | ||
|
|
||
| # If no OpenAI, check if local Ollama is running | ||
| if not agent_mode: |
| pass | ||
|
|
||
| # Fallback to local Mock Agent | ||
| if not agent_mode: |
|
@KMohnishM could you please check also CI failures? |
Yes @vjuranek , I investigated the Python 3.12 CI failures! It was caused by a parsing conflict where MyPy targeted Python 3.10 globally, but the Python 3.12 runner installed newer third-party stubs (like I have successfully resolved this in the latest downstream branch ( |
1384ebd to
089627a
Compare
Signed-off-by: KMohnishM <kmohnishm@gmail.com>
089627a to
f364c36
Compare
Description
This Pull Request implements the real-time RAG Chatbot demonstration example for PyDebeziumAI (Week 4, PR 2).
This serves as the first fully functional end-to-end demonstration of the library's capabilities: streaming PostgreSQL logical replication transactions (CDC) via an embedded Debezium engine, transforming and synchronizing them into Chroma DB in real-time, and querying the updated database records using a LangGraph agent.
Resolves: debezium/dbz#2074
Stacked on: PR 1 (
gsoc-week-4-retriever)Key Components Added
Local Infrastructure (
examples/rag_chatbot/docker-compose.yml&setup_db.sql):wal_level=logical) mapping on port5432.Sync Daemon (
examples/rag_chatbot/stream_sync.py):ChromaAdapterandSyncManager.Interactive LangGraph Chatbot (
examples/rag_chatbot/chatbot.py):create_retriever_toolhelper from PR 1.OPENAI_API_KEYis configured), local Ollama models (such asllama3.2orsmollmrunning natively), and a local mock RAG model (fallback)._opflag,pricevalue, and record keys) during tool execution, illustrating the exact RAG flow.Guide (
examples/rag_chatbot/README.md):Verification Results
All checks and code quality verifications passed in the WSL environment:
pytest)All checks passed!)Success: no issues found)