首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在OpenAI的应答api中使用文件

如何在OpenAI的应答api中使用文件
EN

Stack Overflow用户
提问于 2021-11-22 16:19:49
回答 1查看 1K关注 0票数 1

当OpenAI最终公开打开GPT-3相关的API时,我正在利用它来探索和发现他的潜力。

我正在尝试答案API,这是文档中的简单示例:https://beta.openai.com/docs/guides/answers

我按指示上传了.jsonl文件,我可以看到它成功地通过openai.File.list() api上传。

不幸的是,当我尝试使用它时,我总是会遇到相同的错误:

代码语言:javascript
复制
>>> 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.

我已经等了好几个小时了,我不认为这个内容值得等待这么久.你知道这是正常行为还是我错过了什么?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-29 15:55:58

几个小时后(第二天),文件元数据状态从uploaded更改为processed,如文档中所述,该文件可以在应答API中使用。

我认为需要在原始的OpenAI API参考中更好地记录这一点。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70069026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档