OpenAi API invalid_request_error:您必须提供模型参数

问题描述 投票:0回答:1

也许有人可以帮助我,我收到了这个 Api 请求,并且它与 “gpt-3.5-turbo”为 “model”与此 API 端点“https://api.openai.com/v1/chat/completions”,但一旦我将其更改为“gpt-4 Turbo”,我收到此错误消息,(往下看)我不明白为什么,因为它应该适合相同的 API 端点(https://platform.openai.com/docs/guides/text- Generation):

"{ "error": { "message": "invalid model ID", "type": "invalid_request_error", "param": null, "code": null } } "

            try {
                using (var httpClient = new HttpClient()) {
                    vorlagenText = vorlagenText + selektierterText;
                    var settings = chatGptSettings;
                    ValidateParameter((ChatGptSettings)settings);
                    httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {chatGPT_ApiKey}");
                    var requestData = new {
                        max_tokens = chatGptSettings.MaxTokens,
                        temperature = chatGptSettings.Temperatur,
                        model = "gpt-4 turbo",
                        messages = new[] {
                                new { role = "user", content = vorlagenText }
                        }
                    };
                    var requestContent = new StringContent(JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json");
                    var response = await httpClient.PostAsync(chatGptSettings.ChatGptUrl, requestContent);
                    var responseBody = await response.Content.ReadAsStringAsync();

也许有人可以帮助我,即使只是尝试也谢谢你:D

我期待 ChatGPT 的答复,因为我使用模型“gpt-3.5-turbo”得到它,因为它具有相同的 Api 端点,我尝试将 URL、API 端点更改为旧的,但这不起作用,这是我能找到的唯一一个新的。

c# visual-studio-2019 openai-api chatgpt-api
1个回答
0
投票

您现在要用于获取 GPT4 Turbo 模型的模型名称是

gpt-4-1106-preview
。一旦该模型从预览版升级到生产版,它将被称为不同的名称,但请查看此链接以获取您可能选择的其他模型名称的列表。

https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo

© www.soinside.com 2019 - 2024. All rights reserved.