Files
Loki/rust/loki-rs/tests/parity/appel_textuel.json
T
Claude bc388d7a01 Lot 6 : parité de la boucle d'un tour avec le Go (journaux de référence)
internal/loki/parity_test.go rejoue 19 scénarios dans runChatTools contre
un faux moteur aux réponses scriptées, outils aux résultats fixés
(execToolHook, nil en service) : réponse simple, raisonnement, outils
seuls et en parallèle, appel répété, arguments illisibles, outil inconnu,
budget dépassé, « pensé sans agir » une et deux fois, pensée en ligne,
échantillonnage et intensité, raisonnement coupé, 500 une et deux fois,
erreur du moteur, appel d'outil écrit en texte, API externe, historique
déjà outillé. Les corps envoyés au moteur, les événements d'affichage
(texte regroupé, mesures ignorées), l'historique ajouté et l'erreur sont
rangés dans rust/loki-rs/tests/parity/*.json ; le test Go échoue si la
boucle ne les produit plus (LOKI_PARITY_UPDATE=1 pour régénérer).

rust/loki-rs/tests/parity.rs rejoue les mêmes scénarios dans
chat::turn::run_turn et retrouve les 19 journaux à l'identique.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016tcGfJWefW5kUGoC2wL8cv
2026-10-15 11:32:11 +00:00

408 lines
13 KiB
JSON

{
"name": "appel_textuel",
"cfg": {},
"messages": [
{
"role": "system",
"content": "Tu es Loki."
},
{
"role": "user",
"content": "Lis a.txt"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "read",
"description": "Read a file with 1-indexed line numbers (offset/limit for long files). ALWAYS use this instead of cat/type: output is bounded and reading a file is REQUIRED before you may edit or overwrite it.",
"parameters": {
"properties": {
"file": {
"description": "Path (relative to the working folder)",
"type": "string"
},
"limit": {
"description": "Lines (default 400, max 1000)",
"type": "integer"
},
"offset": {
"description": "Start line (default 1)",
"type": "integer"
}
},
"required": [
"file"
],
"type": "object"
}
}
},
{
"type": "function",
"function": {
"name": "bash",
"description": "Run a shell command (bash syntax) and return stdout, stderr and exit code: inspect the system, read files and logs, run scripts. To CREATE or REWRITE a file use write instead — never echo/cat/python -c. Avoid destructive commands unless asked.",
"parameters": {
"properties": {
"command": {
"description": "The command",
"type": "string"
},
"timeout": {
"description": "Timeout s (default 30, max 300)",
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
}
}
}
],
"temperature": 0.7,
"replies": [
{
"status": 200,
"lines": [
"data: {\"choices\":[{\"delta\":{\"content\":\"\\u003ctool_call\\u003e{\\\"name\\\":\\\"read\\\",\\\"arguments\\\":{\\\"file\\\":\\\"a.txt\\\"}}\\u003c/tool_call\\u003e\"}}]}",
"data: {\"choices\":[{\"delta\":{},\"finish_reason\":\"stop\"}],\"usage\":{\"completion_tokens\":5,\"prompt_tokens\":100}}",
"data: [DONE]"
]
},
{
"status": 200,
"lines": [
"data: {\"choices\":[{\"delta\":{\"tool_calls\":[{\"function\":{\"arguments\":\"{\\\"file\\\":\\\"a.txt\\\"}\",\"name\":\"read\"},\"id\":\"c1\",\"index\":0,\"type\":\"function\"}]}}]}",
"data: {\"choices\":[{\"delta\":{},\"finish_reason\":\"tool_calls\"}],\"usage\":{\"completion_tokens\":5,\"prompt_tokens\":100}}",
"data: [DONE]"
]
},
{
"status": 200,
"lines": [
"data: {\"choices\":[{\"delta\":{\"content\":\"Deux lignes.\"}}]}",
"data: {\"choices\":[{\"delta\":{},\"finish_reason\":\"stop\"}],\"usage\":{\"completion_tokens\":5,\"prompt_tokens\":100}}",
"data: [DONE]"
]
}
],
"tool_results": {
"bash": "a.txt\nb.txt",
"read": "ligne 1\nligne 2"
},
"expect": {
"requests": [
{
"messages": [
{
"content": "Tu es Loki.",
"role": "system"
},
{
"content": "Lis a.txt",
"role": "user"
}
],
"model": "loki",
"parallel_tool_calls": false,
"stream": true,
"stream_options": {
"include_usage": true
},
"temperature": 0.7,
"tools": [
{
"function": {
"description": "Read a file with 1-indexed line numbers (offset/limit for long files). ALWAYS use this instead of cat/type: output is bounded and reading a file is REQUIRED before you may edit or overwrite it.",
"name": "read",
"parameters": {
"properties": {
"file": {
"description": "Path (relative to the working folder)",
"type": "string"
},
"limit": {
"description": "Lines (default 400, max 1000)",
"type": "integer"
},
"offset": {
"description": "Start line (default 1)",
"type": "integer"
}
},
"required": [
"file"
],
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Run a shell command (bash syntax) and return stdout, stderr and exit code: inspect the system, read files and logs, run scripts. To CREATE or REWRITE a file use write instead — never echo/cat/python -c. Avoid destructive commands unless asked.",
"name": "bash",
"parameters": {
"properties": {
"command": {
"description": "The command",
"type": "string"
},
"timeout": {
"description": "Timeout s (default 30, max 300)",
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
}
},
"type": "function"
}
]
},
{
"messages": [
{
"content": "Tu es Loki.",
"role": "system"
},
{
"content": "Lis a.txt",
"role": "user"
},
{
"content": "<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>",
"role": "assistant"
},
{
"content": "Your last answer contained a TOOL CALL WRITTEN AS TEXT — it was never executed:\n<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>\nTool calls must go through the tool-call protocol, never in the answer text. Redo it now: emit the real tool call, or answer directly without pretending to call a tool.",
"role": "user"
}
],
"model": "loki",
"parallel_tool_calls": false,
"stream": true,
"stream_options": {
"include_usage": true
},
"temperature": 0.7,
"tools": [
{
"function": {
"description": "Read a file with 1-indexed line numbers (offset/limit for long files). ALWAYS use this instead of cat/type: output is bounded and reading a file is REQUIRED before you may edit or overwrite it.",
"name": "read",
"parameters": {
"properties": {
"file": {
"description": "Path (relative to the working folder)",
"type": "string"
},
"limit": {
"description": "Lines (default 400, max 1000)",
"type": "integer"
},
"offset": {
"description": "Start line (default 1)",
"type": "integer"
}
},
"required": [
"file"
],
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Run a shell command (bash syntax) and return stdout, stderr and exit code: inspect the system, read files and logs, run scripts. To CREATE or REWRITE a file use write instead — never echo/cat/python -c. Avoid destructive commands unless asked.",
"name": "bash",
"parameters": {
"properties": {
"command": {
"description": "The command",
"type": "string"
},
"timeout": {
"description": "Timeout s (default 30, max 300)",
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
}
},
"type": "function"
}
]
},
{
"messages": [
{
"content": "Tu es Loki.",
"role": "system"
},
{
"content": "Lis a.txt",
"role": "user"
},
{
"content": "<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>",
"role": "assistant"
},
{
"content": "Your last answer contained a TOOL CALL WRITTEN AS TEXT — it was never executed:\n<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>\nTool calls must go through the tool-call protocol, never in the answer text. Redo it now: emit the real tool call, or answer directly without pretending to call a tool.",
"role": "user"
},
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"file\":\"a.txt\"}",
"name": "read"
},
"id": "c1",
"type": "function"
}
]
},
{
"content": "ligne 1\nligne 2",
"role": "tool",
"tool_call_id": "c1"
}
],
"model": "loki",
"parallel_tool_calls": false,
"stream": true,
"stream_options": {
"include_usage": true
},
"temperature": 0.7,
"tools": [
{
"function": {
"description": "Read a file with 1-indexed line numbers (offset/limit for long files). ALWAYS use this instead of cat/type: output is bounded and reading a file is REQUIRED before you may edit or overwrite it.",
"name": "read",
"parameters": {
"properties": {
"file": {
"description": "Path (relative to the working folder)",
"type": "string"
},
"limit": {
"description": "Lines (default 400, max 1000)",
"type": "integer"
},
"offset": {
"description": "Start line (default 1)",
"type": "integer"
}
},
"required": [
"file"
],
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Run a shell command (bash syntax) and return stdout, stderr and exit code: inspect the system, read files and logs, run scripts. To CREATE or REWRITE a file use write instead — never echo/cat/python -c. Avoid destructive commands unless asked.",
"name": "bash",
"parameters": {
"properties": {
"command": {
"description": "The command",
"type": "string"
},
"timeout": {
"description": "Timeout s (default 30, max 300)",
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
}
},
"type": "function"
}
]
}
],
"events": [
{
"content": "<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>"
},
{
"tool_used": {
"label": "a.txt",
"name": "read",
"typing": true
}
},
{
"tool_used": {
"label": "a.txt",
"name": "read"
}
},
{
"tool_used": {
"done": true,
"label": "a.txt",
"name": "read",
"result": "ligne 1\nligne 2",
"result_chars": 15
}
},
{
"content": "Deux lignes."
}
],
"extra": [
{
"role": "assistant",
"content": "<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>"
},
{
"role": "user",
"content": "Your last answer contained a TOOL CALL WRITTEN AS TEXT — it was never executed:\n<tool_call>{\"name\":\"read\",\"arguments\":{\"file\":\"a.txt\"}}</tool_call>\nTool calls must go through the tool-call protocol, never in the answer text. Redo it now: emit the real tool call, or answer directly without pretending to call a tool."
},
{
"role": "assistant",
"tool_calls": [
{
"id": "c1",
"type": "function",
"function": {
"name": "read",
"arguments": "{\"file\":\"a.txt\"}"
}
}
]
},
{
"role": "tool",
"content": "ligne 1\nligne 2",
"tool_call_id": "c1"
}
],
"err": ""
}
}