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/
相关推荐
黑客思维者4 分钟前
机器学习004:半监督学习-- 给AI一颗“举一反三”的大脑
人工智能·机器学习·半监督学习
黑客思维者5 分钟前
机器学习005:强化学习(概论)--从“训练狗狗”到“打游戏”
人工智能·机器学习·强化学习
__lai12 分钟前
iflow cli一键安装脚本运行了,也正常安装了,但是无法通过iflow命令进入软件。在termux安装iflow-cli AI工具
linux·人工智能·termux
Aspect of twilight14 分钟前
深度学习不同GPU性能比较
人工智能·深度学习
爱笑的眼睛1123 分钟前
超越`cross_val_score`:深入剖析Scikit-learn交叉验证API的设计哲学与高阶实践
java·人工智能·python·ai
火山引擎开发者社区28 分钟前
两大模型发布!豆包大模型日均使用量突破 50 万亿 Tokens
大数据·人工智能
小尘要自信30 分钟前
Bright Data AI Scraper Studio:企业级AI爬虫解决方案,让数据采集更智能
人工智能·爬虫·通过ai自动化爬虫·prompt生产爬虫·云端爬虫平台
丝瓜蛋汤30 分钟前
chunking-free RAG简介
人工智能·深度学习·机器学习
虹科汽车电子37 分钟前
重新定义精密协作:低成本CAN FD如何赋予机器人「指尖智慧」?
人工智能·can总线·机器人灵巧手
王中阳Go1 小时前
09 Go Eino AI应用开发实战 | Hertz Web 框架搭建
人工智能·后端·go