Phase 7: Hoàn thiện Modular RAG Backend với FastAPI và Đa LLM Provider

This commit is contained in:
2026-05-08 07:30:30 +00:00
commit 26d1298cf6
51 changed files with 5360 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from abc import ABC, abstractmethod
from typing import List, Dict
class BaseLLMProvider(ABC):
"""
Interface gốc cho tất cả các mô hình Ngôn ngữ (Chat LLMs).
Đảm bảo tính dễ mở rộng (Cắm rút API khác nhau) mà không làm vỡ kiến trúc RAG.
"""
@abstractmethod
def generate_response(self, prompt: str, context: str, history: List[Dict[str, str]] = None) -> str:
"""
Nhận vào ngữ cảnh (từ VectorDB) và câu hỏi của user (prompt),
Trả về câu trả lời cuối cùng dưới dạng Text.
"""
pass