File size: 844 Bytes
338036b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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