Share via

OpenAI 调用错误

Guan007 0 Reputation points
2023-09-16T07:52:38.51+00:00
Exception in thread "main" com.azure.core.exception.ResourceNotFoundException: Status code 404, "{"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}"
	at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:347)
	at com.azure.core.implementation.http.rest.SyncRestProxy.ensureExpectedStatus(SyncRestProxy.java:130)
	at com.azure.core.implementation.http.rest.SyncRestProxy.handleRestReturnType(SyncRestProxy.java:213)
	at com.azure.core.implementation.http.rest.SyncRestProxy.invoke(SyncRestProxy.java:81)
	at com.azure.core.implementation.http.rest.RestProxyBase.invoke(RestProxyBase.java:109)
	at com.azure.core.http.rest.RestProxy.invoke(RestProxy.java:91)
	at com.sun.proxy.$Proxy3.getChatCompletionsSync(Unknown Source)
	at com.azure.ai.openai.implementation.OpenAIClientImpl.getChatCompletionsWithResponse(OpenAIClientImpl.java:897)

在Chat playground是可以正常使用的

enter image description here

但是用java代码调用api就出现上面的错误。

enter image description here

Azure OpenAI in Foundry Models

1 answer

Sort by: Most helpful
  1. Guan007 0 Reputation points
    2023-09-17T09:36:24.0066667+00:00

    解决了,我的

    deploymentOrModelId参数传错了,我一直传的是ModelName,没有改成DeploymentName。后来尝试修改了才调用成功。
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.