gpt4 book ai didi

python - 为什么我在 Azure Open AI 中遇到 "gpt-35-turbo-16k"模型无效模型错误,但在 "gpt-35-turbo"中却没有?

转载 作者:行者123 更新时间:2023-12-02 07:51:23 25 4
gpt4 key购买 nike

我使用 Azure Open AI、Langchain 和 Streamlit 构建了一个非常简单的应用程序。以下是我的代码:

from dotenv import load_dotenv,find_dotenv
load_dotenv(find_dotenv())

import streamlit as st
from langchain.llms import AzureOpenAI

from langchain.prompts import PromptTemplate


LLM = AzureOpenAI(max_tokens=1500, deployment_name="gpt-35-turbo-16k", model="gpt-35-turbo-16k")


prompt_template = """
If you don't know the answer, just say that you don't know, don't try to make up an answer.

Question: {question}
"""
PROMPT = PromptTemplate(template=prompt_template, input_variables=["question"])
st.title('Experiment AzureOpenAI :)')
user_question = st.text_input('Your query here please')

if user_question:
prompt = prompt_template.format(question = user_question)
response = LLM(prompt)
st.write(response)
st.write('done')

当我运行上面的代码时,我收到以下错误:

InvalidRequestError: The completion operation does not work with thespecified model, gpt-35-turbo-16k. Please choose different model andtry again. You can learn more about which models can be used with eachoperation here: https://go.microsoft.com/fwlink/?linkid=2197993.

但是,如果我将模型从 gpt-35-turbo-16k 更改为 gpt-35-turbo,我的代码运行得非常好。所以下面的代码可以工作:

LLM = AzureOpenAI(max_tokens=1500, deployment_name="gpt-35-turbo", model="gpt-35-turbo")

我想知道为什么会发生这个错误?

从此link ,我看到的唯一区别是 gpt-35-turbo-16k 支持最多 16k 输入 token ,而 gpt-35-turbo 支持最多 4k 输入 token 。

最佳答案

根据文档,合理的原因是:版本 (0613) 仅支持 Chat Completions API。

https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-35-models

GPT-3.5 Turbo is used with the Chat Completion API. GPT-3.5 Turbo (0301) can also be used with the Completions API. GPT3.5 Turbo (0613) only supports the Chat Completions API.

关于python - 为什么我在 Azure Open AI 中遇到 "gpt-35-turbo-16k"模型无效模型错误,但在 "gpt-35-turbo"中却没有?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77208623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com