mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
copy
This commit is contained in:
parent
ae9ad0989e
commit
dde7470f4d
1 changed files with 15 additions and 3 deletions
|
@ -182,9 +182,6 @@ Below is an example of a `SyntaxError` created by gpt-4o-2024-05-13 using the
|
|||
JSON code wrapping strategy.
|
||||
It appears that the model got confused about escaping and quoting while trying
|
||||
to format the JSON response.
|
||||
The source code contains a single-quoted string which also
|
||||
contains a single-quote character.
|
||||
The word `There'll` should have been escaped as `There\'ll`.
|
||||
|
||||
```python
|
||||
Traceback (most recent call last):
|
||||
|
@ -195,6 +192,21 @@ Traceback (most recent call last):
|
|||
SyntaxError: unterminated string literal (detected at line 9)
|
||||
```
|
||||
|
||||
The problematic line of code contains a single-quoted string which also
|
||||
contains a single-quote character.
|
||||
It should have been output as the following chunk of JSON, with
|
||||
a double slash in `There\\'ll`.
|
||||
That is needed to JSON-escape the `\` so that it survives
|
||||
JSON-decoding to
|
||||
produce `There\'ll` in the resulting code.
|
||||
That would correctly escape the single-quote inside the single-quoted string.
|
||||
|
||||
```
|
||||
...lyrics.append(f'There\\'ll be {i - 1} green bottles hanging on the wall.')\n...
|
||||
```
|
||||
|
||||
|
||||
|
||||
{% include code-in-json-syntax.js %}
|
||||
|
||||
> Figure 2: Number of `SyntaxError` and `IndentationError` errors found in model generated code,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue