0

The code I was copy from other people, the purpose of code is testing AzureOpenai API.However I am facing some error.

`from langchain.llms import AzureOpenAI
import os
import openai

openai.api_key = os.getenv("<API_KEY>")
openai.api_base = os.getenv("https://.   .openai.azure.com/") # your endpoint should look like the following https://YOUR_RESOURCE_NAME.openai.azure.com/
openai.api_type = 'azure'
openai.api_version = '2023-03-15-preview' 


os.environ["OPENAI_API_TYPE"] = OPENAI_API_TYPE
os.environ["OPENAI_API_VERSION"] = OPENAI_API_VERSION
os.environ["OPENAI_API_BASE"] = OPENAI_API_BASE
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY

llm = AzureOpenAI(
    # openai_api_type="azure",
    deployment_name="text-davinci-003",
    model_name="text-davinci-003")

print(llm("hi"))`

The output is this one

InvalidRequestError: Resource not found

I have checked my endpoint website, but the outcome is {"error":{"code":"404","message": "Resource not found"}} in website

Hopefully can get debug

Aswin
  • 4,090
  • 2
  • 4
  • 16

0 Answers0