langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
94.12k stars 15.21k forks source link

The chatCompletion operation does not work with the specified model appears when I use AzureChatOpenAI, but it does exist #6363

Closed biao-lvwan closed 1 year ago

biao-lvwan commented 1 year ago

Issue you'd like to raise.

openai.error.InvalidRequestError: The chatCompletion operation does not work with the specified model, text-embedding-ada-002. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.

Suggestion:

No response

devstein commented 1 year ago

Answer generated by a 🤖

Answer

The error message you received indicates that you are trying to use the text-embedding-ada-002 model with the chatCompletion operation, which is not supported. The chatCompletion operation currently supports only gpt-3.5-turbo and gpt-3.5-turbo-0301 models. To fix the issue, you should change the model in your code to one of the supported models. For example, you can replace "model": "text-embedding-ada-002" with "model": "gpt-3.5-turbo" in your code.

Here's the corrected code snippet:

const completion = await openai.createChatCompletion({
  model: "gpt-3.5-turbo",
  messages: [{role: "user", content: "Hello world"}],
});
console.log(completion.data.choices[0].message);

Sources


This response is meant to be helpful and save users time. It is not meant to be a precise solution.

Please leave a 👍 if this is helpful and 👎 if it is irrelevant

biao-lvwan commented 1 year ago

My model is usable in completion, but it is no longer usable when integrating with Langchain. I am not sure if Azure cannot use text embedding ada-002, as I have read the official statement

image

dosubot[bot] commented 1 year ago

Hi, @biao-lvwan! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, the issue you raised is regarding the chatCompletion operation not working with the specified model, text-embedding-ada-002, when using AzureChatOpenAI. Devstein provided a helpful response explaining that the chatCompletion operation only supports gpt-3.5-turbo and gpt-3.5-turbo-0301 models. You mentioned that your model is usable in completion but not when integrating with Langchain, and you are unsure if Azure supports text embedding ada-002.

If this issue is still relevant to the latest version of the LangChain repository, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your understanding and contribution to the LangChain project! Let us know if you have any further questions or concerns.

bpkapkar commented 1 year ago

Even we are getting the error with gpt35 InvalidRequestError: The completion operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.

Running below code: from langchain.agents import create_csv_agent, create_pandas_dataframe_agent llm=AzureOpenAI(deployment_name="XXX",model_name="gpt-35-turbo",openai_api_version="2023-05-15",openai_api_base="https://{name}.openai.azure.com/", openai_api_key=token.token,openai_api_type = "azure_ad") agent = create_pandas_dataframe_agent(llm, df, verbose=False) agent.run("Question")