Commit graph

2900 commits

Author SHA1 Message Date
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
J. Nick Koston
33ff84469a
Align max expected entities constant between modules (#118102) 2024-05-27 14:06:16 -10: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
1602c8063c
Standardize LLM instructions prompt (#118195)
* Standardize instructions prompt

* Add time/date to default instructions
2024-05-26 20:24:26 -04:00
J. Nick Koston
c368ffffd5
Add async_get_hass_or_none (#118164) 2024-05-26 13:38:46 +02:00
Paulus Schoutsen
233c3bb2be
Add render prompt method when no API selected (#118136) 2024-05-26 13:35:15 +02:00
J. Nick Koston
607aaa0efe
Speed up template result parsing (#118168) 2024-05-26 13:09:12 +02: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
Allen Porter
89e2c57da6
Add conversation agent debug tracing (#118124)
* Add debug tracing for conversation agents

* Minor cleanup
2024-05-25 14:16:51 -04:00
J. Nick Koston
42232ecc8a
Remove unused code in template helper (#118075) 2024-05-24 17:44:24 -10:00
J. Nick Koston
6923fb1601
Avoid template context manager overhead when template is already compiled (#118079) 2024-05-24 17:44:02 -10:00
J. Nick Koston
5cb3bc19c0
Speed up async_render_with_possible_json_value (#118080) 2024-05-24 17:43:42 -10:00
J. Nick Koston
3416162fdb
Remove OrderedDict from entity_values as dict guarantees order on newer cpython (#118081) 2024-05-24 17:43:20 -10:00
J. Nick Koston
f026083712
Speed up is_template_string by avoiding regex engine (#118076) 2024-05-24 17:42:55 -10: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
J. Nick Koston
cf73a47fc0
Significantly speed up single use callback dispatchers (#117934) 2024-05-24 11:21:10 -10: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
J. Nick Koston
a8fba691ee
Add types to event tracker data (#118010)
* Add types to event tracker data

* fixes

* do not test event internals in other tests

* fixes

* Update homeassistant/helpers/event.py

* cleanup

* cleanup
2024-05-24 10:09:39 -04:00
Marc Mueller
dd22ee3dac
Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
Marc Mueller
905adb2431
Update codespell ignore list (#118018) 2024-05-24 10:24:34 +02:00
Marc Mueller
0e03e591e7
Improve callable annotations (#118024) 2024-05-24 10:24:09 +02:00
J. Nick Koston
b7a18e9a8f
Avoid calling split_entity_id in event add/remove filters (#118015) 2024-05-24 10:01:33 +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
J. Nick Koston
6c6a5f496a
Simplify async_track_time_interval implementation (#117956) 2024-05-22 21:56:49 -10:00
Paulus Schoutsen
1f7245ecf2
Update LLM no tools message (#117935) 2024-05-22 21:17:03 -04: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
J. Nick Koston
0d5c8e30cd
Migrate issue registry to use singleton helper (#117848)
* Migrate issue registry to use singleton helper

The other registries were already migrated, but since this
one had a read only flag, it required a slightly different
solution since it uses the same hass.data key

* refactor
2024-05-22 14:13:19 -04:00
Joost Lekkerkerker
0c5296b38f
Add lock to token validity check (#117912) 2024-05-22 14:10:23 -04:00
J. Nick Koston
6113b58e9c
Speed up registry indices (#117897)
* Use defaultdict for registry indices

defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present

* Use defaultdict for registry indices

defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present
2024-05-22 14:07:39 -04: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
Denis Shulyaka
009c9e79ae
LLM Tools: Add device_id (#117884) 2024-05-21 21:24:46 -04:00
Sid
c2b3bf3fb9
Enable Ruff RET502 (#115139) 2024-05-21 22:19:33 +02:00
Paulus Schoutsen
f21226dd0e
Address late feedback Google LLM (#117873) 2024-05-21 20:11:18 +02:00
Michael Hansen
8079cc0464
Add description to intent handlers and use in LLM helper (#117864) 2024-05-21 12:54:34 -04:00
J. Nick Koston
266ce9e268
Cache area registry JSON serialize (#117847)
We already cache the entity and device registry, but since I never
used area until recently I did not have enough to notice that they
were not cached
2024-05-21 09:03:31 -04:00
J. Nick Koston
905692901c
Simplify service description cache logic (#117846) 2024-05-21 09:02:32 -04:00
Marc Mueller
d44f949b19
Use PEP 695 misc (2) (#117814) 2024-05-21 09:45:57 +02:00
Marc Mueller
58d0ac7f21
Remove future import to fix broken typing.get_type_hints call (#117837) 2024-05-21 09:39:47 +02:00