125 Commits

Author SHA1 Message Date
Erik Montnemery
354855ff5f
Remove some dead code from the conversation integration (#138878) 2025-02-19 21:51:45 +01:00
Paulus Schoutsen
0b6f49fec2
Filter out certain intents from being matched in local fallback (#137763)
* Filter out certain intents from being matched in local fallback

* Only filter if LLM agent can control HA
2025-02-19 14:27:42 -06:00
Michael Hansen
30a6a6ad4b
Use language util to match intent language (#138560) 2025-02-14 20:51:53 -05:00
Paulus Schoutsen
7883106e7c
Make sure we always have agent_id in ConversationInput (#137679)
* Make sure we always have agent_id in ConversationInput

* fix type
2025-02-07 18:25:21 -08:00
Paulus Schoutsen
649319f4ee
Introduce async_add_assistant_content to conversation chat log (#137273)
introduce async_add_assistant_content_without_tools to conversation chat log
2025-02-03 14:27:55 -06:00
Paulus Schoutsen
9679fc7878
Chat session rev2 (#137209)
* Chat Session rev 2

* Rename session to chat_log

* Simplify typing

* Typing

* Address comments

* Fix anthropic and ollama
2025-02-03 00:05:20 -05:00
Paulus Schoutsen
dd9bd8ef73
Make get_chat_session a callback context manager (#137146) 2025-02-01 23:37:24 -05:00
Paulus Schoutsen
2f6640707b
Extract conversation ID generation to helper (#137062)
* Extract conversation ID generation to helper

* Allow nested get_chat_log calls
2025-02-01 20:54:00 -05:00
Paulus Schoutsen
5690516852
ChatSession: Split native content out of message class (#136668)
Split native content out of message class
2025-01-27 21:12:42 -08:00
Michael Hansen
414fa4125e
Don't translate state names in default agent responses (#136382)
Don't translate state names in responses
2025-01-23 16:03:48 -06:00
Paulus Schoutsen
85f10cf60a
Use LLM fallback when local matching matches intent but not targets (#136045)
LLM fallback to be used when local matching matches intent but finds no targets
2025-01-20 02:06:06 -05:00
Paulus Schoutsen
754de6f998
Add shared history for conversation agents (#135903)
* Add shared history for conversation agents

* Remove unused code

* Add support for native history items

* Store all assistant responses as assistant in history

* Add history support to DefaultAgent.async_handle_intents

* Make local fallback work

* Add default agent history

* Add history cleanup

* Add tests

* ChatHistory -> ChatSession

* Address comments

* Update snapshots
2025-01-18 22:33:03 -05:00
Paulus Schoutsen
5062a7fec8
Add new api to fetch sentence triggers (#132764)
* Add new api to fetch sentence triggers

* With latest packages
2024-12-09 23:21:27 -05:00
Michael Hansen
ab83ec61e0
Ensure entity names are not hassil templates (#132184) 2024-12-03 19:37:05 +01:00
Paulus Schoutsen
6103cea3f5
Make the full conversation input available to sentence triggers (#131982)
Co-authored-by: Michael Hansen <mike@rhasspy.org>
2024-11-30 22:04:29 -06:00
Michael Hansen
752df5a8cb
Filter entity names before intent matching (#131563) 2024-11-26 09:42:31 +01:00
Michael Hansen
f47840d83c
Cache intent recognition results (#131114) 2024-11-22 20:57:42 -05:00
Michael Hansen
5fa9a945d9
Handle sentence triggers and local intents before pipeline agent (#129058)
* Handle sentence triggers and registered intents in Assist LLM API

* Remove from LLM

* Check sentence triggers and local intents first

* Fix type

* Fix type again

* Use pipeline language

* Fix cloud test

* Clean up and fix translation key

* Refactor async_recognize
2024-11-14 10:50:50 -06:00
Michael Hansen
51c6ee97b1
Upgrade to hassil 2.0 (#130544)
* Working on hassil 2.0

* Bump to hassil 2.0

* Update snapshots

* Remove debug logging
2024-11-13 16:50:08 -05:00
Michael
f10063c9be
Fix translation key for done response in conversation (#130247) 2024-11-10 16:28:58 +01:00
Artur Pragacz
bb9f534259
Improve intent recognition in default conversation agent (#124282)
Use the same logic for custom sentences.
Prefer higher quality (longer) names.
2024-10-15 09:14:31 -05:00
Michael Hansen
67e0ccf677
Use exposed error messages in Assist (#127503)
* Use exposed error messages

* Report expose errors

* Remove comment

* Relative import

* Rework expose check logic

* Delay creation of all names list, and skip config/hidden entities

* Clean up commented code and type issue

* Fix test

* Move assistant check
2024-10-11 13:06:03 -04:00
epenet
f8a53aea09
Use HassKey in conversation (#126332)
* Use HassKey in conversation

* Adjust tests
2024-09-22 17:54:14 +02:00
Andrii Mitnovych
254aa8c9ea
Add entity deduplication by assist device ID in conversation agent (#123957)
* Add entities deduplication by assist device ID in default conversation agent

* Updated test.
2024-08-19 15:00:23 -05:00
Allen Porter
8d0e998e54
Improve conversation agent tracing to help with eval and data collection (#122542) 2024-07-31 14:38:44 +02:00
Michael Hansen
69ed730101
Bump hassil to 1.7.3 for number word caching (#121608)
* Bump hassil to 1.7.3

* Add wildcard slot list name
2024-07-09 17:25:40 +02:00
Paulus Schoutsen
01861cd240
Ensure we prepare conversation pipeline when speech-to-text starts (#114665)
* Ensure we prepare conversation pipeline when speech-to-text starts

* Add lock around recognize

* Update homeassistant/components/conversation/default_agent.py

* Add lock around load intents
2024-07-09 09:58:52 -05:00
Michael Hansen
4498bf9ec4
Remove language lock from default agent and move around tests (#121531)
* Remove language lock

* Remove unsub for change events

* Remove redundant check

* Simplify intent loading

* Cache intent loading error

* Revert "Remove unsub for change events"

This reverts commit 575266abcdde3edb0ee07b4ab7724c83c8a6e5e4.

* guard instead of assert

* Some more cleanup

* No need to warn during prepare

* Some more cleanup

* Add more timing logs

* Split up tests and rely less on http

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-07-09 16:05:43 +02:00
Paulus Schoutsen
eb0f6f7088
Ensure intents_changed variable is always initialized (#121444) 2024-07-07 17:32:35 +02:00
Paulus Schoutsen
a885bdfe76
Add conversation supported feature CONTROL (#121036) 2024-07-03 14:30:51 +02:00
Michael Hansen
46dcf1dc44
Prioritize custom intents over builtin (#120358) 2024-06-24 20:57:56 +02:00
Michael Hansen
bca8958d4b
Prioritize literal text with name slots in sentence matching (#118900)
Prioritize literal text with name slots
2024-06-06 14:20:34 -04:00
Michael Hansen
aac31059b0
Resolve areas/floors to ids in intent_script (#118734) 2024-06-03 20:29:26 +02: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
Michael Hansen
106cb4cfb7
Bump intents and add tests for new error messages (#118317)
* Add new error keys

* Bump intents and test new error messages

* Fix response text
2024-05-28 12:24:24 -04:00
Michael Hansen
daee3d8db0
Don't prioritize "name" slot if it's a wildcard in default conversation agent (#117518)
* Don't prioritize "name" slot if it's a wildcard

* Fix typing error
2024-05-15 22:23:24 -04:00
Michael Hansen
d441a62aa6
Remove "device_id" slot from timers (#117460)
Remove "device_id" slot
2024-05-14 15:48:24 -04:00
Michael Hansen
641754e0bb
Pass device_id to intent handlers (#117442) 2024-05-14 13:59:49 -05:00
Michael Hansen
add6ffaf70
Add Assist timers (#117199)
* First pass at timers

* Move to separate file

* Refactor to using events

* Add pause/unpause/status

* Add ordinal

* Add test for timed Assist command

* Fix name matching

* Fix IntentHandleError

* Fix again

* Refactor to callbacks

* is_paused -> is_active

* Rename "set timer" to "start timer"

* Move tasks to timer manager

* More fixes

* Remove assist command

* Remove cancel by ordinal

* More tests

* Remove async on callbacks

* Export async_register_timer_handler
2024-05-14 14:42:32 -04:00
Michael Hansen
7923471b94
Intent target matching and media player enhancements (#115445)
* Working

* Tests are passing

* Fix climate

* Requested changes from review
2024-05-07 22:01:03 -04:00
Paulus Schoutsen
4fce99edb5
Only call conversation should_expose once (#116891)
Only call should expose once
2024-05-05 21:37:10 -04:00
J. Nick Koston
ca5ed274cb
Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
Joost Lekkerkerker
bf142aef5f
Fix ruff error (#115023) 2024-04-06 14:13:20 +02:00
Marc Mueller
7898bdcd4e
Improve generic event typing [conversation] (#114729) 2024-04-06 14:00:13 +02:00
Sid
0d66d298ec
Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
Marc Mueller
3c5089bc3f
Update import for EventStateChangedData [a-h] (#114899) 2024-04-04 11:48:36 -10:00
Michael Hansen
1c2499b03a
Add "conversation" key to translations (#114887)
* Use translated trigger response

* Use conversation key instead
2024-04-04 14:45:27 -05:00
Paulus Schoutsen
d2e4f5f36e
Add conversation entity (#114518)
* Default agent as entity

* Migrate constant to point at new value

* Fix tests

* Fix more tests

* Move assist pipeline back to cloud after dependenceis
2024-04-01 21:34:25 -04:00
Paulus Schoutsen
f01235ef74
Re-organize conversation integration (#114502)
* Re-organize conversation integration

* Clean up 2 more imports

* Re-export models

* Fix imports

* Uno mas

* Rename agents to models

* Fix cast test that i broke?

* Just blocking till I'm done

* Wrong place
2024-03-31 00:05:25 -04:00
Paulus Schoutsen
fb572b8413
Conversation to unsubscribe when no cache to invalidate (#114515)
* Add event filter callbacks to conversation

* Unsusbcribe when we have no slot lists
2024-03-30 23:47:13 -04:00