Skip to content

joselcaguilar/azure-openai-ha

Repository files navigation

hacs_badge Validate workflow Lint workflow GitHub all releases GitHub Sponsor BuyMeACoffee

What This Is

This custom integration adds a conversation agent powered by Azure OpenAI in Home Assistant, it's based on the original OpenAI Conversation integration for Home Assistant.

What It Does

This is equivalent to the built-in OpenAI Conversation integration. The difference is that it uses the OpenAI algorithms available through Azure. Other than that the goal is to keep the differences to a minimum. You can use this conversation integration with Assistants in Home Assistant to control you house. They have all the capabilities the built-in OpenAI Conversation integration has.

Limitations

  • Home Assistant versions required: 2023.5+

Installation and Configuration

  1. Download and install the integration from HACS: Azure OpenAI Conversation.
  2. Restart your Home Assistant instance
  3. Go to Settings -> Devices & Services -> Add Integration -> Azure OpenAI Conversation
  4. To have a conversation, made sure to deploy a chat completion model (like gpt-35-turbo or gpt-4o) in Azure.
  5. If you want to generate images using the available generate_image service, make sure to deploy the dall-e-3 model as well.
  6. Type your API Key, API Base and API Version used following the example below and hit submit:
  1. Configure your assistant to use the Azure OpenAI Conversation.

Options

Options for Azure OpenAI Conversation can be set via the user interface, by taking the following steps:

  1. Browse to your Home Assistant instance.
  2. In the sidebar click on Settings -> Devices & Services.
  3. FInd the Azure Open AI Conversation integration and click 'Options'

Options available (same as built-in OpenAI conversation):

  • Prompt: The starting text for the AI language model to generate new text from. This text can include information about your Home Assistant instance, devices, and areas and is written using Home Assistant Templating.

  • Model: The name of the GPT language model deployed for text generation (i.e.- my-gpt35-model). You can find more details on the available models in the Azure OpenAI Documentation. If you are having issues using an assistant that uses this integration please check this model is the model you actually deployed.

  • Maximum Tokens to Return in Response The maximum number of words or "tokens" that the AI model should generate in its completion of the prompt. For more information, see the Azure OpenAI Completion Documentation.

  • Temperature: A value that determines the level of creativity and risk-taking the model should use when generating text. A higher temperature means the model is more likely to generate unexpected results, while a lower temperature results in more deterministic results. See the Azure OpenAI Completion Documentation for more information.

  • Top P: An alternative to temperature, top_p determines the proportion of the most likely word choices the model should consider when generating text. A higher top_p means the model will only consider the most likely words, while a lower top_p means a wider range of words, including less likely ones, will be considered. For more information, see the Azure OpenAI Completion Documentation.

Changelog

Please reference the release history.

How to Help

While it'd be nice to have more developers, you can contribute without knowing how to code. You can file bugs/feature requests, or you can help with other tasks like UI Translations and updating the README.

UI Translations

More languages can be added here, contributions are welcome :)

Languages available:

  • English

Documentation

The README file will be used for Documentation, if it's expanded in the future with automations or other tweaks, we can think on a wiki for that purpose.

Disclaimer: Don't worry about making mistakes as we can revert using the history 😊.

Funding

GitHub Buy me a coffee
GitHub Sponsor Buy Me A Coffee

License

MIT - By providing a contribution, you agree the contribution is licensed under MIT.