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/
相关推荐
惜鸟11 分钟前
# LLM统一网关:LiteLLM 详细介绍(实践篇)
后端·openai
三花AI11 分钟前
ComfyUI 子工作流功能:一次编辑全局更新
人工智能
大模型铲屎官13 分钟前
【深度学习-Day 23】框架实战:模型训练与评估核心环节详解 (MNIST实战)
人工智能·pytorch·python·深度学习·大模型·llm·mnist
Elastic 中国社区官方博客15 分钟前
Elastic 获得 AWS 教育 ISV 合作伙伴资质,进一步增强教育解决方案产品组合
大数据·人工智能·elasticsearch·搜索引擎·云计算·全文检索·aws
Jamence22 分钟前
多模态大语言模型arxiv论文略读(106)
论文阅读·人工智能·语言模型·自然语言处理·论文笔记
caig00031 分钟前
稳定币的深度剖析与展望
人工智能·区块链
反向跟单策略33 分钟前
期货反向跟单运营逻辑推导思路
大数据·人工智能·数据分析·区块链
阿幸软件杂货间37 分钟前
PPT转图片拼贴工具 v1.0
python·powerpoint
AIGC_北苏1 小时前
DrissionPage爬虫包实战分享
爬虫·python·drissionpage
机器之心1 小时前
MoE推理「王炸」组合:昇腾×盘古让推理性能狂飙6-8倍
人工智能