chore(prompt): discourage literal \n in tool params
This commit is contained in:
@@ -312,13 +312,14 @@ CRITICAL RULES:
|
|||||||
2. Tool call must be last in message
|
2. Tool call must be last in message
|
||||||
3. EVERY tool call MUST end with </function>. This is MANDATORY. Never omit the closing tag. End your response immediately after </function>.
|
3. EVERY tool call MUST end with </function>. This is MANDATORY. Never omit the closing tag. End your response immediately after </function>.
|
||||||
4. Use ONLY the exact XML format shown above. NEVER use JSON/YAML/INI or any other syntax for tools or parameters.
|
4. Use ONLY the exact XML format shown above. NEVER use JSON/YAML/INI or any other syntax for tools or parameters.
|
||||||
5. Tool names must match exactly the tool "name" defined (no module prefixes, dots, or variants).
|
5. When sending ANY multi-line content in tool parameters, use real newlines (actual line breaks). Do NOT emit literal "\n" sequences. If you send "\n" instead of real line breaks inside the XML parameter value, tools may fail or behave incorrectly.
|
||||||
|
6. Tool names must match exactly the tool "name" defined (no module prefixes, dots, or variants).
|
||||||
- Correct: <function=think> ... </function>
|
- Correct: <function=think> ... </function>
|
||||||
- Incorrect: <thinking_tools.think> ... </function>
|
- Incorrect: <thinking_tools.think> ... </function>
|
||||||
- Incorrect: <think> ... </think>
|
- Incorrect: <think> ... </think>
|
||||||
- Incorrect: {"think": {...}}
|
- Incorrect: {"think": {...}}
|
||||||
6. Parameters must use <parameter=param_name>value</parameter> exactly. Do NOT pass parameters as JSON or key:value lines. Do NOT add quotes/braces around values.
|
7. Parameters must use <parameter=param_name>value</parameter> exactly. Do NOT pass parameters as JSON or key:value lines. Do NOT add quotes/braces around values.
|
||||||
7. Do NOT wrap tool calls in markdown/code fences or add any text before or after the tool block.
|
8. Do NOT wrap tool calls in markdown/code fences or add any text before or after the tool block.
|
||||||
|
|
||||||
Example (agent creation tool):
|
Example (agent creation tool):
|
||||||
<function=create_agent>
|
<function=create_agent>
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
- Print statements and stdout are captured
|
- Print statements and stdout are captured
|
||||||
- Variables persist between executions in the same session
|
- Variables persist between executions in the same session
|
||||||
- Imports, function definitions, etc. persist in the session
|
- Imports, function definitions, etc. persist in the session
|
||||||
|
- IMPORTANT (multiline): Put real line breaks in <parameter=code>. Do NOT emit literal "\n" sequences.
|
||||||
- IPython magic commands are fully supported (%pip, %time, %whos, %%writefile, etc.)
|
- IPython magic commands are fully supported (%pip, %time, %whos, %%writefile, etc.)
|
||||||
- Line magics (%) and cell magics (%%) work as expected
|
- Line magics (%) and cell magics (%%) work as expected
|
||||||
6. CLOSE: Terminates the session completely and frees memory
|
6. CLOSE: Terminates the session completely and frees memory
|
||||||
@@ -73,6 +74,14 @@
|
|||||||
print("Security analysis session started")</parameter>
|
print("Security analysis session started")</parameter>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
<function=python_action>
|
||||||
|
<parameter=action>execute</parameter>
|
||||||
|
<parameter=code>import requests
|
||||||
|
url = "https://example.com"
|
||||||
|
resp = requests.get(url, timeout=10)
|
||||||
|
print(resp.status_code)</parameter>
|
||||||
|
</function>
|
||||||
|
|
||||||
# Analyze security data in the default session
|
# Analyze security data in the default session
|
||||||
<function=python_action>
|
<function=python_action>
|
||||||
<parameter=action>execute</parameter>
|
<parameter=action>execute</parameter>
|
||||||
|
|||||||
@@ -95,6 +95,12 @@
|
|||||||
<parameter=command>ls -la</parameter>
|
<parameter=command>ls -la</parameter>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
<function=terminal_execute>
|
||||||
|
<parameter=command>cd /workspace
|
||||||
|
pwd
|
||||||
|
ls -la</parameter>
|
||||||
|
</function>
|
||||||
|
|
||||||
# Run a command with custom timeout
|
# Run a command with custom timeout
|
||||||
<function=terminal_execute>
|
<function=terminal_execute>
|
||||||
<parameter=command>npm install</parameter>
|
<parameter=command>npm install</parameter>
|
||||||
|
|||||||
Reference in New Issue
Block a user