使用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

Keras Dense层输入未被展平

这是我的测试代码: from keras import…

无法将分类变量输入随机森林

我有10个分类变量和3个数值变量。我在分割后直接将它们…

如何在Keras中对每个输出应用Sigmoid函数?

这是我代码的一部分。 model = Sequenti…

如何选择类概率的最佳阈值?

我的神经网络输出是一个用于多标签分类的预测类概率表: …

在Keras中使用深度学习得到不同的结果

我按照一个教程使用Keras中的深度神经网络进行文本分…

‘MatMul’操作的输入’b’类型为float32,与参数’a’的类型float64不匹配

我写了一个简单的TensorFlow代码,但不断遇到T…

发表回复

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