diff --git a/examples/openai/prompting.py b/examples/openai/prompting.py
index 222e133f0..b5c19e8fd 100644
--- a/examples/openai/prompting.py
+++ b/examples/openai/prompting.py
@@ -206,7 +206,7 @@ class ChatHandler(ABC):
def render_prompt(self, messages: list[Message]) -> str:
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:
m = Message(
role=m.role,
diff --git a/examples/openai/test_chat_handlers.md b/examples/openai/test_chat_handlers.md
index f01bbce21..28146dac0 100644
--- a/examples/openai/test_chat_handlers.md
+++ b/examples/openai/test_chat_handlers.md
@@ -66,12 +66,7 @@ Template:
Prompt:
```js
-[INST] {
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "Add two numbers for the purpose of this test."
- }
-} [/INST]{
+[INST] Add two numbers for the purpose of this test. [/INST]{
"thought_about_next_step_only": "",
"next_step": {
"tool_calls": [
@@ -88,12 +83,7 @@ Prompt:
}
]
}
-}[INST] [TOOL(name=None, id=None)]{
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "32222002938"
- }
-}[/TOOL] [/INST]{
+}[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."
@@ -862,12 +852,7 @@ Prompt:
```js
<|im_start|>user
-{
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "Add two numbers for the purpose of this test."
- }
-}<|im_end|>
+Add two numbers for the purpose of this test.<|im_end|>
<|im_start|>assistant
{
"thought_about_next_step_only": "",
@@ -888,12 +873,7 @@ Prompt:
}
}<|im_end|>
<|im_start|>tool
-{
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "32222002938"
- }
-}<|im_end|>
+32222002938<|im_end|>
<|im_start|>assistant
{
"thought_about_next_step_only": "",
@@ -1455,12 +1435,7 @@ space ::= " "?
Prompt:
```js
-[INST] {
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "Add two numbers for the purpose of this test."
- }
-} [/INST] {
+[INST] Add two numbers for the purpose of this test. [/INST] {
"thought_about_next_step_only": "",
"next_step": {
"tool_calls": [
@@ -1477,12 +1452,7 @@ Prompt:
}
]
}
-} [INST] [TOOL(name=None, id=None)]{
- "thought_about_next_step_only": "",
- "next_step": {
- "result": "32222002938"
- }
-}[/TOOL] [/INST] {
+} [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."