openai: only special-format assistant in thoughtful mode
This commit is contained in:
parent
d9f30f86c8
commit
da2067a0d6
2 changed files with 7 additions and 37 deletions
|
@ -206,7 +206,7 @@ class ChatHandler(ABC):
|
||||||
|
|
||||||
def render_prompt(self, messages: list[Message]) -> str:
|
def render_prompt(self, messages: list[Message]) -> str:
|
||||||
def normalize(m: Message):
|
def normalize(m: Message):
|
||||||
if self.style == ToolsPromptStyle.TOOLS_THOUGHTFUL_STEPS:
|
if self.style == ToolsPromptStyle.TOOLS_THOUGHTFUL_STEPS and m.role == "assistant":
|
||||||
if m.tool_calls:
|
if m.tool_calls:
|
||||||
m = Message(
|
m = Message(
|
||||||
role=m.role,
|
role=m.role,
|
||||||
|
|
|
@ -66,12 +66,7 @@ Template:
|
||||||
Prompt:
|
Prompt:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
<s>[INST] {
|
<s>[INST] Add two numbers for the purpose of this test. [/INST]{
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "Add two numbers for the purpose of this test."
|
|
||||||
}
|
|
||||||
} [/INST]{
|
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
"next_step": {
|
"next_step": {
|
||||||
"tool_calls": [
|
"tool_calls": [
|
||||||
|
@ -88,12 +83,7 @@ Prompt:
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}</s>[INST] [TOOL(name=None, id=None)]{
|
}</s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST]{
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "32222002938"
|
|
||||||
}
|
|
||||||
}[/TOOL] [/INST]{
|
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
"next_step": {
|
"next_step": {
|
||||||
"result": "The sum of 2535 and 32222000403 is 42."
|
"result": "The sum of 2535 and 32222000403 is 42."
|
||||||
|
@ -862,12 +852,7 @@ Prompt:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
<|im_start|>user
|
<|im_start|>user
|
||||||
{
|
Add two numbers for the purpose of this test.<|im_end|>
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "Add two numbers for the purpose of this test."
|
|
||||||
}
|
|
||||||
}<|im_end|>
|
|
||||||
<|im_start|>assistant
|
<|im_start|>assistant
|
||||||
{
|
{
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
|
@ -888,12 +873,7 @@ Prompt:
|
||||||
}
|
}
|
||||||
}<|im_end|>
|
}<|im_end|>
|
||||||
<|im_start|>tool
|
<|im_start|>tool
|
||||||
{
|
32222002938<|im_end|>
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "32222002938"
|
|
||||||
}
|
|
||||||
}<|im_end|>
|
|
||||||
<|im_start|>assistant
|
<|im_start|>assistant
|
||||||
{
|
{
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
|
@ -1455,12 +1435,7 @@ space ::= " "?
|
||||||
Prompt:
|
Prompt:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
<s>[INST] {
|
<s>[INST] Add two numbers for the purpose of this test. [/INST] {
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "Add two numbers for the purpose of this test."
|
|
||||||
}
|
|
||||||
} [/INST] {
|
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
"next_step": {
|
"next_step": {
|
||||||
"tool_calls": [
|
"tool_calls": [
|
||||||
|
@ -1477,12 +1452,7 @@ Prompt:
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
} </s><s>[INST] [TOOL(name=None, id=None)]{
|
} </s><s>[INST] [TOOL(name=superSecretTool, id=call_531873)]32222002938[/TOOL] [/INST] {
|
||||||
"thought_about_next_step_only": "",
|
|
||||||
"next_step": {
|
|
||||||
"result": "32222002938"
|
|
||||||
}
|
|
||||||
}[/TOOL] [/INST] {
|
|
||||||
"thought_about_next_step_only": "",
|
"thought_about_next_step_only": "",
|
||||||
"next_step": {
|
"next_step": {
|
||||||
"result": "The sum of 2535 and 32222000403 is 42."
|
"result": "The sum of 2535 and 32222000403 is 42."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue