llm icon indicating copy to clipboard operation
llm copied to clipboard

docs: add docs on how to configure models deployed via azure

Open bnookala opened this issue 2 years ago • 7 comments

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 the extra-openai-models.yaml file and an example of how to run a prompt against the added model using llm.

bnookala avatar Nov 08 '23 22:11 bnookala

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?

3shv avatar Nov 18 '23 19:11 3shv

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 :)

bnookala avatar Nov 24 '23 16:11 bnookala

This now works for me after incorporating my suggestions.

pamelafox avatar Dec 30 '23 15:12 pamelafox

@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"?

sanzgiri avatar Jan 13 '24 07:01 sanzgiri

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 avatar Jan 13 '24 17:01 pamelafox

@pamelafox - thanks! I was not setting up the key, works for me now.

sanzgiri avatar Jan 14 '24 18:01 sanzgiri

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

DaniloNC avatar Mar 08 '24 17:03 DaniloNC