Azure OpenAI endopoint 404 Not Found

悠暉 山本 0 Reputation points
2024-01-23T01:30:30.81+00:00

I have a trouble. I'm using Lang Chain Model for the purpose of ReAct using AzureOpenAI and BingSearchAPI. But, agent couldn't occur due to 404 Error. If anyone has any information, I would appreciate it if you could let me know. #Error

Exception has occurred: NotFoundError
Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
httpx.HTTPStatusError: Client error '404 Resource Not Found' for url 'https://sample-api-for-chatgpt.openai.azure.com/openai/openai/deployments/gpt-35-turbo/chat/completions?api-version=0301'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

During handling of the above exception, another exception occurred:

  File "C:\Users\****\Desktop\locals\202401\20240123\main.py", line 32, in <module>
    agent.run("日本の総理大臣は?")
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}

#Code

OPENAI_API_KEY = "***"
OPENAI_API_BASE ="https://sample-api-for-chatgpt.openai.azure.com/openai"

BING_SUBSCRIPTION_KEY = "***"
BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"

llm = AzureChatOpenAI(
    temperature=0,
    azure_endpoint=OPENAI_API_BASE,
    openai_api_key=OPENAI_API_KEY,
    openai_api_version="0301",
    openai_api_type="azure",
    deployment_name="gpt-35-turbo"
)

tools = load_tools(["bing-search"], llm=llm, bing_subscription_key = BING_SUBSCRIPTION_KEY, bing_search_url = BING_SEARCH_URL)
agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True, agent_kwargs=dict(suffix='Answer should be in Japanese.' + prompt.SUFFIX))

agent.run("What is Tokyo's weather today?")
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
1,814 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sabyasachi Samaddar 160 Reputation points Microsoft Employee
    2024-01-23T01:41:16.1366667+00:00

    Hi @**悠暉 山本,**Thanks for contacting the Microsoft QnA forum. From the description of your problem, it seems you are getting 404, aka resource not found error. I can see your base URL for open ai is OPENAI_API_BASE ="https://sample-api-for-chatgpt.openai.azure.com/openai" Can you please try without giving "/openai", like OPENAI_API_BASE ="https://sample-api-for-chatgpt.openai.azure.com" Please try and let me know if that resolve your issue. If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about the answer, please click "Comment"