send exit code to LLM

This commit is contained in:
Nicholas Albion
2023-10-06 18:24:25 +11:00
parent 44cdea0381
commit fd6254d1fd
3 changed files with 49 additions and 6 deletions

View File

View 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.

View 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()