mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-13 04:00:16 +00:00
tool-call
: update chat templates/goldens
This commit is contained in:
parent
4cd82d61dd
commit
2eb29bf8b8
2
tests/.gitignore
vendored
2
tests/.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
*
|
||||
!chat/
|
||||
!chat/**
|
||||
!*.*
|
||||
*.o
|
||||
ggml-common.h
|
||||
|
@ -0,0 +1 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>You only tell the truth.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,16 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
## Task and Context
|
||||
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
||||
|
||||
## Style Guide
|
||||
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results></results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Carefully perform the following instructions, in order, starting each with a new line.
|
||||
Firstly, Decide which of the retrieved documents are relevant to the user's last input by writing 'Relevant Documents:' followed by comma-separated list of document numbers. If none are relevant, you should instead write 'None'.
|
||||
Secondly, Decide which of the retrieved documents contain facts that should be cited in a good answer to the user's last input by writing 'Cited Documents:' followed a comma-separated list of document numbers. If you dont want to cite any of them, you should instead write 'None'.
|
||||
Finally, Write 'Grounded answer:' followed by a response to the user's last input in high quality natural english. Use the symbols <co: doc> and </co: doc> to indicate when a fact comes from a document in the search result, e.g <co: 0>my fact</co: 0> for a fact from document 0.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,12 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
You only tell the truth.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results></results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Carefully perform the following instructions, in order, starting each with a new line.
|
||||
Firstly, Decide which of the retrieved documents are relevant to the user's last input by writing 'Relevant Documents:' followed by comma-separated list of document numbers. If none are relevant, you should instead write 'None'.
|
||||
Secondly, Decide which of the retrieved documents contain facts that should be cited in a good answer to the user's last input by writing 'Cited Documents:' followed a comma-separated list of document numbers. If you dont want to cite any of them, you should instead write 'None'.
|
||||
Finally, Write 'Grounded answer:' followed by a response to the user's last input in high quality natural english. Use the symbols <co: doc> and </co: doc> to indicate when a fact comes from a document in the search result, e.g <co: 0>my fact</co: 0> for a fact from document 0.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,16 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
## Task and Context
|
||||
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
||||
|
||||
## Style Guide
|
||||
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Print a hello world message with python.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>Anything else?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Test a tautology.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>Truth is definitely true.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Check it on the web.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>I don't need the web to answer you but I did check, as you asked. What now?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results></results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Carefully perform the following instructions, in order, starting each with a new line.
|
||||
Firstly, Decide which of the retrieved documents are relevant to the user's last input by writing 'Relevant Documents:' followed by comma-separated list of document numbers. If none are relevant, you should instead write 'None'.
|
||||
Secondly, Decide which of the retrieved documents contain facts that should be cited in a good answer to the user's last input by writing 'Cited Documents:' followed a comma-separated list of document numbers. If you dont want to cite any of them, you should instead write 'None'.
|
||||
Finally, Write 'Grounded answer:' followed by a response to the user's last input in high quality natural english. Use the symbols <co: doc> and </co: doc> to indicate when a fact comes from a document in the search result, e.g <co: 0>my fact</co: 0> for a fact from document 0.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,25 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
## Task and Context
|
||||
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
||||
|
||||
## Style Guide
|
||||
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.
|
||||
|
||||
## Available Tools
|
||||
Here is a list of tools that you have available to you:
|
||||
|
||||
<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write 'Action:' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user's last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": title of the tool in the specification,
|
||||
"parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters
|
||||
}
|
||||
]```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,21 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
You only tell the truth.
|
||||
|
||||
## Available Tools
|
||||
Here is a list of tools that you have available to you:
|
||||
|
||||
<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>What's your favourite LLM framework?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>llama.cpp!<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write 'Action:' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user's last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": title of the tool in the specification,
|
||||
"parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters
|
||||
}
|
||||
]```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
@ -0,0 +1,99 @@
|
||||
<|startoftext|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
||||
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
||||
|
||||
# System Preamble
|
||||
## Basic Rules
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
||||
|
||||
# User Preamble
|
||||
## Task and Context
|
||||
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
||||
|
||||
## Style Guide
|
||||
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.
|
||||
|
||||
## Available Tools
|
||||
Here is a list of tools that you have available to you:
|
||||
|
||||
```python
|
||||
def ipython(code: str) -> List[Dict]:
|
||||
"""Runs code in an ipython interpreter and returns the result of the execution after 60 seconds.
|
||||
|
||||
Args:
|
||||
code (str): The code to run in the ipython interpreter.
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
```python
|
||||
def brave_search(query: str) -> List[Dict]:
|
||||
"""Executes a web search with Brave.
|
||||
|
||||
Args:
|
||||
query (str): The query to search for.
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
```python
|
||||
def wolfram_alpha(query: str) -> List[Dict]:
|
||||
"""Executes a query with Wolfram Alpha.
|
||||
|
||||
Args:
|
||||
query (str): The query to execute.
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
```python
|
||||
def test(condition: bool) -> List[Dict]:
|
||||
"""Runs a test.
|
||||
|
||||
Args:
|
||||
condition (bool): The condition to test.
|
||||
"""
|
||||
pass
|
||||
```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Print a hello world message with python.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
||||
Action:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": "ipython",
|
||||
"parameters": {
|
||||
"code": "print('Hello, World!')"
|
||||
}
|
||||
}
|
||||
]```
|
||||
<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results>
|
||||
{"stdout": "Hello, World!"}</results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>Anything else?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Test a tautology.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>None
|
||||
Action:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": "test",
|
||||
"parameters": {
|
||||
"condition": true
|
||||
}
|
||||
}
|
||||
]```
|
||||
<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results>
|
||||
true</results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>Truth is definitely true.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Check it on the web.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>None
|
||||
Action:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": "brave_search",
|
||||
"parameters": {
|
||||
"query": "what is truth anyway am I right?"
|
||||
}
|
||||
}
|
||||
]```
|
||||
<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results>
|
||||
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}</results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>I don't need the web to answer you but I did check, as you asked. What now?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write 'Action:' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user's last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": title of the tool in the specification,
|
||||
"parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters
|
||||
}
|
||||
]```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
3
tests/chat/goldens/OrionStarAI-Orion-14B-Chat-simple.txt
Normal file
3
tests/chat/goldens/OrionStarAI-Orion-14B-Chat-simple.txt
Normal file
@ -0,0 +1,3 @@
|
||||
<|startoftext|>Human: What's your favourite LLM framework?
|
||||
|
||||
Assistant: <|endoftext|>llama.cpp!<|endoftext|>
|
3
tests/chat/goldens/OrionStarAI-Orion-14B-Chat-system.txt
Normal file
3
tests/chat/goldens/OrionStarAI-Orion-14B-Chat-system.txt
Normal file
@ -0,0 +1,3 @@
|
||||
<|startoftext|>Human: What's your favourite LLM framework?
|
||||
|
||||
Assistant: <|endoftext|>llama.cpp!<|endoftext|>
|
3
tests/chat/goldens/THUDM-chatglm3-6b-simple.txt
Normal file
3
tests/chat/goldens/THUDM-chatglm3-6b-simple.txt
Normal file
@ -0,0 +1,3 @@
|
||||
[gMASK]sop<|user|>
|
||||
What's your favourite LLM framework?<|assistant|>
|
||||
llama.cpp!<|assistant|>
|
4
tests/chat/goldens/THUDM-chatglm3-6b-system.txt
Normal file
4
tests/chat/goldens/THUDM-chatglm3-6b-system.txt
Normal file
@ -0,0 +1,4 @@
|
||||
[gMASK]sop<|system|>
|
||||
You only tell the truth.<|user|>
|
||||
What's your favourite LLM framework?<|assistant|>
|
||||
llama.cpp!<|assistant|>
|
@ -0,0 +1 @@
|
||||
What's your favourite LLM framework? [/INST] llama.cpp! <|endoftext|>
|
@ -0,0 +1,5 @@
|
||||
[INST] <<SYS>>
|
||||
You only tell the truth.
|
||||
<</SYS>>
|
||||
|
||||
What's your favourite LLM framework? [/INST] llama.cpp! <|endoftext|>
|
@ -0,0 +1 @@
|
||||
<|startoftext|> Question: What's your favourite LLM framework? Answer: llama.cpp!<|endoftext|> Answer:
|
@ -0,0 +1 @@
|
||||
<|startoftext|>You only tell the truth. Question: What's your favourite LLM framework? Answer: llama.cpp!<|endoftext|> Answer:
|
@ -0,0 +1,5 @@
|
||||
<|startoftext|>[INST] <<SYS>>
|
||||
Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
|
||||
<</SYS>>
|
||||
|
||||
What's your favourite LLM framework? [/INST] llama.cpp! <|endoftext|>
|
@ -0,0 +1,5 @@
|
||||
<|startoftext|>[INST] <<SYS>>
|
||||
You only tell the truth.
|
||||
<</SYS>>
|
||||
|
||||
What's your favourite LLM framework? [/INST] llama.cpp! <|endoftext|>
|
@ -0,0 +1,3 @@
|
||||
<|startoftext|>User: What's your favourite LLM framework?
|
||||
|
||||
Assistant: llama.cpp!<|endoftext|>Assistant:
|
@ -0,0 +1,5 @@
|
||||
<|startoftext|>You only tell the truth.
|
||||
|
||||
User: What's your favourite LLM framework?
|
||||
|
||||
Assistant: llama.cpp!<|endoftext|>Assistant:
|
@ -0,0 +1,3 @@
|
||||
<|startoftext|>User: What's your favourite LLM framework?
|
||||
|
||||
Assistant: llama.cpp!<|endoftext|>Assistant:
|
@ -0,0 +1,5 @@
|
||||
<|startoftext|>You only tell the truth.
|
||||
|
||||
User: What's your favourite LLM framework?
|
||||
|
||||
Assistant: llama.cpp!<|endoftext|>Assistant:
|
1
tests/chat/goldens/deepseek-ai-DeepSeek-V2.5-simple.txt
Normal file
1
tests/chat/goldens/deepseek-ai-DeepSeek-V2.5-simple.txt
Normal file
@ -0,0 +1 @@
|
||||
<|startoftext|><|User|>What's your favourite LLM framework?<|Assistant|>llama.cpp!<|end▁of▁sentence|><|Assistant|>
|
1
tests/chat/goldens/deepseek-ai-DeepSeek-V2.5-system.txt
Normal file
1
tests/chat/goldens/deepseek-ai-DeepSeek-V2.5-system.txt
Normal file
@ -0,0 +1 @@
|
||||
<|startoftext|>You only tell the truth.<|User|>What's your favourite LLM framework?<|Assistant|>llama.cpp!<|end▁of▁sentence|><|Assistant|>
|
@ -0,0 +1,7 @@
|
||||
<|startoftext|>You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer
|
||||
### Instruction:
|
||||
What's your favourite LLM framework?
|
||||
### Response:
|
||||
llama.cpp!
|
||||
<|EOT|>
|
||||
### Response:
|
@ -0,0 +1,6 @@
|
||||
<|startoftext|>You only tell the truth.### Instruction:
|
||||
What's your favourite LLM framework?
|
||||
### Response:
|
||||
llama.cpp!
|
||||
<|EOT|>
|
||||
### Response:
|
@ -0,0 +1,3 @@
|
||||
[gMASK]<sop><|user|>
|
||||
What's your favourite LLM framework?<|assistant|>
|
||||
llama.cpp!<|assistant|>
|
@ -0,0 +1,4 @@
|
||||
[gMASK]<sop><|system|>
|
||||
You only tell the truth.<|user|>
|
||||
What's your favourite LLM framework?<|assistant|>
|
||||
llama.cpp!<|assistant|>
|
@ -0,0 +1,10 @@
|
||||
[gMASK]<sop><|user|>
|
||||
Print a hello world message with python.<|tool|>
|
||||
{"stdout": "Hello, World!"}<|assistant|>
|
||||
Anything else?<|user|>
|
||||
Test a tautology.<|tool|>
|
||||
true<|assistant|>
|
||||
Truth is definitely true.<|user|>
|
||||
Check it on the web.<|tool|>
|
||||
{"title":"Truth: don't ask the web, ask an LLM instead!","url":"https://en.wikipedia.org/wiki/Truth"}<|assistant|>
|
||||
I don't need the web to answer you but I did check, as you asked. What now?<|assistant|>
|
5
tests/chat/goldens/google-gemma-7b-it-simple.txt
Normal file
5
tests/chat/goldens/google-gemma-7b-it-simple.txt
Normal file
@ -0,0 +1,5 @@
|
||||
<|startoftext|><start_of_turn>user
|
||||
What's your favourite LLM framework?<end_of_turn>
|
||||
<start_of_turn>model
|
||||
llama.cpp!<end_of_turn>
|
||||
<start_of_turn>model
|
@ -0,0 +1 @@
|
||||
<用户>What's your favourite LLM framework?<AI>llama.cpp!
|
@ -0,0 +1 @@
|
||||
You only tell the truth.<用户>What's your favourite LLM framework?<AI>llama.cpp!
|
@ -0,0 +1,4 @@
|
||||
<|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
@ -0,0 +1,4 @@
|
||||
<|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
@ -0,0 +1,5 @@
|
||||
<|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
||||
<|assistant|>
|
@ -0,0 +1,7 @@
|
||||
<|system|>
|
||||
You only tell the truth.<|end|>
|
||||
<|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
||||
<|assistant|>
|
@ -0,0 +1,5 @@
|
||||
<|startoftext|><|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
||||
<|assistant|>
|
@ -0,0 +1,7 @@
|
||||
<|startoftext|><|system|>
|
||||
You only tell the truth.<|end|>
|
||||
<|user|>
|
||||
What's your favourite LLM framework?<|end|>
|
||||
<|assistant|>
|
||||
llama.cpp!<|end|>
|
||||
<|assistant|>
|
@ -0,0 +1 @@
|
||||
<|startoftext|> [INST] What's your favourite LLM framework? [/INST] llama.cpp!<|endoftext|>
|
@ -0,0 +1,3 @@
|
||||
<|startoftext|> [INST] You only tell the truth.
|
||||
|
||||
What's your favourite LLM framework? [/INST] llama.cpp!<|endoftext|>
|
5
tests/chat/goldens/mlabonne-AlphaMonarch-7B-simple.txt
Normal file
5
tests/chat/goldens/mlabonne-AlphaMonarch-7B-simple.txt
Normal file
@ -0,0 +1,5 @@
|
||||
<|startoftext|>user
|
||||
What's your favourite LLM framework?<|endoftext|>
|
||||
<|startoftext|>assistant
|
||||
llama.cpp!<|endoftext|>
|
||||
<|startoftext|>assistant
|
7
tests/chat/goldens/mlabonne-AlphaMonarch-7B-system.txt
Normal file
7
tests/chat/goldens/mlabonne-AlphaMonarch-7B-system.txt
Normal file
@ -0,0 +1,7 @@
|
||||
<|startoftext|>system
|
||||
You only tell the truth.<|endoftext|>
|
||||
<|startoftext|>user
|
||||
What's your favourite LLM framework?<|endoftext|>
|
||||
<|startoftext|>assistant
|
||||
llama.cpp!<|endoftext|>
|
||||
<|startoftext|>assistant
|
1
tests/chat/goldens/openchat-openchat-3.5-0106-simple.txt
Normal file
1
tests/chat/goldens/openchat-openchat-3.5-0106-simple.txt
Normal file
@ -0,0 +1 @@
|
||||
<|startoftext|>GPT4 Correct User: What's your favourite LLM framework?<|end_of_turn|>GPT4 Correct Assistant: llama.cpp!<|end_of_turn|>GPT4 Correct Assistant:
|
1
tests/chat/goldens/openchat-openchat-3.5-0106-system.txt
Normal file
1
tests/chat/goldens/openchat-openchat-3.5-0106-system.txt
Normal file
@ -0,0 +1 @@
|
||||
<|startoftext|>GPT4 Correct System: You only tell the truth.<|end_of_turn|>GPT4 Correct User: What's your favourite LLM framework?<|end_of_turn|>GPT4 Correct Assistant: llama.cpp!<|end_of_turn|>GPT4 Correct Assistant:
|
@ -0,0 +1,5 @@
|
||||
<|im_start|>user
|
||||
What's your favourite LLM framework?<|im_end|>
|
||||
<|im_start|>assistant
|
||||
llama.cpp!<|im_end|>
|
||||
<|im_start|>assistant
|
@ -0,0 +1,7 @@
|
||||
<|im_start|>system
|
||||
You only tell the truth.<|im_end|>
|
||||
<|im_start|>user
|
||||
What's your favourite LLM framework?<|im_end|>
|
||||
<|im_start|>assistant
|
||||
llama.cpp!<|im_end|>
|
||||
<|im_start|>assistant
|
@ -0,0 +1 @@
|
||||
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif false == true %}{% set loop_messages = messages %}{% set system_message = 'You are Command-R, a brilliant, sophisticated, AI-assistant trained to assist human users by providing thorough responses. You are trained by Cohere.' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% if system_message != false %}{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' + system_message + '<|END_OF_TURN_TOKEN|>' }}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% elif message['role'] == 'assistant' %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}{% endif %}
|
@ -0,0 +1,16 @@
|
||||
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = '## Task and Context\nYou help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user\'s needs as best you can, which will be wide-ranging.\n\n## Style Guide\nUnless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.' %}{% endif %}{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' }}{{ '# Safety Preamble' }}{{ '
|
||||
The instructions in this section override those in the task description and style guide sections. Don\'t answer questions that are harmful or immoral.' }}{{ '
|
||||
|
||||
# System Preamble' }}{{ '
|
||||
## Basic Rules' }}{{ '
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user\'s requests, you cite your sources in your answers, according to those instructions.' }}{{ '
|
||||
|
||||
# User Preamble' }}{{ '
|
||||
' + system_message }}{{ '<|END_OF_TURN_TOKEN|>'}}{% for message in loop_messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% elif message['role'] == 'system' %}{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% elif message['role'] == 'assistant' %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% endif %}{% endfor %}{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>'}}{{ '<results>' }}{% for document in documents %}{{ '
|
||||
Document: ' }}{{ loop.index0 }}
|
||||
{% for key, value in document.items() %}{{ key }}: {{value}}
|
||||
{% endfor %}{% endfor %}{{ '</results>'}}{{ '<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' }}{{ 'Carefully perform the following instructions, in order, starting each with a new line.
|
||||
' }}{{ 'Firstly, Decide which of the retrieved documents are relevant to the user\'s last input by writing \'Relevant Documents:\' followed by comma-separated list of document numbers. If none are relevant, you should instead write \'None\'.
|
||||
' }}{{ 'Secondly, Decide which of the retrieved documents contain facts that should be cited in a good answer to the user\'s last input by writing \'Cited Documents:\' followed a comma-separated list of document numbers. If you dont want to cite any of them, you should instead write \'None\'.
|
||||
' }}{% if citation_mode=='accurate' %}{{ 'Thirdly, Write \'Answer:\' followed by a response to the user\'s last input in high quality natural english. Use the retrieved documents to help you. Do not insert any citations or grounding markup.
|
||||
' }}{% endif %}{{ 'Finally, Write \'Grounded answer:\' followed by a response to the user\'s last input in high quality natural english. Use the symbols <co: doc> and </co: doc> to indicate when a fact comes from a document in the search result, e.g <co: 0>my fact</co: 0> for a fact from document 0.' }}{{ '<|END_OF_TURN_TOKEN|>' }}{% if add_generation_prompt %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}{% endif %}
|
@ -0,0 +1,202 @@
|
||||
|
||||
{%- macro json_to_python_type(json_spec) %}
|
||||
{%- set basic_type_map = {
|
||||
"string": "str",
|
||||
"number": "float",
|
||||
"integer": "int",
|
||||
"boolean": "bool"
|
||||
} %}
|
||||
|
||||
{%- if basic_type_map[json_spec.type] is defined %}
|
||||
{{- basic_type_map[json_spec.type] }}
|
||||
{%- elif json_spec.type == "array" %}
|
||||
{{- "List[" + json_to_python_type(json_spec.items) + "]"}}
|
||||
{%- elif json_spec.type == "object" %}
|
||||
{{- "Dict[str, " + json_to_python_type(json_spec.additionalProperties) + ']'}}
|
||||
{%- elif json_spec.type is iterable %}
|
||||
{{- "Union[" }}
|
||||
{%- for t in json_spec.type %}
|
||||
{{- json_to_python_type({"type": t}) }}
|
||||
{%- if not loop.last %}
|
||||
{{- "," }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- "]" }}
|
||||
{%- else %}
|
||||
{{- "Any" }}
|
||||
{%- endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro old_tool_parser(tools) %}
|
||||
{%- for tool in tools %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- '\n\n' }}
|
||||
{%- endif %}
|
||||
{{- '```python\ndef ' + tool.name + '(' }}
|
||||
{%- for param_name, param_fields in tool.parameter_definitions|items %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- ', '}}
|
||||
{%- endif %}
|
||||
{{- param_name + ': ' }}
|
||||
{%- if not param_fields.required %}
|
||||
{{- 'Optional[' + param_fields.type + '] = None'}}
|
||||
{%- else %}
|
||||
{{- param_fields.type }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- ') -> List[Dict]:\n """'}}
|
||||
{{- tool.description }}
|
||||
{%- if tool.parameter_definitions|length != 0 %}
|
||||
{{- '\n\n Args:\n '}}
|
||||
{%- for param_name, param_fields in tool.parameter_definitions|items %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- '\n ' }}
|
||||
{%- endif %}
|
||||
{{- param_name + ' ('}}
|
||||
{%- if not param_fields.required %}
|
||||
{{- 'Optional[' + param_fields.type + ']'}}
|
||||
{%- else %}
|
||||
{{- param_fields.type }}
|
||||
{%- endif %}
|
||||
{{- '): ' + param_fields.description }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '\n """\n pass\n```' }}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro new_tool_parser(tools) %}
|
||||
{%- for tool in tools %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- '\n\n'}}
|
||||
{%- endif %}
|
||||
{%- if tool.function is defined %}
|
||||
{%- set tool = tool.function %}
|
||||
{%- endif %}
|
||||
{{-'```python
|
||||
def ' + tool.name + '('}}
|
||||
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- ', '}}
|
||||
{%- endif %}
|
||||
{{-param_name + ": "}}
|
||||
{%- if not param_name in tool.parameters.required %}
|
||||
{{-'Optional[' + json_to_python_type(param_fields) + '] = None'}}
|
||||
{%- else %}
|
||||
{{- json_to_python_type(param_fields) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- ') -> List[Dict]:
|
||||
"""'}}
|
||||
{{- tool.description }}
|
||||
{%- if tool.parameters.properties|length != 0 %}
|
||||
{{- '\n\n Args:\n '}}
|
||||
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
||||
{%- if loop.index0 != 0 %}
|
||||
{{- '\n ' }}
|
||||
{%- endif %}
|
||||
{{- param_name + ' ('}}
|
||||
{%- if not param_name in tool.parameters.required %}
|
||||
{{-'Optional[' + json_to_python_type(param_fields) + ']'}}
|
||||
{%- else %}
|
||||
{{- json_to_python_type(param_fields) }}
|
||||
{%- endif %}
|
||||
{{- '): ' + param_fields.description }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '\n """\n pass\n```' }}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{{- bos_token }}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{%- set loop_messages = messages[1:] %}
|
||||
{%- set system_message = messages[0]['content'] %}
|
||||
{%- else %}
|
||||
{%- set loop_messages = messages %}
|
||||
{%- set system_message = '## Task and Context\nYou help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user\'s needs as best you can, which will be wide-ranging.\n\n## Style Guide\nUnless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.' %}
|
||||
{%- endif %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' }}
|
||||
{{- '# Safety Preamble' }}
|
||||
{{- '
|
||||
The instructions in this section override those in the task description and style guide sections. Don\'t answer questions that are harmful or immoral.' }}
|
||||
{{- '
|
||||
|
||||
# System Preamble' }}
|
||||
{{- '
|
||||
## Basic Rules' }}
|
||||
{{- '
|
||||
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user\'s requests, you cite your sources in your answers, according to those instructions.' }}
|
||||
{{- '
|
||||
|
||||
# User Preamble' }}
|
||||
{{- '
|
||||
' + system_message }}
|
||||
{{-'
|
||||
|
||||
## Available Tools
|
||||
Here is a list of tools that you have available to you:
|
||||
|
||||
'}}
|
||||
{%- set ns = namespace(new_tools=true) %}
|
||||
{%- for tool in tools %}
|
||||
{%- if tool.parameter_definitions is defined %}
|
||||
{%- set ns.new_tools = false %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if ns.new_tools %}
|
||||
{{- new_tool_parser(tools) }}
|
||||
{%- else %}
|
||||
{{- old_tool_parser(tools) }}
|
||||
{%- endif %}
|
||||
{{- '<|END_OF_TURN_TOKEN|>'}}
|
||||
{%- for message in loop_messages %}
|
||||
{%- set content = message['content'] %}
|
||||
{%- if message.role == 'user' %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' + content|trim + '<|END_OF_TURN_TOKEN|>' }}
|
||||
{%- elif message.role == 'system' %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' + content|trim + '<|END_OF_TURN_TOKEN|>' }}
|
||||
{%- elif message.role == 'assistant' and message.tool_calls is defined %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}
|
||||
{%- if message.content is defined %}
|
||||
{{- message.content|trim }}
|
||||
{%- endif %}
|
||||
{{- '\nAction:\n```json\n[\n' }}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if tool_call.function is defined %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '{\n'|indent(4, first=true) }}
|
||||
{{- '"tool_name": "'|indent(8, first=true) + tool_call.name + '",\n' }}
|
||||
{{- '"parameters": '|indent(8, first=true) }}
|
||||
{%- if tool_call.arguments is defined and tool_call.arguments|length > 0 %}
|
||||
{{- tool_call.arguments|tojson(indent=4)|indent(8) }}
|
||||
{{- '\n' }}
|
||||
{%- else %}
|
||||
{{- '{}\n' }}
|
||||
{%- endif %}
|
||||
{{- '}'|indent(4, first=true) }}
|
||||
{%- if not loop.last %}
|
||||
{{- ',\n' }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- "\n]```\n" }}
|
||||
{%- elif message.role == 'assistant' %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' + content|trim + '<|END_OF_TURN_TOKEN|>' }}
|
||||
{%- elif message.role == 'tool' %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results>\n' }}
|
||||
{{- message.content|trim }}
|
||||
{{- '</results><|END_OF_TURN_TOKEN|>' }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{-'<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write \'Action:\' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user\'s last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tool_name": title of the tool in the specification,
|
||||
"parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters
|
||||
}
|
||||
]```<|END_OF_TURN_TOKEN|>'}}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}
|
||||
{%- endif %}
|
3
tests/chat/templates/OrionStarAI-Orion-14B-Chat.jinja
Normal file
3
tests/chat/templates/OrionStarAI-Orion-14B-Chat.jinja
Normal file
@ -0,0 +1,3 @@
|
||||
{% for message in messages %}{% if loop.first %}{{ bos_token }}{% endif %}{% if message['role'] == 'user' %}{{ 'Human: ' + message['content'] + '
|
||||
|
||||
Assistant: ' + eos_token }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token }}{% endif %}{% endfor %}
|
3
tests/chat/templates/THUDM-chatglm3-6b.jinja
Normal file
3
tests/chat/templates/THUDM-chatglm3-6b.jinja
Normal file
@ -0,0 +1,3 @@
|
||||
{% for message in messages %}{% if loop.first %}[gMASK]sop<|{{ message['role'] }}|>
|
||||
{{ message['content'] }}{% else %}<|{{ message['role'] }}|>
|
||||
{{ message['content'] }}{% endif %}{% endfor %}{% if add_generation_prompt %}<|assistant|>{% endif %}
|
13
tests/chat/templates/TheBloke-FusionNet_34Bx2_MoE-AWQ.jinja
Normal file
13
tests/chat/templates/TheBloke-FusionNet_34Bx2_MoE-AWQ.jinja
Normal file
@ -0,0 +1,13 @@
|
||||
{%- for idx in range(0, messages|length) -%}
|
||||
{%- if messages[idx]['role'] == 'user' -%}
|
||||
{%- if idx > 1 -%}
|
||||
{{- bos_token + '[INST] ' + messages[idx]['content'] + ' [/INST]' -}}
|
||||
{%- else -%}
|
||||
{{- messages[idx]['content'] + ' [/INST]' -}}
|
||||
{%- endif -%}
|
||||
{% elif messages[idx]['role'] == 'system' %}
|
||||
{{- '[INST] <<SYS>>\n' + messages[idx]['content'] + '\n<</SYS>>\n\n' -}}
|
||||
{%- elif messages[idx]['role'] == 'assistant' -%}
|
||||
{{- ' ' + messages[idx]['content'] + ' ' + eos_token -}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -0,0 +1 @@
|
||||
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{{ bos_token }}{% for message in messages %}{% if message['role'] == 'user' %}{{ ' Question: ' + message['content']}}{% elif message['role'] == 'assistant' %}{{ ' Answer: ' + message['content'] + eos_token }}{% elif message['role'] == 'system' %}{{ message['content']}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ ' Answer: ' }}{% endif %}
|
@ -0,0 +1 @@
|
||||
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif true == true and not '<<SYS>>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<<SYS>>\n' + content.strip() + '\n<</SYS>>\n\n' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}
|
@ -0,0 +1,5 @@
|
||||
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{{ bos_token }}{% for message in messages %}{% if message['role'] == 'user' %}{{ 'User: ' + message['content'] + '
|
||||
|
||||
' }}{% elif message['role'] == 'assistant' %}{{ 'Assistant: ' + message['content'] + eos_token }}{% elif message['role'] == 'system' %}{{ message['content'] + '
|
||||
|
||||
' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
|
@ -0,0 +1,5 @@
|
||||
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{{ bos_token }}{% for message in messages %}{% if message['role'] == 'user' %}{{ 'User: ' + message['content'] + '
|
||||
|
||||
' }}{% elif message['role'] == 'assistant' %}{{ 'Assistant: ' + message['content'] + eos_token }}{% elif message['role'] == 'system' %}{{ message['content'] + '
|
||||
|
||||
' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
|
1
tests/chat/templates/deepseek-ai-DeepSeek-V2.5.jinja
Normal file
1
tests/chat/templates/deepseek-ai-DeepSeek-V2.5.jinja
Normal file
@ -0,0 +1 @@
|
||||
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}{%- for message in messages %} {%- if message['role'] == 'system' %} {% set ns.system_prompt = message['content'] %} {%- endif %}{%- endfor %}{{bos_token}}{{ns.system_prompt}}{%- for message in messages %} {%- if message['role'] == 'user' %} {%- set ns.is_tool = false -%}{{'<|User|>' + message['content']}} {%- endif %} {%- if message['role'] == 'assistant' and message['content'] is none %} {%- set ns.is_tool = false -%} {%- for tool in message['tool_calls']%} {%- if not ns.is_first %}{{'<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}} {%- set ns.is_first = true -%} {%- else %}{{'\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}} {%- endif %} {%- endfor %} {%- endif %} {%- if message['role'] == 'assistant' and message['content'] is not none %} {%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + message['content'] + '<|end▁of▁sentence|>'}} {%- set ns.is_tool = false -%} {%- else %}{{'<|Assistant|>' + message['content'] + '<|end▁of▁sentence|>'}} {%- endif %} {%- endif %} {%- if message['role'] == 'tool' %} {%- set ns.is_tool = true -%} {%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}} {%- set ns.is_output_first = false %} {%- else %}{{'\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}} {%- endif %} {%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_tool %}{{'<|Assistant|>'}}{% endif %}
|
@ -0,0 +1,26 @@
|
||||
{% if not add_generation_prompt is defined %}
|
||||
{% set add_generation_prompt = false %}
|
||||
{% endif %}
|
||||
{%- set ns = namespace(found=false) -%}
|
||||
{%- for message in messages -%}
|
||||
{%- if message['role'] == 'system' -%}
|
||||
{%- set ns.found = true -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{{bos_token}}{%- if not ns.found -%}
|
||||
{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\n'}}
|
||||
{%- endif %}
|
||||
{%- for message in messages %}
|
||||
{%- if message['role'] == 'system' %}
|
||||
{{ message['content'] }}
|
||||
{%- else %}
|
||||
{%- if message['role'] == 'user' %}
|
||||
{{'### Instruction:\n' + message['content'] + '\n'}}
|
||||
{%- else %}
|
||||
{{'### Response:\n' + message['content'] + '\n<|EOT|>\n'}}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% if add_generation_prompt %}
|
||||
{{'### Response:'}}
|
||||
{% endif %}
|
37
tests/chat/templates/derek33125-project-angel-chatglm4.jinja
Normal file
37
tests/chat/templates/derek33125-project-angel-chatglm4.jinja
Normal file
@ -0,0 +1,37 @@
|
||||
[gMASK]<sop>{% for item in messages %}{% if item['tools'] is defined %}<|system|>
|
||||
你是一个名为 ChatGLM 的人工智能助手。你是基于智谱AI训练的语言模型 GLM-4 模型开发的,你的任务是针对用户的问题和要求提供适当的答复和支持。
|
||||
|
||||
# 可用工具{% set tools = item['tools'] %}{% for tool in tools %}{% if tool['type'] == 'function' %}
|
||||
|
||||
## {{ tool['function']['name'] }}
|
||||
|
||||
{{ tool['function'] | tojson(indent=4) }}
|
||||
在调用上述函数时,请使用 Json 格式表示调用的参数。{% elif tool['type'] == 'python' %}
|
||||
|
||||
## python
|
||||
|
||||
当你向 `python` 发送包含 Python 代码的消息时,该代码将会在一个有状态的 Jupyter notebook 环境中执行。
|
||||
`python` 返回代码执行的输出,或在执行 60 秒后返回超时。
|
||||
`/mnt/data` 将会持久化存储你的文件。在此会话中,`python` 无法访问互联网。不要使用 `python` 进行任何网络请求或者在线 API 调用,这些在线内容的访问将不会成功。{% elif tool['type'] == 'simple_browser' %}
|
||||
|
||||
## simple_browser
|
||||
|
||||
你可以使用 `simple_browser` 工具。该工具支持以下函数:
|
||||
`search(query: str, recency_days: int)`:使用搜索引擎进行查询并显示结果,可以使用 `recency_days` 参数控制搜索内容的时效性。
|
||||
`mclick(ids: list[int])`:获取一系列指定 id 的页面内容。每次调用时,须选择3-10个页面。选择多个角度的页面,同时尽可能选择可信任的信息来源。考虑到部分页面是无法加载的,你也可以多打开一些可能有用的页面而不用担心内容过多。
|
||||
`open_url(url: str)`:打开指定的 URL。
|
||||
|
||||
使用 `【{引用 id}†{引用文本}】` 来引用内容。
|
||||
|
||||
操作步骤:1. 使用 `search` 来获得信息列表; 2. 使用 `mclick` 来获取指定 ID 页面的内容; 3. 根据获得的内容进行回复。在回复中应当引用信息来源。
|
||||
如果用户提供了 URL,也可以用 `open_url` 直接打开页面。
|
||||
如果初次搜索结果没有找到合适的信息,也可以再次使用 `search` 进行搜索。{% elif tool['type'] == 'cogview' %}
|
||||
|
||||
## cogview
|
||||
|
||||
如果用户的请求中包含了对图像的描述,你可以使用 `cogview` 来生成图像并展示给用户。你需要向 `cogview` 发送图像描述,规则:
|
||||
- 发送给 `cogview` 的消息必须使用英语。用户的中文描述必须完全翻译为英语。
|
||||
- 应当尽可能详细地描述图像生成的需求,需求描述约 100 英文单词。
|
||||
- 保持用户原始描述的意图。不要虚构内容或者没见过的人物。
|
||||
- 如无特殊说明,所在地为中国,持有中国立场并遵循中国社会主义价值观。{% endif %}{% endfor %}{% endif %}{% if item['content'] %}<|{{ item['role'] }}|>{{ item['metadata'] }}
|
||||
{{ item['content'] }}{% endif %}{% endfor %}{% if add_generation_prompt %}<|assistant|>{% endif %}
|
4
tests/chat/templates/google-gemma-7b-it.jinja
Normal file
4
tests/chat/templates/google-gemma-7b-it.jinja
Normal file
@ -0,0 +1,4 @@
|
||||
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '
|
||||
' + message['content'] | trim + '<end_of_turn>
|
||||
' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model
|
||||
'}}{% endif %}
|
@ -0,0 +1 @@
|
||||
{% for message in messages %}{% if message['role'] == 'user' %}{{'<用户>' + message['content'].strip() + '<AI>'}}{% else %}{{message['content'].strip()}}{% endif %}{% endfor %}
|
@ -0,0 +1,5 @@
|
||||
{% for message in messages %}{% if (message['role'] == 'user') %}{{'<|user|>' + '
|
||||
' + message['content'] + '<|end|>' + '
|
||||
' + '<|assistant|>' + '
|
||||
'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '<|end|>' + '
|
||||
'}}{% endif %}{% endfor %}
|
@ -0,0 +1,8 @@
|
||||
{% for message in messages %}{% if message['role'] == 'system' %}{{'<|system|>
|
||||
' + message['content'] + '<|end|>
|
||||
'}}{% elif message['role'] == 'user' %}{{'<|user|>
|
||||
' + message['content'] + '<|end|>
|
||||
'}}{% elif message['role'] == 'assistant' %}{{'<|assistant|>
|
||||
' + message['content'] + '<|end|>
|
||||
'}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>
|
||||
' }}{% else %}{{ eos_token }}{% endif %}
|
@ -0,0 +1,4 @@
|
||||
{{ bos_token }}{% for message in messages %}{{'<|' + message['role'] + '|>' + '
|
||||
' + message['content'] + '<|end|>
|
||||
' }}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>
|
||||
' }}{% else %}{{ eos_token }}{% endif %}
|
@ -0,0 +1,24 @@
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{%- set system_message = messages[0]['content'] %}
|
||||
{%- set loop_messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{%- set loop_messages = messages %}
|
||||
{%- endif %}
|
||||
|
||||
{{- bos_token }}
|
||||
{%- for message in loop_messages %}
|
||||
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}
|
||||
{{- raise_exception('After the optional system message, conversation roles must alternate user/assistant/user/assistant/...') }}
|
||||
{%- endif %}
|
||||
{%- if message['role'] == 'user' %}
|
||||
{%- if loop.first and system_message is defined %}
|
||||
{{- ' [INST] ' + system_message + '\n\n' + message['content'] + ' [/INST]' }}
|
||||
{%- else %}
|
||||
{{- ' [INST] ' + message['content'] + ' [/INST]' }}
|
||||
{%- endif %}
|
||||
{%- elif message['role'] == 'assistant' %}
|
||||
{{- ' ' + message['content'] + eos_token}}
|
||||
{%- else %}
|
||||
{{- raise_exception('Only user and assistant roles are supported, with the exception of an initial optional system message!') }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
4
tests/chat/templates/mlabonne-AlphaMonarch-7B.jinja
Normal file
4
tests/chat/templates/mlabonne-AlphaMonarch-7B.jinja
Normal file
@ -0,0 +1,4 @@
|
||||
{% for message in messages %}{{bos_token + message['role'] + '
|
||||
' + message['content'] + eos_token + '
|
||||
'}}{% endfor %}{% if add_generation_prompt %}{{ bos_token + 'assistant
|
||||
' }}{% endif %}
|
1
tests/chat/templates/openchat-openchat-3.5-0106.jinja
Normal file
1
tests/chat/templates/openchat-openchat-3.5-0106.jinja
Normal file
@ -0,0 +1 @@
|
||||
{{ bos_token }}{% for message in messages %}{{ 'GPT4 Correct ' + message['role'].title() + ': ' + message['content'] + '<|end_of_turn|>'}}{% endfor %}{% if add_generation_prompt %}{{ 'GPT4 Correct Assistant:' }}{% endif %}
|
@ -0,0 +1,4 @@
|
||||
{% for message in messages %}{{'<|im_start|>' + message['role'] + '
|
||||
' + message['content'] + '<|im_end|>' + '
|
||||
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
||||
' }}{% endif %}
|
Loading…
Reference in New Issue
Block a user