feat: Add code-in-json-benchmark.js file and update code-in-json.md post

This commit is contained in:
Paul Gauthier 2024-08-15 10:50:51 -07:00 committed by Paul Gauthier (aider)
parent 8d4d549a98
commit e90642295d
2 changed files with 7 additions and 9 deletions

View file

@ -157,21 +157,19 @@ function createStripedCanvas(isStrict) {
## Abstract ## Abstract
The newest LLMs have support for returning properly formatted JSON responses, Current LLMs have support for returning properly formatted JSON,
making it easier for clients to parse complex responses. making it easier for clients to reliably parse complex responses.
This makes it tempting for AI coding applications to It therefore seems attractive for
use JSON replies to AI coding applications ask LLMs to return code in structure JSON replies.
receive code from LLMs.
Unfortunately, Unfortunately,
LLMs write worse code when asked to wrap it in JSON, harming their ability LLMs write worse code when asked to wrap it in JSON, harming their ability
to correctly solve coding tasks. to correctly solve coding tasks.
On a variant of the aider code editing benchmark, On a variant of the aider code editing benchmark,
JSON-wrapping code asking for JSON-wrapped code
often significantly harms coding often significantly harms coding
performance performance.
compared to returning code as plain text.
This holds true across many top coding LLMs, This holds true across many top coding LLMs,
including OpenAI's new gpt-4o-2024-08-06 including OpenAI's latest model gpt-4o-2024-08-06
which has strong JSON support. which has strong JSON support.
## Introduction ## Introduction