转载

ChatGPT插件例子 提取联系信息

从文本块中提取联系信息。
提问

从这封电子邮件中提取姓名和邮寄地址:

亲爱的凯利,

很高兴在研讨会上与您交谈。我觉得简的演讲很好。谢谢你的书。

这是我的地址 2111 Ash Lane, Crestview CA 92002 

Best, 

Maya 

姓名:

回答

Maya 邮寄地址:2111 Ash Lane, Crestview CA 92002

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="Extract the name and mailing address from this email:\n\nDear Kelly,\n\nIt was great to talk to you at the seminar. I thought Jane's talk was quite good.\n\nThank you for the book. Here's my address 2111 Ash Lane, Crestview CA 92002\n\nBest,\n\nMaya\n\nName:",
  temperature=0,
  max_tokens=64,
  top_p=1.0,
  frequency_penalty=0.0,
  presence_penalty=0.0
)</font>