This repository is a comprehensive learning platform designed to systematically train Retrieval-Augmented Generation (RAG) technology. It is based on the latest technology stack for 2025 and supports the EXAONE 4.0 model, which is specifically optimized for Korean language processing.
Python
1
43 commits
updated Aug 14, 2025
2025๋ ์ต์ LLM RAG ๊ธฐ์ ํ์ต์ ์ํ ์ข ํฉ ์ ์ฅ์
์ด ์ ์ฅ์๋ Retrieval-Augmented Generation (RAG) ๊ธฐ์ ์ ์ฒด๊ณ์ ์ผ๋ก ํ์ตํ ์ ์๋๋ก ์ค๊ณ๋ ์ข ํฉ ํ์ต ํ๋ซํผ์ ๋๋ค. 2025๋ ์ต์ ๊ธฐ์ ์คํ์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ, ํนํ ํ๊ตญ์ด ์ฒ๋ฆฌ์ ์ต์ ํ๋ EXAONE 4.0 ๋ชจ๋ธ์ ์ง์ํฉ๋๋ค.
# ์ ์ฅ์ ํด๋ก
git clone https://github.com/your-username/llm-rag-learning.git
cd llm-rag-learning
# ๊ฐ์ํ๊ฒฝ ์์ฑ ๋ฐ ํ์ฑํ
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# ํจํค์ง ์ค์น
pip install -r requirements.txt
pip install -e .
# ํ๊ฒฝ๋ณ์ ํ์ผ ์์ฑ
cp .env.example .env
# .env ํ์ผ์์ API ํค ์ค์
# OPENAI_API_KEY=your-openai-key
# ANTHROPIC_API_KEY=your-claude-key
# Ollama ๋ฐ EXAONE ๋ชจ๋ธ ์ค์
chmod +x scripts/setup_ollama.sh
./scripts/setup_ollama.sh
# Hello RAG ์์ ์คํ
python tutorials/01_getting_started/hello_rag.py
llm-rag-learning/
โโโ ๐ง core/ # ํต์ฌ ๊ธฐ๋ฅ ๋ชจ๋
โ โโโ llm_providers/ # LLM ์ ๊ณต์ (OpenAI, Claude, EXAONE)
โ โโโ data_processing/ # ๋ฐ์ดํฐ ์ฒ๋ฆฌ ๋ฐ ์๋ฒ ๋ฉ
โ โโโ retrieval/ # ๊ฒ์ ์์ง
โ โโโ evaluation/ # ํ๊ฐ ์์คํ
โโโ ๐ tutorials/ # ๋จ๊ณ๋ณ ํ์ต ํํ ๋ฆฌ์ผ
โ โโโ 01_getting_started/ # ์์ํ๊ธฐ
โ โโโ 02_data_preparation/ # ๋ฐ์ดํฐ ์ค๋น
โ โโโ 03_basic_rag/ # ๊ธฐ๋ณธ RAG
โ โโโ 04_advanced_rag/ # ๊ณ ๊ธ RAG
โ โโโ 05_local_models/ # ๋ก์ปฌ ๋ชจ๋ธ
โ โโโ 06_production_ready/ # ํ๋ก๋์
์ค๋น
โโโ ๐๏ธ frameworks/ # ํ๋ ์์ํฌ๋ณ ๊ตฌํ
โ โโโ langchain_examples/ # LangChain ์์
โ โโโ llamaindex_examples/ # LlamaIndex ์์
โโโ ๐ projects/ # ์ค์ต ํ๋ก์ ํธ
โ โโโ chatbot/ # ์ฑ๋ด ํ๋ก์ ํธ
โ โโโ document_qa/ # ๋ฌธ์ Q&A
โ โโโ knowledge_base/ # ์ง์๋ฒ ์ด์ค
โ โโโ multi_agent_rag/ # ๋ฉํฐ ์์ด์ ํธ RAG
โโโ ๐ data/ # ์ํ ๋ฐ์ดํฐ ๋ฐ ๋ฒกํฐ ์คํ ์ด
| ๋จ๊ณ | ๋ด์ฉ | ์์ ์๊ฐ | ๋์ด๋ |
|---|---|---|---|
| 1๋จ๊ณ | ์์ํ๊ธฐ | 30๋ถ | โญ |
| 2๋จ๊ณ | ๋ฐ์ดํฐ ์ค๋น | 1์๊ฐ | โญโญ |
| 3๋จ๊ณ | ๊ธฐ๋ณธ RAG | 2์๊ฐ | โญโญ |
| 4๋จ๊ณ | ๊ณ ๊ธ RAG | 3์๊ฐ | โญโญโญ |
| 5๋จ๊ณ | ๋ก์ปฌ ๋ชจ๋ธ | 2์๊ฐ | โญโญโญ |
| 6๋จ๊ณ | ํ๋ก๋์ | 4์๊ฐ | โญโญโญโญ |
| ์ ๊ณต์ | ๋ชจ๋ธ | ํน์ง |
|---|---|---|
| OpenAI | GPT-4o, GPT-4 Turbo | ๋์ ์ฑ๋ฅ, ๋ค์ํ ๊ธฐ๋ฅ |
| Anthropic | Claude-3.5 Sonnet | ์์ ์ฑ, ๊ธด ์ปจํ ์คํธ |
| LG AI | EXAONE 4.0 (32B/7.8B/2.4B) | ํ๊ตญ์ด ํนํ, ๋ก์ปฌ ์คํ |
from core.llm_providers.local_provider import LocalLLMProvider
from tutorials.hello_rag import SimpleRAG
# EXAONE ๋ชจ๋ธ๋ก RAG ์์คํ
์ด๊ธฐํ
rag = SimpleRAG("local")
# ๋ฌธ์ ์ถ๊ฐ
documents = [
"์ธ๊ณต์ง๋ฅ์ ์ธ๊ฐ์ ์ง๋ฅ์ ๋ชจ๋ฐฉํ๋ ๊ธฐ์ ์
๋๋ค.",
"๋จธ์ ๋ฌ๋์ AI์ ํ ๋ถ์ผ๋ก ๋ฐ์ดํฐ๋ก๋ถํฐ ํ์ตํฉ๋๋ค."
]
rag.add_documents(documents)
# ์ง๋ฌธํ๊ธฐ
result = rag.query("์ธ๊ณต์ง๋ฅ์ด ๋ฌด์์ธ๊ฐ์?")
print(f"๋ต๋ณ: {result['answer']}")
from langchain.chains import RetrievalQA
from frameworks.langchain_examples.advanced_rag import ConversationalRAG
# ๋ํํ RAG ์์คํ
conv_rag = ConversationalRAG(
llm_provider="local",
vector_store="chroma"
)
# ์ฐ์ ๋ํ
response1 = conv_rag.chat("RAG๊ฐ ๋ฌด์์ธ๊ฐ์?")
response2 = conv_rag.chat("๊ทธ๋ผ ์ด๋ค ์ฅ์ ์ด ์๋์?") # ์ด์ ๋ํ ๊ธฐ์ต
from core.evaluation import RAGEvaluator
evaluator = RAGEvaluator()
results = evaluator.evaluate(
questions=test_questions,
answers=generated_answers,
ground_truth=expected_answers,
metrics=["ragas", "bleu", "bertscore"]
)
# EXAONE Deep ๋ชจ๋ธ์ ๋จ๊ณ๋ณ ์ถ๋ก
prompt = "<thought>\n์ํ ๋ฌธ์ ๋ฅผ ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ฒ ์ต๋๋ค.\n</thought>\n\n2x + 5 = 15๋ฅผ ํ์ด์ฃผ์ธ์."
response = exaone_provider.generate(prompt)
| ๋ชจ๋ธ | ํ๊ตญ์ด ์ฑ๋ฅ | ์์ด ์ฑ๋ฅ | ์ถ๋ก ์๋ | ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ |
|---|---|---|---|---|
| EXAONE-32B | โญโญโญโญโญ | โญโญโญโญ | โญโญ | 32GB |
| EXAONE-7.8B | โญโญโญโญ | โญโญโญ | โญโญโญ | 8GB |
| GPT-4 | โญโญโญ | โญโญโญโญโญ | โญโญโญโญ | API |
| Claude-3.5 | โญโญโญ | โญโญโญโญโญ | โญโญโญโญ | API |
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)A: ํ์๋ ์๋์ง๋ง ๊ถ์ฅ๋ฉ๋๋ค. CPU์์๋ ์คํ ๊ฐ๋ฅํ์ง๋ง, GPU๋ฅผ ์ฌ์ฉํ๋ฉด ํจ์ฌ ๋น ๋ฅธ ์ถ๋ก ์ด ๊ฐ๋ฅํฉ๋๋ค.
A: ํ์ต ๋ชฉ์ ์ด๋ผ๋ฉด ๋ค์ ์์๋ฅผ ๊ถ์ฅํฉ๋๋ค:
A: MIT ๋ผ์ด์ผ์ค๋ก ์์ ์ ์ฌ์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค. ๋จ, ๊ฐ LLM ๋ชจ๋ธ์ ๋ผ์ด์ผ์ค๋ฅผ ๋ณ๋๋ก ํ์ธํด์ฃผ์ธ์.
์ด ํ๋ก์ ํธ๋ MIT License ํ์ ๋ฐฐํฌ๋ฉ๋๋ค.
๐ Star this repository if you find it helpful! ๐
Made with โค๏ธ for the Korean AI Community
This repository is a comprehensive learning platform designed to systematically train Retrieval-Augmented Generation (RAG) technology. It is based on the latest technology stack for 2025 and supports the EXAONE 4.0 model, which is specifically optimized for Korean language processing.
Python
1
43 commits
updated Aug 14, 2025
2025๋ ์ต์ LLM RAG ๊ธฐ์ ํ์ต์ ์ํ ์ข ํฉ ์ ์ฅ์
์ด ์ ์ฅ์๋ Retrieval-Augmented Generation (RAG) ๊ธฐ์ ์ ์ฒด๊ณ์ ์ผ๋ก ํ์ตํ ์ ์๋๋ก ์ค๊ณ๋ ์ข ํฉ ํ์ต ํ๋ซํผ์ ๋๋ค. 2025๋ ์ต์ ๊ธฐ์ ์คํ์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ, ํนํ ํ๊ตญ์ด ์ฒ๋ฆฌ์ ์ต์ ํ๋ EXAONE 4.0 ๋ชจ๋ธ์ ์ง์ํฉ๋๋ค.
# ์ ์ฅ์ ํด๋ก
git clone https://github.com/your-username/llm-rag-learning.git
cd llm-rag-learning
# ๊ฐ์ํ๊ฒฝ ์์ฑ ๋ฐ ํ์ฑํ
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# ํจํค์ง ์ค์น
pip install -r requirements.txt
pip install -e .
# ํ๊ฒฝ๋ณ์ ํ์ผ ์์ฑ
cp .env.example .env
# .env ํ์ผ์์ API ํค ์ค์
# OPENAI_API_KEY=your-openai-key
# ANTHROPIC_API_KEY=your-claude-key
# Ollama ๋ฐ EXAONE ๋ชจ๋ธ ์ค์
chmod +x scripts/setup_ollama.sh
./scripts/setup_ollama.sh
# Hello RAG ์์ ์คํ
python tutorials/01_getting_started/hello_rag.py
llm-rag-learning/
โโโ ๐ง core/ # ํต์ฌ ๊ธฐ๋ฅ ๋ชจ๋
โ โโโ llm_providers/ # LLM ์ ๊ณต์ (OpenAI, Claude, EXAONE)
โ โโโ data_processing/ # ๋ฐ์ดํฐ ์ฒ๋ฆฌ ๋ฐ ์๋ฒ ๋ฉ
โ โโโ retrieval/ # ๊ฒ์ ์์ง
โ โโโ evaluation/ # ํ๊ฐ ์์คํ
โโโ ๐ tutorials/ # ๋จ๊ณ๋ณ ํ์ต ํํ ๋ฆฌ์ผ
โ โโโ 01_getting_started/ # ์์ํ๊ธฐ
โ โโโ 02_data_preparation/ # ๋ฐ์ดํฐ ์ค๋น
โ โโโ 03_basic_rag/ # ๊ธฐ๋ณธ RAG
โ โโโ 04_advanced_rag/ # ๊ณ ๊ธ RAG
โ โโโ 05_local_models/ # ๋ก์ปฌ ๋ชจ๋ธ
โ โโโ 06_production_ready/ # ํ๋ก๋์
์ค๋น
โโโ ๐๏ธ frameworks/ # ํ๋ ์์ํฌ๋ณ ๊ตฌํ
โ โโโ langchain_examples/ # LangChain ์์
โ โโโ llamaindex_examples/ # LlamaIndex ์์
โโโ ๐ projects/ # ์ค์ต ํ๋ก์ ํธ
โ โโโ chatbot/ # ์ฑ๋ด ํ๋ก์ ํธ
โ โโโ document_qa/ # ๋ฌธ์ Q&A
โ โโโ knowledge_base/ # ์ง์๋ฒ ์ด์ค
โ โโโ multi_agent_rag/ # ๋ฉํฐ ์์ด์ ํธ RAG
โโโ ๐ data/ # ์ํ ๋ฐ์ดํฐ ๋ฐ ๋ฒกํฐ ์คํ ์ด
| ๋จ๊ณ | ๋ด์ฉ | ์์ ์๊ฐ | ๋์ด๋ |
|---|---|---|---|
| 1๋จ๊ณ | ์์ํ๊ธฐ | 30๋ถ | โญ |
| 2๋จ๊ณ | ๋ฐ์ดํฐ ์ค๋น | 1์๊ฐ | โญโญ |
| 3๋จ๊ณ | ๊ธฐ๋ณธ RAG | 2์๊ฐ | โญโญ |
| 4๋จ๊ณ | ๊ณ ๊ธ RAG | 3์๊ฐ | โญโญโญ |
| 5๋จ๊ณ | ๋ก์ปฌ ๋ชจ๋ธ | 2์๊ฐ | โญโญโญ |
| 6๋จ๊ณ | ํ๋ก๋์ | 4์๊ฐ | โญโญโญโญ |
| ์ ๊ณต์ | ๋ชจ๋ธ | ํน์ง |
|---|---|---|
| OpenAI | GPT-4o, GPT-4 Turbo | ๋์ ์ฑ๋ฅ, ๋ค์ํ ๊ธฐ๋ฅ |
| Anthropic | Claude-3.5 Sonnet | ์์ ์ฑ, ๊ธด ์ปจํ ์คํธ |
| LG AI | EXAONE 4.0 (32B/7.8B/2.4B) | ํ๊ตญ์ด ํนํ, ๋ก์ปฌ ์คํ |
from core.llm_providers.local_provider import LocalLLMProvider
from tutorials.hello_rag import SimpleRAG
# EXAONE ๋ชจ๋ธ๋ก RAG ์์คํ
์ด๊ธฐํ
rag = SimpleRAG("local")
# ๋ฌธ์ ์ถ๊ฐ
documents = [
"์ธ๊ณต์ง๋ฅ์ ์ธ๊ฐ์ ์ง๋ฅ์ ๋ชจ๋ฐฉํ๋ ๊ธฐ์ ์
๋๋ค.",
"๋จธ์ ๋ฌ๋์ AI์ ํ ๋ถ์ผ๋ก ๋ฐ์ดํฐ๋ก๋ถํฐ ํ์ตํฉ๋๋ค."
]
rag.add_documents(documents)
# ์ง๋ฌธํ๊ธฐ
result = rag.query("์ธ๊ณต์ง๋ฅ์ด ๋ฌด์์ธ๊ฐ์?")
print(f"๋ต๋ณ: {result['answer']}")
from langchain.chains import RetrievalQA
from frameworks.langchain_examples.advanced_rag import ConversationalRAG
# ๋ํํ RAG ์์คํ
conv_rag = ConversationalRAG(
llm_provider="local",
vector_store="chroma"
)
# ์ฐ์ ๋ํ
response1 = conv_rag.chat("RAG๊ฐ ๋ฌด์์ธ๊ฐ์?")
response2 = conv_rag.chat("๊ทธ๋ผ ์ด๋ค ์ฅ์ ์ด ์๋์?") # ์ด์ ๋ํ ๊ธฐ์ต
from core.evaluation import RAGEvaluator
evaluator = RAGEvaluator()
results = evaluator.evaluate(
questions=test_questions,
answers=generated_answers,
ground_truth=expected_answers,
metrics=["ragas", "bleu", "bertscore"]
)
# EXAONE Deep ๋ชจ๋ธ์ ๋จ๊ณ๋ณ ์ถ๋ก
prompt = "<thought>\n์ํ ๋ฌธ์ ๋ฅผ ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ฒ ์ต๋๋ค.\n</thought>\n\n2x + 5 = 15๋ฅผ ํ์ด์ฃผ์ธ์."
response = exaone_provider.generate(prompt)
| ๋ชจ๋ธ | ํ๊ตญ์ด ์ฑ๋ฅ | ์์ด ์ฑ๋ฅ | ์ถ๋ก ์๋ | ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ |
|---|---|---|---|---|
| EXAONE-32B | โญโญโญโญโญ | โญโญโญโญ | โญโญ | 32GB |
| EXAONE-7.8B | โญโญโญโญ | โญโญโญ | โญโญโญ | 8GB |
| GPT-4 | โญโญโญ | โญโญโญโญโญ | โญโญโญโญ | API |
| Claude-3.5 | โญโญโญ | โญโญโญโญโญ | โญโญโญโญ | API |
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)A: ํ์๋ ์๋์ง๋ง ๊ถ์ฅ๋ฉ๋๋ค. CPU์์๋ ์คํ ๊ฐ๋ฅํ์ง๋ง, GPU๋ฅผ ์ฌ์ฉํ๋ฉด ํจ์ฌ ๋น ๋ฅธ ์ถ๋ก ์ด ๊ฐ๋ฅํฉ๋๋ค.
A: ํ์ต ๋ชฉ์ ์ด๋ผ๋ฉด ๋ค์ ์์๋ฅผ ๊ถ์ฅํฉ๋๋ค:
A: MIT ๋ผ์ด์ผ์ค๋ก ์์ ์ ์ฌ์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค. ๋จ, ๊ฐ LLM ๋ชจ๋ธ์ ๋ผ์ด์ผ์ค๋ฅผ ๋ณ๋๋ก ํ์ธํด์ฃผ์ธ์.
์ด ํ๋ก์ ํธ๋ MIT License ํ์ ๋ฐฐํฌ๋ฉ๋๋ค.
๐ Star this repository if you find it helpful! ๐
Made with โค๏ธ for the Korean AI Community