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 conversation agent is unable to control your house. It can only query information that has been provided by Home Assistant. To be able to answer questions about your house, Home Assistant will need to provide OpenAI with the details of your house, which include areas, devices and their states.

Limitations

  • Supported Azure OpenAI API Versions:

    • 2023-06-01-preview
    • 2023-05-15
    • 2023-03-15-preview
    • 2022-12-01
  • Home Assistant versions supported: Due to the breaking changes introduced by Home Assistant Core for custom assistants, the Azure OpenAI Conversation integration is compatible with the following Home Assistant versions:

Azure OpenAI Conversation Version Home Assistant Version
0.x.y 2023.4.x
1.x.y 2023.5+

AI Models supported:

  • gpt-35-turbo
  • gpt-4
  • gpt-4-32k

Installation and Configuration

  1. Ensure that the conversation integration is enabled, it allows you to converse with Home Assistant, add the line below to your configuration.yaml:
conversation:
  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. Type your API Key, API Base and API Version used following the example below and hit submit:

Home Assistant 2023.5+ users

The custom assistant needs to be added from Settings -> Voice assistants. Once it's added, you can select the custom assistant as favorite to be used by default:

Voice Assistants

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. If multiple instances of OpenAI Conversation are configured, choose the instance you want to modify and click on "Configure".

Options available:

  • Prompt Template: 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.

  • Completion 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.

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

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.