Spaces:
Running
Running
def init_state(session_state, config): | |
initial_prompt_engineering_dict = config["PROMPT_ENGINEERING_DICT"] | |
if "messages" not in session_state: | |
session_state.messages = [] | |
if "tokens_used" not in session_state: | |
session_state.tokens_used = 0 | |
if "tps" not in session_state: | |
session_state.tps = 0 | |
if "temp" not in session_state: | |
session_state.temp = 0.8 | |
if "history" not in session_state: | |
session_state.history = [ | |
[ | |
initial_prompt_engineering_dict["SYSTEM_INSTRUCTION"], | |
initial_prompt_engineering_dict["SYSTEM_RESPONSE"], | |
] | |
] | |
if "n_crawl" not in session_state: | |
session_state.n_crawl = 5 | |
if "repetion_penalty" not in session_state: | |
session_state.repetion_penalty = 1 | |
if "rag_enabled" not in session_state: | |
session_state.rag_enabled = True | |
if "chat_bot" not in session_state: | |
session_state.chat_bot = "Mixtral 8x7B v0.1" | |
if "search_vendor" not in session_state: | |
session_state.search_vendor = "Bing" | |
if "system_instruction" not in session_state: | |
session_state.system_instruction = initial_prompt_engineering_dict[ | |
"SYSTEM_INSTRUCTION" | |
] | |
if "system_response" not in session_state: | |
session_state.system_instruction = initial_prompt_engineering_dict[ | |
"SYSTEM_RESPONSE" | |
] | |
if "pre_context" not in session_state: | |
session_state.pre_context = initial_prompt_engineering_dict["PRE_CONTEXT"] | |
if "post_context" not in session_state: | |
session_state.post_context = initial_prompt_engineering_dict["POST_CONTEXT"] | |
if "pre_prompt" not in session_state: | |
session_state.pre_prompt = initial_prompt_engineering_dict["PRE_PROMPT"] | |
if "post_prompt" not in session_state: | |
session_state.post_prompt = initial_prompt_engineering_dict["POST_PROMPT"] | |
if "pass_prev" not in session_state: | |
session_state.pass_prev = False | |
if "chunk_size" not in session_state: | |
session_state.chunk_size = 512 | |