OpenAI的Answerapi中文件的使用方法
How to use files in the Answer api of OpenAI
随着 OpenAI 终于公开了 GPT-3 相关 API,
我正在玩它来探索和发现他的潜力。
我正在尝试答案 API,文档中的简单示例:
https://beta.openai.com/docs/guides/answers
我按照指示上传 .jsonl
文件,我可以看到它已成功上传 openai.File.list()
api.
当我尝试使用它时,不幸的是,我总是得到同样的错误:
>>> openai.File.create(purpose='answers', file=open('example.jsonl') )
<File file id=file-xxx at 0x7fbc9eca5e00> JSON: {
"bytes": 140,
"created_at": 1637597242,
"filename": "example.jsonl",
"id": "file-xxx",
"object": "file",
"purpose": "answers",
"status": "uploaded",
"status_details": null
}
#Use the file in the API:
openai.Answer.create(
search_model="ada",
model="curie",
question="which puppy is happy?",
file="file-xxx",
examples_context="In 2017, U.S. life expectancy was 78.6 years.",
examples=[["What is human life expectancy in the United States?", "78 years."]],
max_rerank=10,
max_tokens=5,
stop=["\n", "<|endoftext|>"]
)
<some exception, then>
openai.error.InvalidRequestError: File is still processing. Check back later.
我已经等了几个小时了,我觉得这个内容不值得等这么久...
您知道这是正常行为吗,还是我漏掉了什么?
谢谢
几个小时后(第二天),文件元数据状态从 uploaded
更改为 processed
,文件可用于答案 API,如文档中所述.
我认为这需要在原始 OpenAI API 参考中得到更好的记录。
随着 OpenAI 终于公开了 GPT-3 相关 API, 我正在玩它来探索和发现他的潜力。
我正在尝试答案 API,文档中的简单示例: https://beta.openai.com/docs/guides/answers
我按照指示上传 .jsonl
文件,我可以看到它已成功上传 openai.File.list()
api.
当我尝试使用它时,不幸的是,我总是得到同样的错误:
>>> openai.File.create(purpose='answers', file=open('example.jsonl') )
<File file id=file-xxx at 0x7fbc9eca5e00> JSON: {
"bytes": 140,
"created_at": 1637597242,
"filename": "example.jsonl",
"id": "file-xxx",
"object": "file",
"purpose": "answers",
"status": "uploaded",
"status_details": null
}
#Use the file in the API:
openai.Answer.create(
search_model="ada",
model="curie",
question="which puppy is happy?",
file="file-xxx",
examples_context="In 2017, U.S. life expectancy was 78.6 years.",
examples=[["What is human life expectancy in the United States?", "78 years."]],
max_rerank=10,
max_tokens=5,
stop=["\n", "<|endoftext|>"]
)
<some exception, then>
openai.error.InvalidRequestError: File is still processing. Check back later.
我已经等了几个小时了,我觉得这个内容不值得等这么久... 您知道这是正常行为吗,还是我漏掉了什么?
谢谢
几个小时后(第二天),文件元数据状态从 uploaded
更改为 processed
,文件可用于答案 API,如文档中所述.
我认为这需要在原始 OpenAI API 参考中得到更好的记录。