当我使用GPT3的playground时,我经常得到一些带有编号列表和段落的结果,如下所示:
Here's what the above class is doing:
1. It creates a directory for the log file if it doesn't exist.
2. It checks that the log file is newline-terminated.
3. It writes a newline-terminated JSON object to the log file.
4. It reads the log file and returns a dictionary with the following
- list 1
- list 2
- list 3
- list 4
但是,当我直接使用他们的API并从json result中提取响应时,我得到的是非常难以阅读的塞得满满的文本版本,大致如下:
Here's what the above class is doing:1. It creates a directory for the log file if it doesn't exist.2. It checks that the log file is newline-terminated.3. It writes a newline-terminated JSON object to the log file.4. It reads the log file and returns a dictionary with the following-list 1-list 2-list 3- list4
我的问题是,人们如何保持GPT结果的格式,以便以更整洁、更可读的方式显示它们?
1条答案
按热度按时间laawzig21#
选项1:Edits endpoint
如果您运行
test.py
,OpenAI API将返回以下完成:测试.py
选项2:加工
自己处理从Completions endpoint获得的完成(例如,编写Python代码)。