mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-02-23 15:49:50 +01:00
send exit code to LLM
This commit is contained in:
0
pilot/prompts/__init__.py
Normal file
0
pilot/prompts/__init__.py
Normal file
@@ -1,8 +1,6 @@
|
||||
{{ additional_info }}I ran the command `{{ command }}`
|
||||
{%- if exit_code %}, the exit code was {{ exit_code }} {% endif -%}
|
||||
and the output was:
|
||||
```
|
||||
{{ cli_response }}
|
||||
```
|
||||
{%- if exit_code is number %}, the exit code was {{ exit_code }}{% endif %} and the output was:
|
||||
|
||||
If the command was successfully executed, respond with `DONE` and if it wasn't, respond with `NEEDS_DEBUGGING`.
|
||||
{{ cli_response }}
|
||||
|
||||
If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation.
|
||||
|
||||
45
pilot/prompts/test_prompts.py
Normal file
45
pilot/prompts/test_prompts.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from .prompts import get_prompt
|
||||
|
||||
|
||||
def test_prompt_ran_command_None_exit():
|
||||
# When
|
||||
prompt = get_prompt('dev_ops/ran_command.prompt', {
|
||||
'cli_response': 'stdout:\n```\nsuccess\n```',
|
||||
'command': './scripts/run_tests',
|
||||
'additional_message': 'Some additional message\n',
|
||||
'exit_code': None
|
||||
})
|
||||
|
||||
# Then
|
||||
assert prompt == '''
|
||||
I ran the command `./scripts/run_tests` and the output was:
|
||||
|
||||
stdout:
|
||||
```
|
||||
success
|
||||
```
|
||||
|
||||
If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation.
|
||||
'''.strip()
|
||||
|
||||
|
||||
def test_prompt_ran_command_0_exit():
|
||||
# When
|
||||
prompt = get_prompt('dev_ops/ran_command.prompt', {
|
||||
'cli_response': 'stdout:\n```\nsuccess\n```',
|
||||
'command': './scripts/run_tests',
|
||||
'additional_message': 'Some additional message\n',
|
||||
'exit_code': 0
|
||||
})
|
||||
|
||||
# Then
|
||||
assert prompt == '''
|
||||
I ran the command `./scripts/run_tests`, the exit code was 0 and the output was:
|
||||
|
||||
stdout:
|
||||
```
|
||||
success
|
||||
```
|
||||
|
||||
If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation.
|
||||
'''.strip()
|
||||
Reference in New Issue
Block a user