404 error when doing workload anlysis using locust on OpenAI API (GPT.35)

题意:"使用 Locust 对 OpenAI API (GPT-3.5) 进行工作负载分析时出现 404 错误。"

问题背景:

I am trying to do some workload analysis on OpenAI GPT-3.5-TURBO using locust.

"我正在使用 Locust 对 OpenAI GPT-3.5-TURBO 进行一些工作负载分析。"

python 复制代码
from locust import HttpUser, between, task


class 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
        )

I get this error:

得到如下错误信息:

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

My script for Azure OpenAI workload analysis works fine with this exact same structure. What am I missing?

"我用于 Azure OpenAI 工作负载分析的脚本在相同的结构下运行正常。我漏掉了什么?"

问题解决:

Typo error. Should be:

"拼写错误。应该是:"

复制代码
https://api.openai.com/v1/chat/completions

and not: 而不是:

复制代码
https://api.openai.com/v1/chat/completion/
相关推荐
Mr数据杨6 分钟前
企业年报文本变化预测实战 从文本回归到信息披露分析
人工智能·数据分析·kaggle竞赛
微软技术分享8 分钟前
Apache 2.4.68 编译安装与配置
人工智能·apache·知识图谱
小道士写程序27 分钟前
自然语言处理NLP - 第3章 从字符到Token:机器的输入长什么样
人工智能·机器学习
Mr数据杨27 分钟前
钻石价格预测实战 从 Kaggle 回归赛题看结构化数据建模落地
人工智能·数据分析·kaggle竞赛
方知我30 分钟前
NumPy一小时速成
开发语言·python·numpy
Mr数据杨30 分钟前
从 Kaggle 到实战的多标签文本分类案例拆解
人工智能·数据分析·kaggle竞赛
福昕办公33 分钟前
智能体手机落地,Agent 正在从“云端调用“走向“长进软件本体“
人工智能·智能手机
IPdodo_33 分钟前
静态 IP 访问异常排查:403/429 归因与迁移验收
服务器·网络·数据库·python·网络协议·php·性能测试
DolphinScheduler社区38 分钟前
把 Apache DolphinScheduler 变成 Agent 的“手和脚”:从调度平台到自然语言数据入口
人工智能·开源·apache·agent·技术分享·海豚调度·大数据工作流调度