Reputation: 11
I'm currently doing an SAP tutorial about AI and SAP AICore.
For an AI modell is use Azure offering and deployed and gpt-35-turbo modell. Now I'm being asked for an API Base / endpoint.
Does someone know where I get this from. Azure provides me one but whenever I open it,
it get "Resource not found". Does someone know where else I get the "API Base"?
I tried getting the endpoint via azure --> deployed models -->opened it in playground --> code view --> copied endpoint and API Key.
But somehow the endpoint gets me to "resource not found"
Upvotes: 1
Views: 2446
Reputation: 10410
Does someone know where I get this from. Azure provides me one but whenever I open it https://foraiproxy.openai.azure.com/openai/deployments/myAIResourceForTheInverter/chat/completions?api-version=2023-03-15-preview" it get "Resource not found". Does someone know where else I get the "API Base"?
To get the chat completion you can use either curl
or Postman.
To get in curl
you can use the below commands.
Command:
curl https://<Endpointname>.openai.azure.com/openai/deployments/<your-deploymentname>/chat/completions?api-version=2023-05-15
-H "Content-Type:application/json"
-H "api-key:your api key"
-d '{"messages":[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},{"role": "user", "content": "Do other Azure Cognitive Services support this too?"}]}'
Output:
{"id":"chatcmpl-7XMYECDf4uKxxxxxx","object":"chat.completion","created":1688185866,
"model":"gpt-35-turbo",
"choices":[{"index":0,"finish_reason":"stop","message":{"role":"assistant","content":"Yes, other Azure Cognitive Services also support customer managed keys. However, the specific details on how to manage and use customer managed keys may differ slightly depending on the specific service. So, it's important to consult the documentation for that specific service to get more information on how to set up and use customer managed keys for that service."}}],"usage":{"completion_tokens":66,"prompt_tokens":59,"total_tokens":125}}
Postman:
POST https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}
Header:
Content-Type:application/json
api-key: "your API key"
Body:
'{"messages":[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},{"role": "user", "content": "Do other Azure Cognitive Services support this too?"}]}
Output:
Reference:
Azure OpenAI Service REST API reference - Azure OpenAI | Microsoft Learn
Upvotes: 0