fix: correct YAML formatting in response text processing in utils.py

This commit is contained in:
mrT23
2024-08-25 11:26:48 +03:00
parent b9d096187a
commit 441e098e2a

View File

@ -585,9 +585,9 @@ def try_fix_yaml(response_text: str,
response_text_lines_copy = response_text_lines.copy()
for i in range(0, len(response_text_lines_copy)):
for key in keys_yaml:
if key in response_text_lines_copy[i] and not '|-' in response_text_lines_copy[i]:
if key in response_text_lines_copy[i] and not '|' in response_text_lines_copy[i]:
response_text_lines_copy[i] = response_text_lines_copy[i].replace(f'{key}',
f'{key} |-\n ')
f'{key} |\n ')
try:
data = yaml.safe_load('\n'.join(response_text_lines_copy))
get_logger().info(f"Successfully parsed AI prediction after adding |-\n")