Getting RateLimitError while implementing openai GPT with Python

题意:"在使用 Python 实现 OpenAI GPT 时遇到 RateLimitError 错误。"

问题背景:

I have started to implement openai gpt model in python. I have to send a single request in which I am getting RateLimitError.

"我开始在 Python 中实现 OpenAI GPT 模型。发送单个请求时遇到了 RateLimitError 错误。"

My code looks like this 我的代码类似如下

python 复制代码
import openai

key = '<SECRET-KEY>'
openai.api_key = key
model_engine = 'text-ada-001'
prompt = 'Hi, How are you today?'
completion = openai.Completion.create(engine=model_engine, prompt=prompt, max_token=2048, n=1, stop=None, temprature=0.5)
print(completion.choices)

This is what error I am getting 我得到的错误信息如下

复制代码
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.

So, How do I do development without getting this error? I have checked the doc they provide a free version with limitations but this is the initial stage I have sent only 5-6 requests in an hour.

"那么,我该如何在不出现此错误的情况下进行开发?我查看了文档,他们提供了一个有限制的免费版本,但这是初始阶段,我每小时只发送了 5-6 个请求。"

Thanks advance for your help. "提前感谢您的帮助。"

问题解决:

Later versions (>= 1.0.0) of the openai Python API include functionality to automatically retry requests. See GitHub discussion.

"较新版本(>= 1.0.0)的 OpenAI Python API 包含自动重试请求的功能。请参见 GitHub 讨论。"

相关推荐
一晌小贪欢3 小时前
【Python数据分析】数据分析与可视化
开发语言·python·数据分析·数据可视化·数据清洗
dreams_dream5 小时前
Flask
后端·python·flask
mywpython6 小时前
用Python和Websockets库构建一个高性能、低延迟的实时消息推送服务
python·websocket
ZPC82106 小时前
FPGA 部署ONNX
人工智能·python·算法·机器人
一晌小贪欢6 小时前
Python键盘鼠标自动化库详解:从入门到精通
python·自动化·计算机外设·python鼠标·python键盘·python操控鼠标·python操控键盘
穿西装的水獭7 小时前
python将Excel数据写进图片中
开发语言·python·excel
xiaoxiongip6667 小时前
假设两个设备在不同网段,网关怎么设置才能通呢
网络·爬虫·python·https·智能路由器
逻极7 小时前
Scikit-learn 实战:15 分钟构建生产级中国房价预测模型
python·机器学习·scikit-learn
行板Andante7 小时前
AttributeError: ‘super‘ object has no attribute ‘sklearn_tags‘解决
人工智能·python·sklearn
tryCbest7 小时前
Python基础之爬虫技术(一)
开发语言·爬虫·python