pabloce commited on
Commit
8b44200
1 Parent(s): 8ecb9de

Create settings.py

Browse files
Files changed (1) hide show
  1. settings.py +22 -0
settings.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llama_cpp_agent import MessagesFormatterType
2
+
3
+ def get_context_by_model(model_name):
4
+ model_context_limits = {
5
+ "Mistral-7B-Instruct-v0.3-Q6_K.gguf": 32768,
6
+ "mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf": 32768,
7
+ "Meta-Llama-3-8B-Instruct-Q6_K.gguf": 8192
8
+ }
9
+ return model_context_limits.get(model_name, None)
10
+
11
+ def get_messages_formatter_type(model_name):
12
+ model_name = model_name.lower()
13
+ if any(keyword in model_name for keyword in ["meta", "aya"]):
14
+ return MessagesFormatterType.LLAMA_3
15
+ elif any(keyword in model_name for keyword in ["mistral", "mixtral"]):
16
+ return MessagesFormatterType.MISTRAL
17
+ elif any(keyword in model_name for keyword in ["einstein", "dolphin"]):
18
+ return MessagesFormatterType.CHATML
19
+ elif "phi" in model_name:
20
+ return MessagesFormatterType.PHI_3
21
+ else:
22
+ return MessagesFormatterType.CHATML