File size: 1,484 Bytes
d04e577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from llama_cpp_agent.messages_formatter import MessagesFormatter, PromptMarkers, Roles

mistral_v1_markers = {
    Roles.system: PromptMarkers(""" [INST]""", """ [/INST] Understood.</s>"""),
    Roles.user: PromptMarkers(""" [INST]""", """ [/INST]"""),
    Roles.assistant: PromptMarkers(" ", "</s>"),
    Roles.tool: PromptMarkers("", ""),
}

mistral_v1_formatter = MessagesFormatter(
    pre_prompt="",
    prompt_markers=mistral_v1_markers,
    include_sys_prompt_in_first_user_message=False,
    default_stop_sequences=["</s>"]
)

mistral_v2_markers = {
    Roles.system: PromptMarkers("""[INST] """, """[/INST] Understood.</s>"""),
    Roles.user: PromptMarkers("""[INST] """, """[/INST]"""),
    Roles.assistant: PromptMarkers(" ", "</s>"),
    Roles.tool: PromptMarkers("", ""),
}

mistral_v2_formatter = MessagesFormatter(
    pre_prompt="",
    prompt_markers=mistral_v2_markers,
    include_sys_prompt_in_first_user_message=False,
    default_stop_sequences=["</s>"]
)

mistral_v3_tekken_markers = {
    Roles.system: PromptMarkers("""[INST]""", """[/INST]Understood.</s>"""),
    Roles.user: PromptMarkers("""[INST]""", """[/INST]"""),
    Roles.assistant: PromptMarkers("", "</s>"),
    Roles.tool: PromptMarkers("", ""),
}

mistral_v3_tekken_formatter = MessagesFormatter(
    pre_prompt="",
    prompt_markers=mistral_v3_tekken_markers,
    include_sys_prompt_in_first_user_message=False,
    default_stop_sequences=["</s>"]
)