A couple of fixes

This commit is contained in:
Zvonimir Sabljic
2023-08-10 08:44:02 +02:00
parent 265b2143a9
commit 795ebfd97e
3 changed files with 8 additions and 5 deletions

View File

@@ -33,8 +33,8 @@ class Developer(Agent):
def implement_task(self, sibling_tasks, current_task_index, parent_task=None):
print(colored('-------------------------', 'green', attrs=['bold']))
print(colored(f"Implementing task {current_task_index + 1}...\n", "green"))
print(colored(sibling_tasks[current_task_index]['description'], 'green'))
print(colored(f"Implementing task {current_task_index + 1}...\n", "green", attrs=['bold']))
print(colored(sibling_tasks[current_task_index]['description'], 'green', attrs=['bold']))
print(colored('-------------------------', 'green', attrs=['bold']))
convo_dev_task = AgentConvo(self)
@@ -133,8 +133,8 @@ class Developer(Agent):
},
'send_convo': True
})
if not llm_response == 'DONE':
if llm_response != 'DONE':
installation_commands = self.convo_os_specific_tech.send_message('development/env_setup/unsuccessful_installation.prompt',
{ 'technology': technology }, EXECUTE_COMMANDS)
if installation_commands is not None:

View File

@@ -153,6 +153,9 @@ def stream_gpt_completion(data, req_type):
try:
json_line = load_data_to_json(line)
if 'error' in json_line:
logger.error(f'Error in LLM response: {json_line}')
raise ValueError(f'Error in LLM response: {json_line["error"]["message"]}')
if json_line['choices'][0]['finish_reason'] == 'function_call':
function_calls['arguments'] = load_data_to_json(function_calls['arguments'])
return return_result({'function_calls': function_calls});

View File

@@ -146,7 +146,7 @@ def replace_functions(obj):
return obj
def fix_json_newlines(s):
pattern = r'("(?:\\.|[^"\\])*")'
pattern = r'("(?:\\\\n|\\.|[^"\\])*")'
def replace_newlines(match):
return match.group(1).replace('\n', '\\n')