Commit graph

2739 commits

Author SHA1 Message Date
Paulus Schoutsen
836abe68c7
Track primary integration (#119741)
* Track primary integration

* Update snapshots

* More snapshots updated

* Uno mas

* Update snapshot
2024-06-16 13:26:06 -04:00
tronikos
6b8bddf6e3
Make remaining time of timers available to LLMs (#118696)
* Include speech_slots in IntentResponse.as_dict

* Populate speech_slots only if available

* fix typo

* Add test

* test all fields

* Fix another test

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-06-14 20:47:41 +02:00
Erik Montnemery
003f216820
Rename collection.CollectionChangeSet to collection.CollectionChange (#119532) 2024-06-14 08:54:37 +02:00
Erik Montnemery
2661581d4e
Fix typos in collection helper (#119524) 2024-06-12 20:37:38 +02:00
Erik Montnemery
8620bef5b0
Support shared keys starting with period in services.yaml (#118789) 2024-06-11 16:31:19 +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
tronikos
5f9455e0fd
Log errors in Intent.async_handle (#119182)
* Log errors in Intent.async_handle

* log exception stack trace

* Update homeassistant/helpers/intent.py

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2024-06-10 11:33:12 -04:00
epenet
960d1289ef
Avoid references to websocket_api.const in core and other components (#119285) 2024-06-10 13:49:44 +02:00
J. Nick Koston
ad7097399e
Ensure multiple executions of a restart automation in the same event loop iteration are allowed (#119100)
* Add test for restarting automation

related issue #119097

* fix

* add a delay since restart is an infinite loop

* tests
2024-06-08 17:07:39 -04:00
Paulus Schoutsen
c49ca5ed56
Ensure intent tools have safe names (#119144) 2024-06-08 17:53:47 +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
Michael Hansen
87114bf19b
Fix exposure checks on some intents (#118988)
* Check exposure in climate intent

* Check exposure in todo list

* Check exposure for weather

* Check exposure in humidity intents

* Add extra checks to weather tests

* Add more checks to todo intent test

* Move climate intents to async_match_targets

* Update test_intent.py

* Update test_intent.py

* Remove patch
2024-06-06 20:41:25 -05: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
fe21e2b8ba
Import Generator from typing_extensions (1) (#118986) 2024-06-06 17:02:13 +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
tronikos
f9dff1632e
Use ISO format when passing date to LLMs (#118705) 2024-06-03 19:48:50 +02: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
891f9c9578
Add error message to device registry helper (#118676) 2024-06-03 09:58:02 +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
Paulus Schoutsen
f3b20d30ae
Add base prompt for LLMs (#118592) 2024-06-01 00:21:37 -04:00
tronikos
dfb407728f
Stop instructing LLM to not pass the domain as a list (#118590) 2024-05-31 20:21:18 -04:00
Jan-Philipp Benecke
32b51b8792
Run ruff format for device registry (#118582) 2024-05-31 22:22:48 +02: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
J. Nick Koston
ade0f94a20
Remove duplicate getattr call in entity wrap_attr (#118558) 2024-05-31 11:11:46 -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
272c51fb38
Fix unnecessary single quotes escaping in Google AI (#118522) 2024-05-30 19:56:06 -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
tronikos
6d82cfa91a
Ignore deprecated open and close cover intents for LLMs (#118515) 2024-05-30 16:29:13 -04:00
Paulus Schoutsen
80588d9c67
Ignore the toggle intent (#118491) 2024-05-30 12:53:50 -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
tronikos
c75cb08aae
Fix LLM tracing for Google Generative AI (#118359)
Fix LLM tracing for Gemini
2024-05-29 08:02:59 -04:00
tronikos
b7ee90a53c
Expose useful media player attributes to LLMs (#118363) 2024-05-29 08:01:40 -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
J. Nick Koston
f3fa843b9d
Replace pop calls with del where the result is discarded in restore_state (#118339) 2024-05-28 23:14:40 -04:00
J. Nick Koston
b94bf1f214
Add cache to more complex entity filters (#118344)
Many of these do regexes and since the entity_ids are almost
always the same we should cache these
2024-05-28 23:07:50 -04: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
J. Nick Koston
fa9ebb062c
Small speed up to connecting dispatchers (#118342) 2024-05-28 16:49:58 -10:00
Paulus Schoutsen
c097a05ed4
Tweak Assist LLM API prompt (#118343) 2024-05-28 22:43:22 -04:00
Michael Hansen
d223e1f2ac
Add Conversation command to timers (#118325)
* Add Assist command to timers

* Rename to conversation_command. Execute in timer code.

* Make agent_id optional

* Fix arg

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-05-28 20:33:31 -05: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
J. Nick Koston
e0264c8604
Replace pop calls with del where the result is discarded in entity (#118340) 2024-05-28 15:26:53 -10:00
J. Nick Koston
fd9d4dbb34
Use del instead of pop in the entity platform remove (#118337) 2024-05-28 15:26:22 -10:00
Michael Hansen
2dc49f0410
Add platforms to intent handlers (#118328) 2024-05-28 16:46:08 -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
Paulus Schoutsen
6f248acfd5
LLM Assist API: Inline all exposed entities (#118273)
Inline all exposed entities
2024-05-27 21:12:10 -04:00