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/
相关推荐
时序之心16 分钟前
覆盖Transformer、GAN:掩码重建正在重塑时间序列领域!
人工智能·深度学习·生成对抗网络·transformer·时间序列
机器之心23 分钟前
OpenAI罕见发论文:我们找到了AI幻觉的罪魁祸首
人工智能·openai
aneasystone本尊30 分钟前
学习 GraphRAG 四大搜索策略
人工智能
一乐小哥31 分钟前
一口气同步10年豆瓣记录———豆瓣书影音同步 Notion分享 🚀
后端·python
华研前沿标杆游学41 分钟前
华为在国内搞的研发基地有多野?标杆游学带你解锁“研发界顶流”
python
小胖墩有点瘦1 小时前
【基于深度学习的中草药识别系统】
人工智能·python·深度学习·课程设计·计算机毕业设计·中草药识别
六月的可乐1 小时前
AI助理前端UI组件-悬浮球组件
前端·人工智能
R-G-B1 小时前
OpenCV 实战篇——如何测算出任一副图片中的物体的实际尺寸?传感器尺寸与像元尺寸的关系?
人工智能·opencv·工业相机·传感器尺寸·像元·测算图片中的物体尺寸·像元与物体尺寸
正在走向自律1 小时前
Ubuntu系统下Python连接国产KingbaseES数据库实现增删改查
开发语言·数据库·python·ubuntu·kingbasees·ksycopg2
Hello123网站1 小时前
Ferret:苹果发布的多模态大语言模型
人工智能·语言模型·自然语言处理·ai工具