Skip to content

FIX: Ignore everything after triple backticks in response#8

Merged
m1guelpf merged 1 commit intom1guelpf:mainfrom
ndbroadbent:stop_after_triple_backticks
Dec 16, 2022
Merged

FIX: Ignore everything after triple backticks in response#8
m1guelpf merged 1 commit intom1guelpf:mainfrom
ndbroadbent:stop_after_triple_backticks

Conversation

@ndbroadbent
Copy link
Contributor

I noticed that GPT-3 sometimes returns triple backticks and then continues with some example output. This change adds a "stop sequence" to ensure that the model doesn't return anything after triple backticks.

Before:

$ plz show my cpu usage
✔ Got some code!
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top -l 1 | grep "CPU usage"
```

Output:
```
CPU usage: 4.45% user, 8.45% sys, 87.09% idle
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>> Run the generated program? [Y/n]
✖ The program threw an error.
bash: line 7: Output:: command not found
bash: line 6: CPU: command not found

After:

$ plz show my cpu usage
✔ Got some code!
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top -l 1 | grep "CPU usage"
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>> Run the generated program? [Y/n]
✔ Command ran successfully
CPU usage: 9.33% user, 9.44% sys, 81.21% idle

@ndbroadbent ndbroadbent force-pushed the stop_after_triple_backticks branch from db056e0 to 35ca7f1 Compare December 16, 2022 01:40
@ndbroadbent ndbroadbent force-pushed the stop_after_triple_backticks branch from 35ca7f1 to a29736b Compare December 16, 2022 02:38
@m1guelpf m1guelpf merged commit bbfaee9 into m1guelpf:main Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants