Phase 7: Hoàn thiện Modular RAG Backend với FastAPI và Đa LLM Provider
This commit is contained in:
16
chat/llm_providers/base_llm.py
Normal file
16
chat/llm_providers/base_llm.py
Normal 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
|
||||
Reference in New Issue
Block a user