使用Locust进行OpenAI API(GPT-3.5)工作负载分析时遇到404错误

我试图使用Locust对OpenAI的GPT-3.5-TURBO进行工作负载分析。

from locust import HttpUser, between, taskclass OpenAIUser(HttpUser):    wait_time = between(1, 2)  # wait between 1 and 2 seconds    host = "https://api.openai.com/"    def on_start(self):        self.headers = {            "Content-Type": "application/json",            "Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"        }        self.data = {            "model": "gpt-3.5-turbo",            "messages": [                {                    "role": "system",                    "content": "You are a helpful story teller."                },                {                    "role": "user",                    "content": "Tell me a 100 word story"                }            ]        }    @task    def test_chat_completion(self):        self.client.post(            "https://api.openai.com/v1/chat/completion/",            json=self.data,            headers=self.headers        )

我遇到了这个错误:

POST /v1/chat/completion/: HTTPError('404 Client Error: Not Found for url: /v1/chat/completion/')

我的Azure OpenAI工作负载分析脚本使用完全相同的结构运行正常。我遗漏了什么?


回答:

这是拼写错误。应该是:

https://api.openai.com/v1/chat/completions

而不是:

https://api.openai.com/v1/chat/completion/

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注