Commit Graph

1600 Commits (2d46028e21b4095479302629a201c3cfc811b2c2)

Author SHA1 Message Date
epenet 20817955af
Fix bad-chained-comparison pylint warning in tests (#119477) 2024-06-12 12:35:55 +02:00
epenet abb8c58b87
Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
epenet c70cfbb535
Fix arguments-renamed pylint warning in tests (#119473) 2024-06-12 12:25:29 +02:00
epenet 7d631c28a6
Ignore attribute-defined-outside-init pylint warnings in tests (#119470) 2024-06-12 12:22:31 +02:00
epenet 2a7e78a80f
Ignore broad-exception-raised pylint warnings in tests (#119468) 2024-06-12 12:21:41 +02:00
epenet 7388271689
Fix unspecified-encoding warnings in tests (#119405) 2024-06-11 17:58:40 +02:00
Erik Montnemery 8620bef5b0
Support shared keys starting with period in services.yaml (#118789) 2024-06-11 16:31:19 +02:00
epenet fce4fc663e
Fix import-outside-toplevel pylint warnings in core tests (#119394) 2024-06-11 16:10:34 +02:00
Erik Montnemery 904b89df80
Allow importing typing helper in core files (#119377)
* Allow importing typing helper in core files

* Really fix the circular import

* Update test
2024-06-11 13:48:12 +02:00
epenet 650cf13bca
Improve type hints in aiohttp_client helper tests (#119300) 2024-06-10 20:31:19 +02:00
epenet eb6af2238c
Improve type hints in registry helper tests (#119302) 2024-06-10 20:25:34 +02:00
epenet 6733f86c61
Use service_calls fixture in helper tests (#119275)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-06-10 14:57:34 +02:00
Sid 721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
Paulus Schoutsen c49ca5ed56
Ensure intent tools have safe names (#119144) 2024-06-08 17:53:47 +02:00
Erik Montnemery 6c15351c18
Add support for common references in strings.json (#118783)
* Add support for common references in strings.json

* Update tests
2024-06-07 20:59:26 +02:00
paulusbrand 624017a0f9
Add template Base64 decode encoding parameter (#116603)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-07 17:01:35 +02:00
J. Nick Koston 62b1bde0e8
Only entity verify state writable once after success unless hass is missing (#118896) 2024-06-06 11:46:44 -05:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
J. Nick Koston 475c20d529
Always do thread safety check when writing state (#118886)
* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* async_fire is more common than expected with ccs

* fix mock

* fix hass mocking
2024-06-05 23:41:55 -04:00
Paulus Schoutsen 52ad90a68d
Include script description in LLM exposed entities (#118749)
* Include script description in LLM exposed entities

* Fix race in test

* Fix type

* Expose script

* Remove fields
2024-06-04 11:18:07 -04:00
Paulus Schoutsen bdcfd93129
Automatically fill in slots based on LLM context (#118619)
* Automatically fill in slots from LLM context

* Add tests

* Apply suggestions from code review

Co-authored-by: Allen Porter <allen@thebends.org>

---------

Co-authored-by: Allen Porter <allen@thebends.org>
2024-06-03 10:36:41 -04:00
epenet 37fc16d7b6
Fix incorrect `patch` type hint in main conftest (#118461) 2024-06-02 15:34:30 +02:00
J. Nick Koston 8f94205014
Include a traceback for non-strict event loop blocking detection (#118620) 2024-06-02 06:36:25 -04:00
tronikos dfb407728f
Stop instructing LLM to not pass the domain as a list (#118590) 2024-05-31 20:21:18 -04:00
epenet 41e852a01b
Add ability to replace connections in DeviceRegistry (#118555)
* Add ability to replace connections in DeviceRegistry

* Add more tests

* Improve coverage

* Apply suggestion

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2024-05-31 15:31:44 -04:00
Paulus Schoutsen 6dd01dbff7
Rename llm.ToolContext to llm.LLMContext (#118566) 2024-05-31 11:11:24 -04:00
tronikos 2bd142d3a6
Improve LLM prompt (#118520) 2024-05-30 22:03:57 -04:00
tronikos 0d6c7d0973
Fix LLMs asking which area when there is only one device (#118518)
* Ignore deprecated open and close cover intents for LLMs

* Fix LLMs asking which area when there is only one device

* remove unrelated changed

* remove unrelated changes
2024-05-30 17:14:11 -04:00
Ron Weikamp 2814ed5003
Add allow_negative configuration option to DurationSelector (#116134)
* Add configuration option positive to DurationSelector

* Rename to allow_negative in conjunction with a deprecation notice

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-05-30 17:42:34 +02:00
tronikos 4893faa671
Instruct LLM to not pass a list to the domain (#118451) 2024-05-30 08:37:45 +02:00
tronikos 639f6c640c
Improve LLM prompt (#118443)
* Improve LLM prompt

* test

* improvements

* improvements
2024-05-29 21:44:33 -04:00
tronikos 4056c4c2cc
Ask LLM to pass area name and domain (#118357) 2024-05-29 08:03:43 -04:00
Erik Montnemery 7abffd7cc8
Don't report entities with invalid unique id when loading the entity registry (#118290) 2024-05-29 08:32:39 +02:00
Paulus Schoutsen d22871f1fd
Reduce the intent response data sent to LLMs (#118346)
* Reduce the intent response data sent to LLMs

* No longer delete speech
2024-05-28 23:07:00 -04:00
Paulus Schoutsen c097a05ed4
Tweak Assist LLM API prompt (#118343) 2024-05-28 22:43:22 -04:00
Paulus Schoutsen 615a1eda51
LLM Assist API to ignore intents if not needed for exposed entities or calling device (#118283)
* LLM Assist API to ignore timer intents if device doesn't support it

* Refactor to use API instances

* Extract ToolContext class

* Limit exposed intents based on exposed entities
2024-05-28 21:29:18 -04:00
Paulus Schoutsen f0d7f48930
Handle generic commands as area commands in the LLM Assist API (#118276)
* Handle generic commands as area commands in the LLM Assist API

* Add word area
2024-05-28 11:21:17 -04:00
J. Nick Koston 87989a88cd
Remove translation and icon component path functions (#118214)
These functions have been stripped down to always return
the same path so there was no longer a need to have a
function for this. This is left-over cleanup from
previous refactoring.
2024-05-27 10:35:52 +02:00
Paulus Schoutsen ecb05989ca
Add exposed entities to the Assist LLM API prompt (#118203)
* Add exposed entities to the Assist LLM API prompt

* Check expose entities in Google test

* Copy Google default prompt test cases to LLM tests
2024-05-27 00:27:08 -04:00
Paulus Schoutsen 87fc27eeae
Teach Context about deepcopy (#118206)
Teach context about deepcopy
2024-05-26 23:14:02 -04:00
J. Nick Koston 7bbb33b415
Improve script disallowed recursion logging (#118151) 2024-05-26 12:58:34 +02:00
Denis Shulyaka cee3be5f7a
Break long strings in LLM tools (#118114)
* Break long code strings

* Address comments

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-05-25 14:24:51 -04:00
Denis Shulyaka da74ac06d7
Add user name and location to the LLM assist prompt (#118071)
Add user name and location to the llm assist prompt
2024-05-24 22:23:05 -04:00
Paulus Schoutsen 7554ca9460
Allow llm API to render dynamic template prompt (#118055)
* Allow llm API to render dynamic template prompt

* Make rendering api prompt async so it can become a RAG

* Fix test
2024-05-24 16:04:48 -04:00
Michael Hansen 77e385db52
Fix intent helper test (#118053)
Fix test
2024-05-24 12:59:19 -04:00
Robert Resch cb62f4242e
Remove strict connection (#117933) 2024-05-24 15:50:22 +02:00
epenet 0b4f1cff98
Use issue_registry fixture in core tests (#118042) 2024-05-24 15:26:32 +02:00
Franck Nijhof 9224997411
Add sequence action for automations & scripts (#117690)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-05-24 09:34:49 +02:00
Peter eb76386c68
Prevent time pattern reschedule if cancelled during job execution (#117879)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-22 10:36:03 -10:00
Michael Hansen f99ec87338
Fail if targeting all devices in the house in service intent handler (#117930)
* Fail if targeting all devices in the house

* Update homeassistant/helpers/intent.py

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-05-22 13:53:31 -04:00