We(my company) have Azure OpenAI API for all our LLM projects. We are working on getting to know how to use this Azure OpenAI API using LangChain as we have been suggested this is the best framework for LLM projects.
I'm just trying to work with the connect using langchain in Azure OpenAI for a question and response. However its is failing with the connection as below:
BadRequestError: Error code: 400 - {'error': {'code': 'OperationNotSupported', 'message': 'The completion operation does not work with the specified model, gpt-35-turbo-16k. 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.'}}
This is the code:
import os
import openai
os.environ["AZURE_OPENAI_API_KEY"] = "62*****************************"
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://sample.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = "2023-07-01-preview"
os.environ["DEPLOYMENT_NAME"] = "sampleDeployment"
os.environ["LLM_MODEL"] = "gpt-35-turbo-16k"
openai.api_key = os.getenv("AZURE_OPENAI_API_KEY")
openai.api_version = os.getenv("OPENAI_API_VERSION")
# Import Azure OpenAI
from langchain_openai import AzureOpenAI
# Create an instance of Azure OpenAI
# Replace the deployment name with your own
llm = AzureOpenAI(
deployment_name="sampleDeployment",
)
# Run the LLM
print(llm.invoke("Tell me a joke"))
Not sure what i'm missing.