Bỏ qua để đến nội dung

LlamaIndex & RAGFlow — Enterprise Knowledge & RAG của DataValue

Qua Cube, AI đã tiếp cận Trusted Business Data (Revenue, Gross Margin, Customer, Product, Inventory, Sales, Purchase, Supplier). Nhưng doanh nghiệp không chỉ có dữ liệu trong database — phần rất lớn tri thức nằm trong Policies, SOPs, Contracts, Product Documents, Technical Manuals, Business Rules, Meeting/Project Documents, Customer Agreements, Research Reports, Industry Knowledge. Dữ liệu cho biết Customer A giảm doanh thu 42%, nhưng chưa chắc trả lời được khách đang áp dụng điều khoản thương mại nào? chính sách discount ra sao? hợp đồng có điều khoản đặc biệt nào? quy trình retention là gì? Sales phải làm gì khi khách có dấu hiệu churn? — những thông tin này nằm trong Enterprise Knowledge. DataValue triển khai capability này bằng LlamaIndex hoặc RAGFlow.

Vấn đề căn bản: LLM không biết dữ liệu riêng của doanh nghiệp

Phần tiêu đề “Vấn đề căn bản: LLM không biết dữ liệu riêng của doanh nghiệp”

LLM được huấn luyện trên lượng lớn dữ liệu công khai, nhưng không tự biết hợp đồng của Customer A, Pricing Policy, Sales SOP, quy trình Procurement, tài liệu kỹ thuật nội bộ, knowledge của chuyên gia — những dữ liệu này nằm trong API, SQL database, PDF, slide deck… (tài liệu LlamaIndex mô tả rõ vấn đề này). Doanh nghiệp cần LLM + Enterprise Knowledge → Business Context → Enterprise Reasoning — bài toán Context Augmentation.

Retrieval-Augmented Generation. Thay vì bắt LLM trả lời chỉ dựa vào kiến thức đã huấn luyện (Question → LLM → Answer), RAG thêm một bước:

flowchart LR
  Q["USER QUESTION"] --> R["RETRIEVAL"] --> C["Relevant Enterprise Knowledge"] --> LLM["LLM"] --> A["RESPONSE"]

Ví dụ “chính sách discount cho Distributor hiện tại thế nào?” → hệ thống không bắt LLM tự nhớ/đoán, mà tìm Sales_Pricing_Policy_2026.pdf, xác định phần liên quan (Distributor, Discount, Approval Level, Effective Date), đưa context đó cho LLM. Tài liệu LlamaIndex mô tả tương tự: dữ liệu được chuẩn bị/index, truy vấn tìm context phù hợp, sau đó context + câu hỏi được cấp cho LLM để tạo response.

Tại sao không đưa toàn bộ tài liệu cho LLM?

Phần tiêu đề “Tại sao không đưa toàn bộ tài liệu cho LLM?”

Doanh nghiệp có thể có 100.000 Documents, 500.000 Pages, Millions of Paragraphs. Người dùng chỉ hỏi “điều kiện phê duyệt discount trên 10% là gì?”. Không có lý do gửi toàn bộ kho cho LLM — RAG thực hiện 100.000 Documents → Search/Retrieve → 5 Relevant Chunks → LLM. AI nhận Relevant Context thay vì All Enterprise Information. Đây là một nguyên tắc quan trọng nhất của Enterprise AI: đưa đúng context vào đúng thời điểm.

Enterprise Knowledge khác Data Warehouse như thế nào?

Phần tiêu đề “Enterprise Knowledge khác Data Warehouse như thế nào?”

Data Warehouse chứa chủ yếu structured data (Customer, Product, Order, Revenue, Inventory, Invoice, Payment). Enterprise Knowledge chứa nhiều unstructured/semi-structured (Contracts, Policies, SOP, Manuals, Research, Reports, Documents, Presentations). AI cần hai con đường, không thay nhau:

flowchart TB
  AI["AI AGENT"]
  AI --> BD["BUSINESS DATA → Cube"]
  AI --> KN["ENTERPRISE KNOWLEDGE → LlamaIndex/RAGFlow"]

“Revenue của Customer A trong 6 tháng gần nhất?” → dùng Cube (structured business data). “Điều khoản discount trong hợp đồng của Customer A?” → dùng Enterprise Knowledge/RAG. Câu hỏi phức tạp cần cả hai. Ví dụ “tại sao Customer A giảm mua và nên làm gì?”: Cube → Revenue ↓42%, Purchase Frequency ↓55%, Last Purchase 48 days + Enterprise Knowledge → Customer Contract, Pricing Policy, Sales SOP, Service History → AI Reasoning → Recommendation. Đây mới thực sự là Enterprise AI — AI không chỉ biết con số mà hiểu cả business context xung quanh con số đó.

Hai phần lớn. Knowledge Preparation: Documents → Load → Parse → Chunk → Embedding → Index → Knowledge Store. Knowledge Retrieval: User Question → Understand Query → Retrieve → Filter/Rerank → Relevant Context → LLM → Response. LlamaIndex chia RAG thành các stage chính: Loading, Indexing, Storing, Querying, Evaluation.

Knowledge đến từ nhiều nguồn: PDF, Word, PowerPoint, Web Pages, APIs, Databases, Knowledge Bases, Cloud Storage, Enterprise Applications. LlamaIndex cung cấp data connectors/readers biến dữ liệu từ các nguồn/định dạng khác nhau thành các đối tượng framework xử lý được. Lưu ý: khác Airbyte — Airbyte ingest operational data cho Analytical Platform (Odoo Sales Orders → Airbyte → ClickHouse = Data Replication); Knowledge ingestion chuẩn bị context cho AI (Sales Policy PDF, Customer Contract, Product Manual → LlamaIndex/RAGFlow → AI Knowledge = Knowledge Ingestion & Retrieval). Airbyte = Business Data Ingestion; LlamaIndex/RAGFlow = AI Knowledge Context — hai capability hoàn toàn khác nhau.

Parsing — tài liệu không đơn giản chỉ là text

Phần tiêu đề “Parsing — tài liệu không đơn giản chỉ là text”

Một PDF doanh nghiệp chứa Title, Paragraph, Table, Header, Footer, Image, Diagram, Section, Page Number. Nếu chỉ lấy text rồi cắt ngẫu nhiên, context bị mất — ví dụ một bảng Customer Type | Discount | Approval nếu parse sai, AI mất quan hệ Customer Type → Discount → Approval. Đây là lý do Document Understanding rất quan trọng trong Enterprise RAG. RAGFlow đặc biệt nhấn mạnh xử lý tài liệu phức tạp và đã bổ sung nhiều phương pháp parsing (MinerU, Docling), hỗ trợ multimodal model để hiểu hình ảnh trong PDF/DOCX.

Chunking — chia Knowledge thành đơn vị có nghĩa

Phần tiêu đề “Chunking — chia Knowledge thành đơn vị có nghĩa”

Không index cả tài liệu như một khối. Một hợp đồng 100 trang chia thành General Terms, Pricing, Discount, Payment, Delivery, Warranty, Termination. Trong LlamaIndex, một Document đại diện nguồn dữ liệu, Node là đơn vị nhỏ hơn dùng trong xử lý/retrieval và giữ metadata (DOCUMENT → SECTION → CHUNK/NODE → METADATA). Chunking tốt → retrieval tốt hơn.

Traditional search tìm keyword; nhưng người dùng hỏi “khách hàng phân phối được giảm giá tối đa bao nhiêu?” trong khi tài liệu ghi “Commercial incentive applicable to distributor channel…” — keyword khác nhau. Embedding biểu diễn semantic meaning thành vector (Text → Embedding Model → Vector), query cũng thành vector (Question → Embedding → Find Semantically Similar Knowledge) → retrieval tìm theo meaning, không chỉ exact keywords.

Embeddings thường lưu trong Vector Store (Enterprise Documents → Chunks → Embeddings → Vector Store; query: Question → Embedding → Vector Search → Relevant Chunks). LlamaIndex không bắt buộc một vector DB duy nhất (core abstractions hỗ trợ Vector Stores, Embeddings, Storage và nhiều integration) — hợp nguyên tắc technology composability. Và Metadata Filtering: Knowledge Base có Vietnam/Singapore Policies, 2024/2025/2026, Draft/Approved/Deprecated; hỏi “chính sách Sales hiện hành tại Việt Nam?” thì retrieval không nên trả Draft 2024 Singapore Policy chỉ vì semantic similarity cao — knowledge cần metadata (Country=Vietnam, Effective Year=2026, Status=Approved, Department=Sales), kết hợp Semantic Relevance + Metadata Filtering.

Enterprise retrieval có thể kết hợp nhiều chiến lược: Semantic Search · Keyword Search · Metadata Filtering · Hybrid Search · Reranking · Routing · Multi-step Retrieval. LlamaIndex cung cấp abstraction như Retriever, Router, Node Postprocessor (Question → Retriever → Candidate Knowledge → Filter/Rerank → Best Context → LLM) — giúp RAG vượt xa simple vector search. Reranking: retrieval tìm được 20 Relevant Chunks nhưng không phải đều quan trọng như nhau — rerank sắp xếp lại (Chunk 7 → 0.97, Chunk 3 → 0.94… Chunk 5 → 0.52) rồi chỉ đưa Top 5 tốt nhất cho LLM, vừa tăng relevance vừa kiểm soát lượng context.

Misconception phổ biến (Upload PDF → Ask → Answer). Enterprise RAG rộng hơn nhiều: knowledge gồm Policies, SOPs, Contracts, Product Knowledge, Customer Documents, Research, Technical Documentation, Project Knowledge, Industry Knowledge, Historical Decisions; consumer gồm AI Assistant, AI Agent, Business Application, Customer Service Copilot, Sales/Finance/Management Agent. DataValue định vị capability này là Enterprise Knowledge & Context Layer for AI, không phải “Chat with Documents”.

LlamaIndex tự mô tả là framework xây LLM-powered agents over your data, với capability cho context augmentation, RAG, connectors, indexes, query/chat engines, agents, workflows (Python + TypeScript). Trong DataValue, đặt vào responsibility rõ: Knowledge & RAG Framework (Enterprise Knowledge → LlamaIndex → Ingest·Index·Retrieve → Relevant Context → AI Agent); LangGraph giữ vai Agent Reasoning & Orchestration.

Có. LlamaIndex không chỉ làm RAG — nó có Agents và Workflows (workflows kết hợp agents/data connectors/tools, RAG pipeline có thể thành tool cho Agent). LangGraph cũng xây agentic workflows. Nếu nhìn thuần feature sẽ overlap. Nhưng DataValue chọn architecture theo Clear Responsibility, không phải “tool nào làm được nhiều nhất”: LlamaIndex → Knowledge & RAG; LangGraph → Agent Reasoning & Orchestration — giữ architecture dễ hiểu, dễ thay từng component.

RAGFlow định vị là một open-source RAG engine kết hợp RAG với Agent capabilities để tạo context layer cho LLMs, cung cấp RAG workflow tương đối hoàn chỉnh (Documents → RAGFlow {Ingestion, Parsing, Knowledge Base, Retrieval, RAG, Agent capabilities}) — thiên về một integrated RAG platform. Không định vị “A tốt hơn B” — chúng hợp hai cách triển khai:

LlamaIndex — Framework

Developer-first · Composable · Framework-oriented · Custom AI applications · Custom retrieval · Deep integration với Agent stack. Our Application → {LlamaIndex, Vector Store, Embedding Model, LLM, Other Components}.

RAGFlow — Integrated Platform

More integrated RAG platform · Document-centric knowledge · Built-in knowledge workflow · Parsing & retrieval experience · Faster knowledge-base deployment. Documents → RAGFlow Platform → Knowledge/Retrieval → AI Applications.

DataValue có cần cả LlamaIndex và RAGFlow không? — Không

Phần tiêu đề “DataValue có cần cả LlamaIndex và RAGFlow không? — Không”

Dấu / nghĩa là LlamaIndex HOẶC RAGFlow, không phải bắt buộc cả hai. Reference architecture: LlamaIndex làm Knowledge/RAG framework mặc định cho Core (nếu mục tiêu là xây DataValue như một reusable composable platform — hợp triết lý tách capability rõ: LangGraph → orchestration, LlamaIndex → knowledge, Cube → semantic, n8n → action, Langfuse → observability). RAGFlow hấp dẫn khi requirement là “cần nhanh chóng xây một Enterprise Knowledge/RAG Platform hoàn chỉnh”, đặc biệt môi trường nhiều PDF/DOCX/tài liệu phức tạp/bảng/ảnh — RAGFlow đã mở rộng đáng kể (agentic workflow, MCP, memory, multimodal document understanding, orchestrable ingestion pipeline, connector đồng bộ knowledge từ enterprise/cloud sources), có thể là một accelerated Enterprise Knowledge Platform option. Không cần deploy cả hai.

Governance: Enterprise RAG không chỉ là retrieval

Phần tiêu đề “Governance: Enterprise RAG không chỉ là retrieval”

Nếu Knowledge Base chứa HR Policy, Customer Contracts, Financial Documents, Board Documents, Legal Documents — không thể để mọi Agent truy cập tất cả. Knowledge architecture phải xét Identity, Access Control, Document Permission, Metadata, Classification, Version, Effective Date, Source, Owner: User/Agent → Identity → Authorization → Knowledge Retrieval → Allowed Context Only. Enterprise RAG không chỉ là retrieval — nó là Governed Retrieval.

Nếu AI trả “discount tối đa 10%”, người dùng doanh nghiệp sẽ hỏi “theo tài liệu nào?” — context cần giữ provenance (Answer → Source Document → Section → Version → Effective Date), phân biệt model reasoning với enterprise source evidence (nền tảng của Trusted AI). Và Freshness — knowledge có vòng đời (Draft → Approved → Effective → Superseded → Archived); AI không được vô tình lấy Pricing Policy 2024 chỉ vì text similarity cao — retrieval phải hiểu Current Version, Effective Date, Status, Business Domain. Vì vậy Enterprise Knowledge Management và RAG phải đi cùng nhau.

OpenMetadata quản lý Tables/Columns/Metrics/Pipelines/Dashboards/Lineage/Owners/Data Quality; RAG quản lý context từ Documents/Policies/Contracts/SOP/Manuals/Knowledge. Ba lớp context cho AI (bổ sung nhau): Cube → what the business data means · OpenMetadata → what data exists and whether it can be trusted · LlamaIndex/RAGFlow → what the enterprise knows.

RAG truyền thống: Question → Retrieve → Generate. Nhưng Agent có thể: Question → Reason → What knowledge do I need? → Retrieve → Evaluate → Enough? → No: Search Again → Analyze / Yes: Reason → Answer. Đây là Agentic RAG (LlamaIndex mô tả các agentic strategies: routing, query transformations, full agent loops dùng RAG query engines như tools) — nơi LlamaIndex kết hợp rất tự nhiên với LangGraph:

flowchart TB
  LG["LANGGRAPH · Reason & Orchestrate"] --> Q{"Need Knowledge?"}
  Q -->|Yes| LI["LLAMAINDEX · Retrieve Context"] --> EV["LangGraph · Evaluate Context"]
  EV --> E{"Enough Evidence?"}
  E -->|No| LI
  E -->|Yes| REA["Reason"] --> DEC["Decision"]

LlamaIndex cung cấp the right knowledge context; LangGraph quyết định how that context should be used in the reasoning process.

Customer Retention Agent (“tại sao Customer A giảm mua và nên làm gì?”): Cube → Revenue ↓42%, Frequency ↓55%, AOV ↓18%, Last Purchase 48 days + LlamaIndex/RAGFlow → Customer Contract, Pricing Policy, Sales SOP, Service Notes → Business Data + Knowledge → Possible Cause → Recommended Action → “churn risk cao; behavior đổi sau khi commercial terms thay đổi; Account Manager kiểm tra trực tiếp” → n8n (Create CRM Task, Assign Account Manager, Notify). Đây là Data + Knowledge → Reasoning → Action.

Tương tự: Procurement Agent (supplier nào rủi ro cao? → Cube: Purchase Volume/Delivery Performance/Lead Time/Price Variance/Quality Issues + Knowledge: Supplier Contracts/Quality Reports/Audit Reports → Risk Reasoning → Priority → Action); Finance Agent (khoản phải thu này điều khoản thanh toán thế nào và tại sao overdue? → Cube: Invoice Amount/Due Date/Outstanding/Payment History + Knowledge: Customer Contract/Payment Terms/Commercial Agreement/Amendment → Explanation — use case mà chỉ BI hoặc chỉ RAG đều chưa đủ); Enterprise Policy Assistant (quy trình duyệt PO trên 1 tỷ? → AI → Enterprise Knowledge → Procurement Policy → Relevant Section → Answer + Source — RAG thuần túy, không cần structured data). DataValue dùng cùng Knowledge Foundation cho cả Assistants và Agents.

Khi trưởng thành, Enterprise Knowledge mở rộng: Documents + Business Rules + Expert Knowledge + Historical Decisions + Past Outcomes + Domain Knowledge. AI dần cần hiểu không chỉ “policy nói gì?” mà “trong những tình huống tương tự trước đây, doanh nghiệp đã quyết định thế nào và outcome ra sao?” — Knowledge Layer trở thành một phần của Enterprise Learning Loop. Knowledge = what we know; Know-how = how we use what we know to make decisions ({SOP, Policy, Research, Expert Docs} + {Historical Data, Metrics, Outcomes} → Domain Know-how → AI Reasoning → Decision). Đây mới là tài sản khó sao chép: model/framework/vector DB có thể thay, nhưng Enterprise Knowledge + Business Semantics + Historical Outcomes + Domain Know-how là tài sản riêng của từng doanh nghiệp. Giống LangGraph, Knowledge Layer cũng không nên khóa vào một LLM (KNOWLEDGE LAYER → AGENT → {Model A, B, C}) — điều cần bảo vệ là Enterprise Knowledge, Business Semantics, Metadata, Agent Logic, Business Workflow, Historical Outcomes.

flowchart TB
  CUBE["Cube · Business Context"] & LI["LlamaIndex/RAGFlow · Enterprise Knowledge"] & OM["OpenMetadata · Data Context & Governance"] --> LG["LangGraph · Reason & Orchestrate"]
  LG --> LLM["LLM / Model"] --> DEC["Decision"] --> N8N["n8n · Act"] --> OUT["Outcome & Learning"]

Vai trò: Cube → Business Context · LlamaIndex/RAGFlow → Knowledge Context · OpenMetadata → Data & Governance Context · LangGraph → Reasoning & Orchestration · LLM → Intelligence · n8n → Action.

Enterprise Knowledge & RAG không phải tính năng “Chat với PDF” mà là một architecture layer: biến Documents, Policies, SOPs, Contracts, Research, Expert/Historical Knowledge thành context mà AI Agent truy xuất và dùng trong reasoning. Kết hợp Cube: Trusted Business Data + Enterprise Knowledge → AI Reasoning → Decision → Action — AI không chỉ biết con số mà hiểu context xung quanh con số, chuyển từ Data Intelligence sang Contextual Enterprise Intelligence. Xa hơn, khi Knowledge + Business Data + Domain Expertise + Historical Decisions/Outcomes hợp lại: Knowledge → Reasoning → Decision → Action → Outcome → Learning, DataValue hình thành tài sản quan trọng hơn cả công nghệ RAG: Enterprise Know-how.

LlamaIndex / RAGFlow — Enterprise Knowledge & RAG Layer của DataValue, nhiệm vụ: biến tri thức phân tán của doanh nghiệp thành Trusted Context mà AI có thể tìm thấy, hiểu và sử dụng để reasoning. Hành trình: Data → Trusted Data → Trusted Meaning → Enterprise Knowledge → Context → Reasoning → Decision → Action → Outcome → Learning → Value.

Chia sẻ: