转载

ChatGPT插件例子 解析非结构化数据

通过指定结构并提供一些示例,从长格式文本创建表格。

提问

一张总结 Goocrux 水果的表格: 

在最近发现的 Goocrux 星球上发现了许多水果。那里生长着新斯基兹,它们是紫色的,尝起来像糖果。还有 loheckles,它是一种灰蓝色的水果,非常酸,有点像柠檬。Pounits 呈亮绿色,咸味多于甜味。还有很多 loopnovas,它们是霓虹粉的味道,尝起来像棉花糖。最后,还有一种叫做 glowls 的水果,它有一种非常酸和苦的味道,具有酸性和腐蚀性,并带有淡橙色调。

| 水果 | 颜色 | 风味 |

回答


| 新技能 | 紫色 | 糖果 | 
| 洛赫克斯 | 灰蓝色 | 酸,像柠檬 | 
| 磅 | 亮绿色 | 咸味 | 
| 循环新星 | 霓虹粉 | 棉花糖 | 
| 发光 | 淡橙色 | 酸和苦,酸性和腐蚀性 |

API请求

<font size="3">import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

response = openai.Completion.create(
  model="text-davinci-003",
  prompt="A table summarizing the fruits from Goocrux:\n\nThere are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.\n\n| Fruit | Color | Flavor |",
  temperature=0,
  max_tokens=100,
  top_p=1.0,
  frequency_penalty=0.0,
  presence_penalty=0.0
)</font>