OpenAI GPT-3 API: 如何保持响应的格式?

当我使用GPT3的游乐场时,经常会得到带有编号列表和段落格式的结果,如下所示:

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结果中提取响应时,我得到的是压缩的文本版本,非常难读,类似这样:

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结果的格式,以便它们以更整洁、更易读的方式显示?


回答:

问题出在我这边的前端。OpenAI API返回了正确的响应,而我使用了错误的空白CSS设置来渲染结果

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注