รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์
ค้นพบสถาปัตยกรรม RAG ขั้นสูงที่ประกอบด้วยขั้นตอนการค้นคืนหลายขั้น หรือผสานเข้ากับเอเจนต์ LLM เพื่อจัดการงานที่ซับซ้อน
รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์ เป็นบทเรียน LLM Apps in Production (RAG + Vector DB + Caching) ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน LLM Apps in Production (RAG + Vector DB + Caching) และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส LLM Apps in Production (RAG + Vector DB + Caching) มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Complex Queries & Advanced RAG
Welcome to Advanced RAG! So far, we've explored basic Retrieval Augmented Generation (RAG) where an LLM answers a query using a single set of retrieved documents.
However, real-world questions can be complex. They might involve multiple parts, require reasoning, or need to interact with different systems.
Simple RAG struggles with these challenges. That's why we need more sophisticated approaches like Multi-stage RAG and Agentic RAG.
Deconstructing Multi-stage RAG
Multi-stage RAG is an advanced pattern designed to handle complex queries by breaking them down into smaller, manageable parts. Instead of one big retrieval, it performs several targeted retrievals.
Think of it like a detective solving a case: they don't just look for one clue; they follow leads, gather more information, and piece it all together step-by-step.
The Query Decomposition Step
The first step in Multi-stage RAG often involves query decomposition. Here, an LLM analyzes your original complex question and reformulates it into multiple, simpler sub-queries or specific search terms.
This allows the system to retrieve documents that are highly relevant to each distinct part of your overall question, improving accuracy.
Iterative Retrieval in Action
Once the original query is decomposed, the RAG system performs iterative retrieval. This means:
- Each sub-query is sent to the retriever.
- Relevant documents are fetched for each sub-query.
- The results from one retrieval step might even inform or refine subsequent sub-queries.
Finally, all retrieved information is combined and sent to the LLM for a comprehensive answer.
Multi-stage RAG Example
Imagine you ask: "What are the main causes of climate change, and what are some recent technological solutions being developed to combat it?"
A Multi-stage RAG system might:
- Decompose: "Main causes of climate change" and "Recent tech solutions for climate change."
- Retrieve 1: Find documents on causes.
- Retrieve 2: Find documents on solutions.
- Synthesize: Combine info to answer both parts fully.
Introducing Agentic RAG
While Multi-stage RAG improves retrieval, Agentic RAG takes it a step further. An LLM agent is a system where an LLM acts as a 'brain' to reason, plan, and execute actions using a variety of tools.
Instead of just retrieving, an agent can decide what to do next based on the user's query and the available tools. RAG becomes one of its powerful tools!
Agentic Architecture & Tools
The core of an agentic system is an LLM that can:
- Understand: Interpret the user's goal.
- Plan: Break down the goal into steps.
- Act: Choose and use appropriate tools for each step.
- Observe: Evaluate tool outputs and decide next steps.
Tools can include web search, calculators, external APIs, and, crucially, a RAG retriever for your knowledge base.
RAG is a Powerful Tool
In an Agentic RAG system, the RAG component isn't the whole pipeline; it's a specialized tool the agent can invoke. The agent decides when to use RAG.
For example, if a user asks a question that requires factual information from your specific document store, the agent will 'decide' to use its RAG tool to fetch that context.
Agentic RAG in Practice
Consider the query: "What was our company's Q3 revenue last year, and how does it compare to the industry average for that period?"
An LLM agent might:
- Use RAG Tool: Retrieve internal Q3 revenue report.
- Use Web Search Tool: Find industry average Q3 revenue.
- Use Calculator Tool: Compare the two figures.
- Synthesize: Provide a comprehensive answer.
Choosing the Right RAG Pattern
When should you use Multi-stage vs. Agentic RAG?
- Multi-stage RAG: Best for queries that can be clearly broken into distinct sub-questions, where the primary challenge is retrieving comprehensive information.
- Agentic RAG: Ideal for highly dynamic, multi-step problems that might require various types of reasoning, external interactions, and tool usage beyond just retrieval.
Both enhance RAG, but for different kinds of complexity.
Advanced RAG Check
Let's check your understanding of these advanced RAG patterns.
Recap: Advanced RAG Patterns
Great job! In this lesson, we explored advanced RAG patterns for handling complex scenarios:
- Multi-stage RAG: Decomposes complex queries into sub-queries, performing iterative retrieval to gather comprehensive context.
- Agentic RAG: Uses an LLM as an intelligent agent that can reason, plan, and use various tools (including RAG) to achieve a goal.
These techniques are crucial for building robust and intelligent LLM applications that go beyond simple question-answering.
คำถามที่พบบ่อย
บทเรียน “รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส LLM Apps in Production (RAG + Vector DB + Caching) ให้อัปเกรดเป็น CoddyKit PRO คอร์ส LLM Apps in Production (RAG + Vector DB + Caching) มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์”
ค้นพบสถาปัตยกรรม RAG ขั้นสูงที่ประกอบด้วยขั้นตอนการค้นคืนหลายขั้น หรือผสานเข้ากับเอเจนต์ LLM เพื่อจัดการงานที่ซับซ้อน คุณปฏิบัติ LLM Apps in Production (RAG + Vector DB + Caching) ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน LLM Apps in Production (RAG + Vector DB + Caching) หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน LLM Apps in Production (RAG + Vector DB + Caching) บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน LLM Apps in Production (RAG + Vector DB + Caching) นี้ได้ไหม
ได้ บทเรียน LLM Apps in Production (RAG + Vector DB + Caching) ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- การเขียนคำค้นใหม่และการจัดอันดับซ้ำ
- รูปแบบ RAG หลายขั้นตอนและแบบใช้เอเจนต์
- การจัดการโครงสร้างเอกสารที่ซับซ้อน
- การค้นหาด้วยตนเองและการอ้างอิงแหล่งที่มา