llm
llm copied to clipboard
docs: add docs on how to configure models deployed via azure
I noted that openai models deployed to Azure were possible to utilize via llm, but could not find documentation on how to configure it. Thus, here it is 🎉
This pull request adds documentation for using OpenAI models deployed via Azure OpenAI Service in docs/other-models.md. The most important change is the addition of instructions on how to add the model to the extra-openai-models.yaml file and an example of how to run a prompt against the added model using llm.
Main documentation changes:
docs/other-models.md: Added documentation for using OpenAI models deployed via Azure OpenAI Service, including instructions on how to add the model to theextra-openai-models.yamlfile and an example of how to run a prompt against the added model usingllm.
Thanks for the documentation. I tried and it works. However, do you know if we can use the same approach for embedding models on Azure?
Thanks for the documentation. I tried and it works. However, do you know if we can use the same approach for embedding models on Azure?
Thanks for verifying! I took a look at this, and I don't think this is possible without implementing a plugin to load custom embedding models. Might take an attempt at this over the weekend :)
This now works for me after incorporating my suggestions.
@pamelafox - how are you specifying the azure openai key? Is it through the same env variable "OPENAI_API_KEY"? And both api_type and api_key_name are set to "azure"?
I set the key using the key feature here: https://llm.datasette.io/en/stable/setup.html#api-keys
Since I used the key name of "azure", then yes, my api_key_name was "azure", but in theory you might set it with a different name.
Here's what my configuration looks like in ~/Library/Application Support/io.datasette.llm/extra-openai-models.yaml :
- model_id: azure-gpt-35
model_name: gpt-35-turbo
api_base: https://cog-24ccg67vinxu2.openai.azure.com
api_key_name: azure
api_version: 2023-05-15
api_type: azure
api_engine: chat
@pamelafox - thanks! I was not setting up the key, works for me now.
I haven't been able to use Azure OpenAI with the instructions provided here. See https://github.com/simonw/llm/issues/433 and https://github.com/simonw/llm/issues/413
Since openai python package > 1.0.0, the AzureOpenAI class is required.
There is a pending PR here: https://github.com/simonw/llm/pull/414