MCP - RAG를 활용한 질의응답 시스템
MCP는 RAG(Retrieval-Augmented Generation) 기법을 사용하여 문서 집합을 기반으로 정확하고 상황에 맞는 답변을 제공하는 고급 질의응답 시스템입니다.
특징
- 🔍 문서 내 의미 검색
- 💾 Redis를 활용한 스마트 캐싱
- 📊 MongoDB를 사용한 영구 저장소
- 🤖 임베딩 및 텍스트 생성을 위한 OpenAI와의 통합
- 📈 시스템 모니터링 및 메트릭
- 🔄 비동기 작업 관리
필수 조건
- 파이썬 3.9 이상
- MongoDB 커뮤니티 에디션
- 레디스
- OpenAI API 키
시설
- 저장소를 복제합니다.
지엑스피1
- 시스템 종속성 설치:
# MongoDB
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
# Redis
brew install redis
brew services start redis
- Python 환경 구성:
python -m venv .venv
source .venv/bin/activate # Sur Unix/macOS
pip install -r requirements.txt
- 환경 변수 구성:
cp .env.example .env
# Éditer .env avec vos configurations
빠른 사용
from src.rag import RAGWorkflow
# Initialisation
rag = RAGWorkflow()
# Ingestion de documents
await rag.ingest_documents("chemin/vers/documents")
# Interrogation
response = await rag.query("Votre question ici ?")
선적 서류 비치
테스트
python -m pytest tests/ -v
프로젝트 구조
mcp/
├── src/
│ ├── __init__.py
│ ├── rag.py # Workflow RAG principal
│ ├── models.py # Modèles de données
│ ├── mongo_operations.py # Opérations MongoDB
│ ├── redis_operations.py # Opérations Redis
│ └── database.py # Configuration de la base de données
├── tests/
│ ├── __init__.py
│ ├── test_mcp.py
│ └── test_mongo_integration.py
├── prompts/
│ ├── system_prompt.txt
│ ├── query_prompt.txt
│ └── response_prompt.txt
├── docs/
│ ├── installation.md
│ ├── usage.md
│ ├── architecture.md
│ └── api.md
├── requirements.txt
├── .env.example
└── README.md
기부금
- 프로젝트를 포크하다
- 기능에 대한 브랜치를 만듭니다(
git checkout -b feature/AmazingFeature
) - 변경 사항을 커밋합니다(
git commit -m 'Add some AmazingFeature'
) - 브랜치에 푸시(
git push origin feature/AmazingFeature
) - 풀 리퀘스트 열기
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 LICENSE 파일을 참조하세요.
연락하다
당신의 이름 - @your_twitter
프로젝트 링크: https://github.com/your-username/mcp