Dec-15-2023, 09:13 AM
How about some added newlines?
mystring = """[Choice(finish_reason='length', index=0, message=ChatCompletionMessage(content='The time complexity of the code is O(n * k), where n is the value of parameter `n` and k is the value of parameter `k`. This is because there are two nested loops, one iterating `n` times and the other iterating `k` times. The accum variable is incremented `n *', role='assistant', function_call=None, tool_calls=None))]"""Then pprint (sounds like a stutter!)
pprint(mystring) ("[Choice(finish_reason='length', index=0, " "message=ChatCompletionMessage(content='The time complexity of the code is " 'O(n * k), where n is the value of parameter `n` and k is the value of ' 'parameter `k`. This is because there are two nested loops, one iterating `n` ' 'times and the other iterating `k` times. The accum variable is incremented ' "`n *', role='assistant', function_call=None, tool_calls=None))]")Add some newlines:
newstring = mystring.replace(', ', ',\n').replace('. ', '.\n') pprint(newstring) ("[Choice(finish_reason='length',\n" 'index=0,\n' "message=ChatCompletionMessage(content='The time complexity of the code is " 'O(n * k),\n' 'where n is the value of parameter `n` and k is the value of parameter `k`.\n' 'This is because there are two nested loops,\n' 'one iterating `n` times and the other iterating `k` times.\n' "The accum variable is incremented `n *',\n" "role='assistant',\n" 'function_call=None,\n' 'tool_calls=None))]')Readable??