mini-rag / src /stores /LLM /LLMInterface.py
mustaphaelkady's picture
Clean deploy mini-rag to Hugging Face
338036b
Raw
History Blame Contribute Delete
844 Bytes
from abc import ABC , abstractmethod
class LLMInterface(ABC):
@abstractmethod # to force used this method
def set_generation_model(self, model_id: str):
pass
@abstractmethod
def set_embedding_model(self, model_id: str, embeddig_size:int):
pass
@abstractmethod
def generate_text(self, prompt: str, max_output_token: int=None,
chat_history: list=[],temperature: float = None):
pass
@abstractmethod
def embed_text(self, text: str, document_type: str= None ):
pass
@abstractmethod
def embed_text(self, texts: list, document_type: str = None):
pass
@abstractmethod
def construct_prompt(self, prompt: str, role: str): # call to handle prompt before generate text method usedit
pass