Update test_chat_handlers.md
This commit is contained in:
parent
22fe86d8b8
commit
6e52a9ce48
1 changed files with 0 additions and 720 deletions
|
@ -1139,723 +1139,3 @@ space ::= " "?
|
||||||
|
|
||||||
## hermes_2_pro_mistral / TOOLS_HERMES_2_PRO
|
## hermes_2_pro_mistral / TOOLS_HERMES_2_PRO
|
||||||
|
|
||||||
|
|
||||||
### hermes_2_pro_mistral / TOOLS_HERMES_2_PRO / with tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<|im_start|>system
|
|
||||||
You are a function calling AI agent with self-recursion. You can call only one function at a time and analyse data you get from function response. You are provided with function signatures within <tools></tools> XML tags. The current date is: 2024-03-30. You may use agentic frameworks for reasoning and planning to help with user query. Please call a function and wait for function results to be provided to you in the next iteration. Don't make assumptions about what values to plug into function arguments. Once you have called a function, results will be fed back to you within <tool_response></tool_response> XML tags. Don't make assumptions about tool results if <tool_response> XML tags are not present since function hasn't been executed yet. Analyze the data once you get the results and call another function. At each iteration please continue adding the your analysis to previous summary. Your final response should directly answer the user query with an anlysis or summary of the results of function calls. Here are the available tools: <tools> ['{"type":"function","function":{"name":"superSecretTool","description":"Adds two numbers","parameters":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"]}}}', '{"type":"function","function":{"name":"say","description":"Says something out loud (TTS)","parameters":{"properties":{"text":{"description":"The text to say out loud","type":"string"}},"required":["text"]}}}'] </tools> If the provided function signatures doesn't have the function you must call, you may write executable python code in markdown syntax and call code_interpreter() function as follows: <tool_call> {"arguments": {"code_markdown": <python-code>, "name": "code_interpreter"}} </tool_call> Make sure that the json object above with code markdown block is parseable with json.loads() and the XML block with XML ElementTree. Use the following pydantic model json schema for each tool call you will make: {'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name'], 'title': 'FunctionCall', 'type': 'object'} At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
|
|
||||||
Please keep a running summary with analysis of previous function results and summaries from previous iterations.
|
|
||||||
Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
|
|
||||||
Calling multiple functions at once can overload the system and increase cost so call one function at a time please.
|
|
||||||
If you plan to continue with analysis, always call another function.
|
|
||||||
For each function call return a valid json object (using doulbe quotes) with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"arguments": <args-dict>, "name": <function-name>}
|
|
||||||
</tool_call>
|
|
||||||
<|im_end|>
|
|
||||||
<|im_start|>user
|
|
||||||
Add two numbers for the purpose of this test.<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call><|im_end|>
|
|
||||||
<|im_start|>tool
|
|
||||||
32222002938<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
The sum of 2535 and 32222000403 is 42.<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
You are a function calling AI agent with self-recursion. You can call only one function at a time and analyse data you get from function response. You are provided with function signatures within <tools></tools> XML tags. The current date is: 2024-03-30. You may use agentic frameworks for reasoning and planning to help with user query. Please call a function and wait for function results to be provided to you in the next iteration. Don't make assumptions about what values to plug into function arguments. Once you have called a function, results will be fed back to you within <tool_response></tool_response> XML tags. Don't make assumptions about tool results if <tool_response> XML tags are not present since function hasn't been executed yet. Analyze the data once you get the results and call another function. At each iteration please continue adding the your analysis to previous summary. Your final response should directly answer the user query with an anlysis or summary of the results of function calls. Here are the available tools: <tools> ['{"type":"function","function":{"name":"superSecretTool","description":"Adds two numbers","parameters":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"]}}}', '{"type":"function","function":{"name":"say","description":"Says something out loud (TTS)","parameters":{"properties":{"text":{"description":"The text to say out loud","type":"string"}},"required":["text"]}}}'] </tools> If the provided function signatures doesn't have the function you must call, you may write executable python code in markdown syntax and call code_interpreter() function as follows: <tool_call> {"arguments": {"code_markdown": <python-code>, "name": "code_interpreter"}} </tool_call> Make sure that the json object above with code markdown block is parseable with json.loads() and the XML block with XML ElementTree. Use the following pydantic model json schema for each tool call you will make: {'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name'], 'title': 'FunctionCall', 'type': 'object'} At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
|
|
||||||
Please keep a running summary with analysis of previous function results and summaries from previous iterations.
|
|
||||||
Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
|
|
||||||
Calling multiple functions at once can overload the system and increase cost so call one function at a time please.
|
|
||||||
If you plan to continue with analysis, always call another function.
|
|
||||||
For each function call return a valid json object (using doulbe quotes) with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"arguments": <args-dict>, "name": <function-name>}
|
|
||||||
</tool_call>
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
content ::= [^<] | "<" [^t<] | "<t" [^o<]
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integer ::= ("-"? integral-part) space
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= content* tool-call?
|
|
||||||
say-tool-call ::= "{" space say-tool-call-name-kv "," space say-tool-call-arguments-kv "}" space
|
|
||||||
say-tool-call-arguments ::= "{" space say-tool-call-arguments-text-kv "}" space
|
|
||||||
say-tool-call-arguments-kv ::= "\"arguments\"" space ":" space say-tool-call-arguments
|
|
||||||
say-tool-call-arguments-text-kv ::= "\"text\"" space ":" space string
|
|
||||||
say-tool-call-name ::= "\"say\""
|
|
||||||
say-tool-call-name-kv ::= "\"name\"" space ":" space say-tool-call-name
|
|
||||||
space ::= " "?
|
|
||||||
string ::= "\"" (
|
|
||||||
[^"\\] |
|
|
||||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])
|
|
||||||
)* "\"" space
|
|
||||||
superSecretTool-tool-call ::= "{" space superSecretTool-tool-call-name-kv "," space superSecretTool-tool-call-arguments-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments ::= "{" space superSecretTool-tool-call-arguments-a-kv "," space superSecretTool-tool-call-arguments-b-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments-a-kv ::= "\"a\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-b-kv ::= "\"b\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-kv ::= "\"arguments\"" space ":" space superSecretTool-tool-call-arguments
|
|
||||||
superSecretTool-tool-call-name ::= "\"superSecretTool\""
|
|
||||||
superSecretTool-tool-call-name-kv ::= "\"name\"" space ":" space superSecretTool-tool-call-name
|
|
||||||
tool-call ::= "<tool_call>" space (superSecretTool-tool-call | say-tool-call) space "</tool_call>"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### hermes_2_pro_mistral / TOOLS_HERMES_2_PRO / without tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<|im_start|>system
|
|
||||||
Please respond in JSON format with the following schema: number<|im_end|>
|
|
||||||
<|im_start|>user
|
|
||||||
Add two numbers for the purpose of this test.<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call><|im_end|>
|
|
||||||
<|im_start|>tool
|
|
||||||
32222002938<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
The sum of 2535 and 32222000403 is 42.<|im_end|>
|
|
||||||
<|im_start|>assistant
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Please respond in JSON format with the following schema: number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= ("-"? integral-part) space
|
|
||||||
space ::= " "?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# llama2
|
|
||||||
|
|
||||||
|
|
||||||
Template:
|
|
||||||
|
|
||||||
```js
|
|
||||||
{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% 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' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## llama2 / TOOLS_SHORT
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_SHORT / with tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Here are the tools available:
|
|
||||||
<tools>
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "superSecretTool",
|
|
||||||
"description": "Adds two numbers",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"a": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"b": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"a",
|
|
||||||
"b"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "say",
|
|
||||||
"description": "Says something out loud (TTS)",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"text": {
|
|
||||||
"description": "The text to say out loud",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"text"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tools>[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Here are the tools available:
|
|
||||||
<tools>
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "superSecretTool",
|
|
||||||
"description": "Adds two numbers",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"a": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"b": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"a",
|
|
||||||
"b"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "say",
|
|
||||||
"description": "Says something out loud (TTS)",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"text": {
|
|
||||||
"description": "The text to say out loud",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"text"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tools>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
content ::= [^<] | "<" [^t<] | "<t" [^o<]
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integer ::= ("-"? integral-part) space
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= content* tool-call?
|
|
||||||
say-tool-call ::= "{" space say-tool-call-name-kv "," space say-tool-call-arguments-kv "}" space
|
|
||||||
say-tool-call-arguments ::= "{" space say-tool-call-arguments-text-kv "}" space
|
|
||||||
say-tool-call-arguments-kv ::= "\"arguments\"" space ":" space say-tool-call-arguments
|
|
||||||
say-tool-call-arguments-text-kv ::= "\"text\"" space ":" space string
|
|
||||||
say-tool-call-name ::= "\"say\""
|
|
||||||
say-tool-call-name-kv ::= "\"name\"" space ":" space say-tool-call-name
|
|
||||||
space ::= " "?
|
|
||||||
string ::= "\"" (
|
|
||||||
[^"\\] |
|
|
||||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])
|
|
||||||
)* "\"" space
|
|
||||||
superSecretTool-tool-call ::= "{" space superSecretTool-tool-call-name-kv "," space superSecretTool-tool-call-arguments-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments ::= "{" space superSecretTool-tool-call-arguments-a-kv "," space superSecretTool-tool-call-arguments-b-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments-a-kv ::= "\"a\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-b-kv ::= "\"b\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-kv ::= "\"arguments\"" space ":" space superSecretTool-tool-call-arguments
|
|
||||||
superSecretTool-tool-call-name ::= "\"superSecretTool\""
|
|
||||||
superSecretTool-tool-call-name-kv ::= "\"name\"" space ":" space superSecretTool-tool-call-name
|
|
||||||
tool-call ::= "<tool_call>" space (superSecretTool-tool-call | say-tool-call) space "</tool_call>"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_SHORT / without tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Please respond in JSON format with the following schema: number[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Please respond in JSON format with the following schema: number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= ("-"? integral-part) space
|
|
||||||
space ::= " "?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## llama2 / TOOLS_LONG
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_LONG / with tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Call one or more functions to assist with the user query, every time this is possible. Don't make assumptions about what values to plug into functions. Here are the available tools:
|
|
||||||
<tools>
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "superSecretTool",
|
|
||||||
"description": "Adds two numbers",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"a": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"b": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"a",
|
|
||||||
"b"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "say",
|
|
||||||
"description": "Says something out loud (TTS)",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"text": {
|
|
||||||
"description": "The text to say out loud",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"text"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tools>
|
|
||||||
|
|
||||||
To call each function, give its name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"name": <function-name>, "arguments": <args-dict>}
|
|
||||||
</tool_call>[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Call one or more functions to assist with the user query, every time this is possible. Don't make assumptions about what values to plug into functions. Here are the available tools:
|
|
||||||
<tools>
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "superSecretTool",
|
|
||||||
"description": "Adds two numbers",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"a": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"b": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"a",
|
|
||||||
"b"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "say",
|
|
||||||
"description": "Says something out loud (TTS)",
|
|
||||||
"parameters": {
|
|
||||||
"properties": {
|
|
||||||
"text": {
|
|
||||||
"description": "The text to say out loud",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"text"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tools>
|
|
||||||
|
|
||||||
To call each function, give its name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"name": <function-name>, "arguments": <args-dict>}
|
|
||||||
</tool_call>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
content ::= [^<] | "<" [^t<] | "<t" [^o<]
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integer ::= ("-"? integral-part) space
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= content* tool-call?
|
|
||||||
say-tool-call ::= "{" space say-tool-call-name-kv "," space say-tool-call-arguments-kv "}" space
|
|
||||||
say-tool-call-arguments ::= "{" space say-tool-call-arguments-text-kv "}" space
|
|
||||||
say-tool-call-arguments-kv ::= "\"arguments\"" space ":" space say-tool-call-arguments
|
|
||||||
say-tool-call-arguments-text-kv ::= "\"text\"" space ":" space string
|
|
||||||
say-tool-call-name ::= "\"say\""
|
|
||||||
say-tool-call-name-kv ::= "\"name\"" space ":" space say-tool-call-name
|
|
||||||
space ::= " "?
|
|
||||||
string ::= "\"" (
|
|
||||||
[^"\\] |
|
|
||||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])
|
|
||||||
)* "\"" space
|
|
||||||
superSecretTool-tool-call ::= "{" space superSecretTool-tool-call-name-kv "," space superSecretTool-tool-call-arguments-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments ::= "{" space superSecretTool-tool-call-arguments-a-kv "," space superSecretTool-tool-call-arguments-b-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments-a-kv ::= "\"a\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-b-kv ::= "\"b\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-kv ::= "\"arguments\"" space ":" space superSecretTool-tool-call-arguments
|
|
||||||
superSecretTool-tool-call-name ::= "\"superSecretTool\""
|
|
||||||
superSecretTool-tool-call-name-kv ::= "\"name\"" space ":" space superSecretTool-tool-call-name
|
|
||||||
tool-call ::= "<tool_call>" space (superSecretTool-tool-call | say-tool-call) space "</tool_call>"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_LONG / without tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Please respond in JSON format with the following schema: number[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Please respond in JSON format with the following schema: number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= ("-"? integral-part) space
|
|
||||||
space ::= " "?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## llama2 / TOOLS_THOUGHTFUL_STEPS
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_THOUGHTFUL_STEPS / with tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]You are a function calling AI model.
|
|
||||||
Here are the tools available:
|
|
||||||
namespace functions {
|
|
||||||
// Adds two numbers
|
|
||||||
type superSecretTool = (_: {
|
|
||||||
a: number,
|
|
||||||
b: number
|
|
||||||
}) => any;
|
|
||||||
|
|
||||||
// Says something out loud (TTS)
|
|
||||||
type say = (_: {
|
|
||||||
// The text to say out loud
|
|
||||||
text: string
|
|
||||||
}) => any;
|
|
||||||
} // namespace functions
|
|
||||||
Please respond in JSON format with the following schema: {
|
|
||||||
thought_about_next_step_only: string,
|
|
||||||
next_step: {
|
|
||||||
tool_calls: [{
|
|
||||||
name: string,
|
|
||||||
arguments: any
|
|
||||||
}][]
|
|
||||||
}|{
|
|
||||||
result: number
|
|
||||||
}
|
|
||||||
}[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] {
|
|
||||||
"thought_about_next_step_only": "I've thought a lot about this.",
|
|
||||||
"next_step": {
|
|
||||||
"tool_calls": [
|
|
||||||
{
|
|
||||||
"id": "call_531873",
|
|
||||||
"type": "function",
|
|
||||||
"function": {
|
|
||||||
"name": "superSecretTool",
|
|
||||||
"arguments": {
|
|
||||||
"a": 2535,
|
|
||||||
"b": 32222000403
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
} </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] {
|
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "The sum of 2535 and 32222000403 is 42."
|
|
||||||
}
|
|
||||||
} </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
You are a function calling AI model.
|
|
||||||
Here are the tools available:
|
|
||||||
namespace functions {
|
|
||||||
// Adds two numbers
|
|
||||||
type superSecretTool = (_: {
|
|
||||||
a: number,
|
|
||||||
b: number
|
|
||||||
}) => any;
|
|
||||||
|
|
||||||
// Says something out loud (TTS)
|
|
||||||
type say = (_: {
|
|
||||||
// The text to say out loud
|
|
||||||
text: string
|
|
||||||
}) => any;
|
|
||||||
} // namespace functions
|
|
||||||
Please respond in JSON format with the following schema: {
|
|
||||||
thought_about_next_step_only: string,
|
|
||||||
next_step: {
|
|
||||||
tool_calls: [{
|
|
||||||
name: string,
|
|
||||||
arguments: any
|
|
||||||
}][]
|
|
||||||
}|{
|
|
||||||
result: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integer ::= ("-"? integral-part) space
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
next-step ::= next-step-0 | next-step-1
|
|
||||||
next-step-0 ::= "{" space next-step-0-tool-calls-kv "}" space
|
|
||||||
next-step-0-tool-calls ::= "[" space next-step-0-tool-calls-tuple-0 "]" space
|
|
||||||
next-step-0-tool-calls-kv ::= "\"tool_calls\"" space ":" space next-step-0-tool-calls
|
|
||||||
next-step-0-tool-calls-tuple-0 ::= next-step-0-tool-calls-tuple-0-0 | next-step-0-tool-calls-tuple-0-1
|
|
||||||
next-step-0-tool-calls-tuple-0-0 ::= "{" space next-step-0-tool-calls-tuple-0-0-name-kv "," space next-step-0-tool-calls-tuple-0-0-arguments-kv "}" space
|
|
||||||
next-step-0-tool-calls-tuple-0-0-arguments ::= "{" space next-step-0-tool-calls-tuple-0-0-arguments-a-kv "," space next-step-0-tool-calls-tuple-0-0-arguments-b-kv "}" space
|
|
||||||
next-step-0-tool-calls-tuple-0-0-arguments-a-kv ::= "\"a\"" space ":" space integer
|
|
||||||
next-step-0-tool-calls-tuple-0-0-arguments-b-kv ::= "\"b\"" space ":" space integer
|
|
||||||
next-step-0-tool-calls-tuple-0-0-arguments-kv ::= "\"arguments\"" space ":" space next-step-0-tool-calls-tuple-0-0-arguments
|
|
||||||
next-step-0-tool-calls-tuple-0-0-name ::= "\"superSecretTool\""
|
|
||||||
next-step-0-tool-calls-tuple-0-0-name-kv ::= "\"name\"" space ":" space next-step-0-tool-calls-tuple-0-0-name
|
|
||||||
next-step-0-tool-calls-tuple-0-1 ::= "{" space next-step-0-tool-calls-tuple-0-1-name-kv "," space next-step-0-tool-calls-tuple-0-1-arguments-kv "}" space
|
|
||||||
next-step-0-tool-calls-tuple-0-1-arguments ::= "{" space next-step-0-tool-calls-tuple-0-1-arguments-text-kv "}" space
|
|
||||||
next-step-0-tool-calls-tuple-0-1-arguments-kv ::= "\"arguments\"" space ":" space next-step-0-tool-calls-tuple-0-1-arguments
|
|
||||||
next-step-0-tool-calls-tuple-0-1-arguments-text-kv ::= "\"text\"" space ":" space string
|
|
||||||
next-step-0-tool-calls-tuple-0-1-name ::= "\"say\""
|
|
||||||
next-step-0-tool-calls-tuple-0-1-name-kv ::= "\"name\"" space ":" space next-step-0-tool-calls-tuple-0-1-name
|
|
||||||
next-step-1 ::= "{" space next-step-1-result-kv "}" space
|
|
||||||
next-step-1-result-kv ::= "\"result\"" space ":" space integer
|
|
||||||
next-step-kv ::= "\"next_step\"" space ":" space next-step
|
|
||||||
root ::= "{" space thought-about-next-step-only-kv "," space next-step-kv "}" space
|
|
||||||
space ::= " "?
|
|
||||||
string ::= "\"" (
|
|
||||||
[^"\\] |
|
|
||||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])
|
|
||||||
)* "\"" space
|
|
||||||
thought-about-next-step-only-kv ::= "\"thought_about_next_step_only\"" space ":" space string
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_THOUGHTFUL_STEPS / without tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Please respond in JSON format with the following schema: number[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Please respond in JSON format with the following schema: number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= ("-"? integral-part) space
|
|
||||||
space ::= " "?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## llama2 / TOOLS_HERMES_2_PRO
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_HERMES_2_PRO / with tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]You are a function calling AI agent with self-recursion. You can call only one function at a time and analyse data you get from function response. You are provided with function signatures within <tools></tools> XML tags. The current date is: 2024-03-30. You may use agentic frameworks for reasoning and planning to help with user query. Please call a function and wait for function results to be provided to you in the next iteration. Don't make assumptions about what values to plug into function arguments. Once you have called a function, results will be fed back to you within <tool_response></tool_response> XML tags. Don't make assumptions about tool results if <tool_response> XML tags are not present since function hasn't been executed yet. Analyze the data once you get the results and call another function. At each iteration please continue adding the your analysis to previous summary. Your final response should directly answer the user query with an anlysis or summary of the results of function calls. Here are the available tools: <tools> ['{"type":"function","function":{"name":"superSecretTool","description":"Adds two numbers","parameters":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"]}}}', '{"type":"function","function":{"name":"say","description":"Says something out loud (TTS)","parameters":{"properties":{"text":{"description":"The text to say out loud","type":"string"}},"required":["text"]}}}'] </tools> If the provided function signatures doesn't have the function you must call, you may write executable python code in markdown syntax and call code_interpreter() function as follows: <tool_call> {"arguments": {"code_markdown": <python-code>, "name": "code_interpreter"}} </tool_call> Make sure that the json object above with code markdown block is parseable with json.loads() and the XML block with XML ElementTree. Use the following pydantic model json schema for each tool call you will make: {'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name'], 'title': 'FunctionCall', 'type': 'object'} At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
|
|
||||||
Please keep a running summary with analysis of previous function results and summaries from previous iterations.
|
|
||||||
Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
|
|
||||||
Calling multiple functions at once can overload the system and increase cost so call one function at a time please.
|
|
||||||
If you plan to continue with analysis, always call another function.
|
|
||||||
For each function call return a valid json object (using doulbe quotes) with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"arguments": <args-dict>, "name": <function-name>}
|
|
||||||
</tool_call>
|
|
||||||
[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
You are a function calling AI agent with self-recursion. You can call only one function at a time and analyse data you get from function response. You are provided with function signatures within <tools></tools> XML tags. The current date is: 2024-03-30. You may use agentic frameworks for reasoning and planning to help with user query. Please call a function and wait for function results to be provided to you in the next iteration. Don't make assumptions about what values to plug into function arguments. Once you have called a function, results will be fed back to you within <tool_response></tool_response> XML tags. Don't make assumptions about tool results if <tool_response> XML tags are not present since function hasn't been executed yet. Analyze the data once you get the results and call another function. At each iteration please continue adding the your analysis to previous summary. Your final response should directly answer the user query with an anlysis or summary of the results of function calls. Here are the available tools: <tools> ['{"type":"function","function":{"name":"superSecretTool","description":"Adds two numbers","parameters":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"]}}}', '{"type":"function","function":{"name":"say","description":"Says something out loud (TTS)","parameters":{"properties":{"text":{"description":"The text to say out loud","type":"string"}},"required":["text"]}}}'] </tools> If the provided function signatures doesn't have the function you must call, you may write executable python code in markdown syntax and call code_interpreter() function as follows: <tool_call> {"arguments": {"code_markdown": <python-code>, "name": "code_interpreter"}} </tool_call> Make sure that the json object above with code markdown block is parseable with json.loads() and the XML block with XML ElementTree. Use the following pydantic model json schema for each tool call you will make: {'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name'], 'title': 'FunctionCall', 'type': 'object'} At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
|
|
||||||
Please keep a running summary with analysis of previous function results and summaries from previous iterations.
|
|
||||||
Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
|
|
||||||
Calling multiple functions at once can overload the system and increase cost so call one function at a time please.
|
|
||||||
If you plan to continue with analysis, always call another function.
|
|
||||||
For each function call return a valid json object (using doulbe quotes) with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
|
||||||
<tool_call>
|
|
||||||
{"arguments": <args-dict>, "name": <function-name>}
|
|
||||||
</tool_call>
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
content ::= [^<] | "<" [^t<] | "<t" [^o<]
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integer ::= ("-"? integral-part) space
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= content* tool-call?
|
|
||||||
say-tool-call ::= "{" space say-tool-call-name-kv "," space say-tool-call-arguments-kv "}" space
|
|
||||||
say-tool-call-arguments ::= "{" space say-tool-call-arguments-text-kv "}" space
|
|
||||||
say-tool-call-arguments-kv ::= "\"arguments\"" space ":" space say-tool-call-arguments
|
|
||||||
say-tool-call-arguments-text-kv ::= "\"text\"" space ":" space string
|
|
||||||
say-tool-call-name ::= "\"say\""
|
|
||||||
say-tool-call-name-kv ::= "\"name\"" space ":" space say-tool-call-name
|
|
||||||
space ::= " "?
|
|
||||||
string ::= "\"" (
|
|
||||||
[^"\\] |
|
|
||||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])
|
|
||||||
)* "\"" space
|
|
||||||
superSecretTool-tool-call ::= "{" space superSecretTool-tool-call-name-kv "," space superSecretTool-tool-call-arguments-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments ::= "{" space superSecretTool-tool-call-arguments-a-kv "," space superSecretTool-tool-call-arguments-b-kv "}" space
|
|
||||||
superSecretTool-tool-call-arguments-a-kv ::= "\"a\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-b-kv ::= "\"b\"" space ":" space integer
|
|
||||||
superSecretTool-tool-call-arguments-kv ::= "\"arguments\"" space ":" space superSecretTool-tool-call-arguments
|
|
||||||
superSecretTool-tool-call-name ::= "\"superSecretTool\""
|
|
||||||
superSecretTool-tool-call-name-kv ::= "\"name\"" space ":" space superSecretTool-tool-call-name
|
|
||||||
tool-call ::= "<tool_call>" space (superSecretTool-tool-call | say-tool-call) space "</tool_call>"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### llama2 / TOOLS_HERMES_2_PRO / without tools
|
|
||||||
|
|
||||||
|
|
||||||
Prompt:
|
|
||||||
|
|
||||||
```js
|
|
||||||
<s>[INST] [SYS]Please respond in JSON format with the following schema: number[/SYS]
|
|
||||||
Add two numbers for the purpose of this test. [/INST] I've thought a lot about this.
|
|
||||||
<tool_call>{"id": "call_531873", "type": "function", "function": {"name": "superSecretTool", "arguments": {"a": 2535, "b": 32222000403}}}</tool_call> </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] The sum of 2535 and 32222000403 is 42. </s>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Output format prompt:
|
|
||||||
|
|
||||||
```json
|
|
||||||
Please respond in JSON format with the following schema: number
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Grammar:
|
|
||||||
|
|
||||||
```js
|
|
||||||
decimal-part ::= [0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
integral-part ::= [0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?
|
|
||||||
root ::= ("-"? integral-part) space
|
|
||||||
space ::= " "?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue