An enterprise-grade technical assistant utilizing Retrieval-Augmented Generation (RAG) to query 1,500+ pages of the Siemens S7-1200 System Manual.
- Semantic Retrieval: Leverages vector embeddings to interpret technical intent beyond simple keyword matching.
- Audit-Ready Citations: Every response is mapped to the exact page number of the source PDF for technical verification.
- Industrial Safety Focus: Designed to minimize "search latency" for field engineers while providing direct links to official documentation.
- LLM: Google Gemini 2.5 Flash
- Vector DB: ChromaDB
- Framework: LangChain Classic
- UI: Streamlit
- Clone Repository:
git clone https://github.com/alirezasoroushe/industrial-rag-assistant.git - Environment Configuration:
pip install -r requirements.txt - Authentication:
.envwith yourGOOGLE_API_KEY. - Initialize Application:
streamlit run app.py
Building this system in the fast-evolving AI landscape presented several "real-world" challenges. Below are the technical hurdles overcome and the "Pro-Tips" for deploying RAG in industrial environments.
Problem: Initially, the project used gemini-1.5-flash. However, as of early 2026, Google retired these legacy identifiers, leading to 404 errors in the v1beta API.
Solution: Migrated the logic to the Gemini 2.5 Flash stable release.
Tip: Always hard-code specific model versions (e.g., gemini-2.5-flash) rather than using -latest tags in production to prevent breaking changes when models are updated.
Problem: LangChain split its core logic from community integrations, causing imports like RetrievalQA to fail.
Solution: Installed langchain-classic and updated import paths to langchain_classic.chains to bridge the legacy logic with the new 2026 framework.
Tip: Use a virtual environment (Conda or Venv) to isolate dependencies, ensuring that "Community" packages don't conflict with "Core" AI logic.
Problem: Standard semantic search sometimes missed specific Siemens part numbers or error codes.
Solution: Implemented a 1000-character chunk size with a 200-character overlap. This ensures that technical specs aren't "cut in half," maintaining the context of safety warnings.
Tip: In RAG systems for manuals, Metadata is King. By preserving the page number in the metadata, we provide a "human-in-the-loop" verification step, essential for industrial safety standards.
Problem: Using a 2024 embedding model with a 2026 LLM caused "dimensionality mismatch" errors.
Solution: Standardized the entire pipeline on the text-embedding-004 engine to ensure the "Brain" and the "Memory" speak the same mathematical language.
graph TD
subgraph "Knowledge Ingestion"
A["Siemens PDF Manual"] --> B["PyPDFLoader"]
B --> C["RecursiveTextSplitter"]
C --> D["Chroma Vector DB"]
end
subgraph "Retrieval-Augmented Generation"
direction TB
%% Invisible spacer to move title up
spacer1[ ] --- User
style spacer1 fill:none,stroke:none,color:#00000000
User["User Query"] --> Embed["Google text-embedding-004"]
Embed --> Search["Vector Search"]
D -.-> Search
Search --> Context["Relevant Context + Citations"]
end
subgraph "Final Response"
Context --> Gemini["Gemini 2.5 Flash"]
User --> Gemini
Gemini --> Response["Verified Technical Answer"]
end
style D fill:#f9f,stroke:#333,stroke-width:2px
style Gemini fill:#00f,color:#fff