Can you fix your program so that it preserves new line breaks? The output I'm seeing throws away GPT output formatting and puts all of the response text on one line. Paragraph breaks are lost, list item breaks are lost, etc...
Perhaps make this one of your config options,
new_lines: preserve | discard
Response formatting could definitely be better, and the best solution would be to give users the ability to select the formatting options.
What I've struggled to do is find the hook to accomplish this within the openai python API. We are using the Completion class of the openai python API. [1] Specifically, we are using the acreate method, which is an async wrapper for the create method. [2] This does not seem to retain the formatting when it provides a response. That said, I'm still delving into the API and might still find something in there that would make this easier. At the end of the day, nothing is stopping us from writing our own application logic to apply formatting onto a plaintext response, but that seems ... especially inelegant if the openai API provides that functionality.
Suggestion via github:
Response formatting could definitely be better, and the best solution would be to give users the ability to select the formatting options.
What I've struggled to do is find the hook to accomplish this within the openai python API. We are using the Completion class of the openai python API. [1] Specifically, we are using the acreate method, which is an async wrapper for the create method. [2] This does not seem to retain the formatting when it provides a response. That said, I'm still delving into the API and might still find something in there that would make this easier. At the end of the day, nothing is stopping us from writing our own application logic to apply formatting onto a plaintext response, but that seems ... especially inelegant if the openai API provides that functionality.
Reference [1] https://github.com/openai/openai-python/blob/main/openai/api_resources/completion.py#L9 [2] https://platform.openai.com/docs/api-reference/completions/create