File size: 2,364 Bytes
097caae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import configparser

class SettingManager:

    def __init__(self):

        #Accessing default config
        self.config=configparser.ConfigParser()
        self.config.read("config.ini")

        #getting default params
        self.ai_assisted_search=self.config.getboolean('RAG','default_ai_assisted_search')
        self.max_new_token=self.config.getint("Settings", "MAX_NEW_TOKENS")
        self.top_p=self.config.getfloat("Settings", "TOP_P")
        self.defaultLLM=self.config.getint('Settings', 'DEFAULT_LLM')
        self.temperature=self.config.getfloat("Settings", "TEMPERATURE")
        self.repetition_penalty=self.config.getfloat("Settings", "REPETITION_PENALITY")
        self.system_prompt=self.config.get("Settings", "default_prompt")
        self.n_doc_return=self.config.getint('RAG','default_returned_docs')
        self.available_search_methods=self.config.get('RAG','methods').split(',')
        self.search_method=self.config.get('RAG','default_search_method')
        self.default_ai_search_prompt=self.config.get("RAG", "default_ai_search_prompt")

        self.RAG_max_new_token=self.config.getint("RAG", "RAG_MAX_NEW_TOKENS")
        self.RAG_top_p=self.config.getfloat("RAG", "RAG_TOP_P")
        self.RAG_temperature=self.config.getfloat("RAG", "RAG_TEMPERATURE")
        self.RAG_repetition_penalty=self.config.getfloat("RAG", "RAG_REPETITION_PENALITY")

        #Loading available LLM
        self.listLLM=self.get_llm()
        self.listLLMMap=self.get_llm_map()

        #Function used to get a list of available LLM
    def get_llm(self):
        llm_section = 'LLM'
        if llm_section in self.config:
            return [self.config.get(llm_section, llm) for llm in self.config[llm_section]]
        else:
            return []
        
    #Function used to get a list of available LLM
    def get_llm_prompts(self):
        prompt_section = 'Prompt_map'
        if prompt_section in self.config:
            return [self.config.get(prompt_section, llm) for llm in self.config[prompt_section]]
        else:
            return []
    
    #Function used to get the list of llm Map
    def get_llm_map(self):
        llm_map_section = 'LLM_Map'
        if llm_map_section in self.config:
            return [self.config.get(llm_map_section, llm) for llm in self.config[llm_map_section]]
        else:
            return []