Closed wxxb789 closed 10 months ago
Not explicitly, no. But I had a look at the API:
curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=2023-03-15-preview \
-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?"}]}'
It looks very similar to the OpenAI API, so you might be able to use gptel with minimal tweaking: Replace the request URL and one of the headers (Authorization: Bearer sk-...
→ api-key: sk-...
). If that works I could add a PR.
Maybe worth mentioning, openai.el now supports this. 😄 See https://github.com/emacs-openai/openai/issues/14.
Maybe worth mentioning, openai.el now supports this. smile See emacs-openai/openai#14.
Thanks for the heads-up. If all that's needed is making the base url configurable, this should be simple to add.
It's not that simple - see https://github.com/emacs-openai/openai/issues/18. Basically, Azure OpenAI API is slightly different:
POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2022-12-01
In particular, you:
model
parameter in the payload, but istead it's the YOUR_DEPLOYMENT_NAME
;v1
, but a api-version
URL parameter;Authorization: Bearer $key
, but as api-key: $key
header.I would dearly love to see this implemented too.
Support for Azure has been implemented in v0.5.0, along with support for local models using GPT4All and Ollama. Please refer to the README for instructions.
will this package support Azure OpenAI api?