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 []