Commit Graph

107 Commits

Author SHA1 Message Date
Paulus Schoutsen
1734b316d5 Return intent response from LLM chat log if available (#148522) 2025-07-16 16:16:01 +02:00
tronikos
02a11638b3 Add Google AI STT (#147563) 2025-07-16 14:11:29 +02:00
Joost Lekkerkerker
334d5f09fb Create Google Generative AI sub entries for an enabled entry (#148161)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-07-14 11:24:00 +02:00
Paulus Schoutsen
23a8442abe Make attachments native to chat log (#148693)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-13 19:35:11 +02:00
Paulus Schoutsen
1920edd712 Update Google Generative AI Conversation max tokens to 3000 (#148625)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 13:10:12 -07:00
Paulus Schoutsen
19b3b6cb28 Add attachment support to Google Gemini (#148208) 2025-07-10 23:45:11 +02:00
Paulus Schoutsen
8cb9cadce9 Extract files_to_prompt from Gemini action (#148203)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Allen Porter <allen.porter@gmail.com>
2025-07-06 15:15:38 +02:00
Paulus Schoutsen
4f4ec6f41a Add Google Gen AI structured data support (#148143) 2025-07-05 08:22:17 -07:00
Paulus Schoutsen
04cc451c76 Add AI Task platform to Google Gen AI (#146766) 2025-07-03 23:36:34 -07:00
Ivan Lopez Hernandez
2e7113d881 Swap the Models label for the model name not it's display name, (#147918)
Swap display name for name.
2025-07-01 21:12:58 -07:00
Erik Montnemery
99f7a031d6 Correct Google generative AI config entry migration (#147856) 2025-07-01 10:46:13 +02:00
Joost Lekkerkerker
1b2be083c2 Make sure Google Generative AI integration migration is clean (#147625) 2025-06-26 23:03:36 +02:00
Joost Lekkerkerker
35478e3162 Set Google AI model as device model (#147582)
* Set Google AI model as device model

* fix
2025-06-26 19:44:15 +02:00
tronikos
fb133664e4 Include subentries in Google Generative AI diagnostics (#147558) 2025-06-26 10:50:47 +02:00
tronikos
0f95fe566c Use default title for migrated Google Generative AI entries (#147551) 2025-06-25 22:30:41 -04:00
tronikos
f0a78aadbe Fixes in Google AI TTS (#147501)
* Fix Google AI not using correct config options after subentries migration

* Fixes in Google AI TTS

* Fix tests by @IvanLH

* Change type name.

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2025-06-25 18:12:23 -04:00
Paulus Schoutsen
0cf7952964 Remove duplicated subentry device update in Google Gen AI + add merge test (#147396)
* late comments on Google subentries

* Add test that merges 2 config entries
2025-06-23 22:34:06 -04:00
Paulus Schoutsen
56f4039ac2 Migrate Google Gen AI to use subentries (#147281)
* Migrate Google Gen AI to use subentries

* Add reconfig successful msg

* Address comments

* Do not allow addin subentry when not loaded

* Let HA do the migration

* Use config_entries.async_setup

* Remove fallback name on base entity

* Fix

* Fix

* Fix device name assignment in entity and tts modules

* Fix tests

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
2025-06-23 20:59:32 -04:00
tronikos
2833e97625 Default to gemini-2.5-flash (#147334) 2025-06-23 20:11:16 +02:00
Paulus Schoutsen
8498928e47 Move Google Gen AI fixture to allow reuse (#146921) 2025-06-15 23:00:27 -04:00
Markus Lanthaler
c988d1ce36 Add support for Gemini's new TTS capabilities (#145872)
* Add support for Gemini TTS

* Add tests

* Use wave library and update a few comments
2025-06-14 22:21:04 -07:00
Paulus Schoutsen
ec02f6d010 Extract Google LLM base entity class (#146817) 2025-06-14 22:17:52 -07:00
Ivan Lopez Hernandez
32eb4af6ef Enable message Streaming in the Gemini integration. (#144937)
* Added streaming implementation

* Indicate the entity supports streaming

* Added tests

* Removed unused snapshots

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2025-05-25 21:50:55 -04:00
Ivan Lopez Hernandez
0edfbded23 Fixes #140182 by checking file status before sending the prompt. (#144131)
* Added unit tests

* Addressed review comments

* Fixed tests

* PR comments
2025-05-05 23:45:39 -07:00
Allen Porter
2326c23133 Increase Gemini max tokens to avoid failures observed in evaluations (#143728)
* Increase Gemini max tokens to avoid failures observed in evaluations

* Update snapshots
2025-04-26 15:30:47 -07:00
Allen Porter
4483025856 Update Google Generative AI to allow multiple LLM APIs (#143191) 2025-04-19 11:44:12 +02:00
Ivan Lopez Hernandez
c14380247b Handle None on the response candidates in Google Generative AI (#142497)
* Added type checking on the candidates list

* Made error message a constant
2025-04-07 21:20:54 -07:00
Ivan Lopez Hernandez
30e50d261d Made Google Search enable dependent on Assist availability (#141712)
* Made Google Search enable dependent on Assist availability

* Show error instead of rendering again

* Cleanup test code
2025-04-03 16:23:59 -04:00
Paulus Schoutsen
e88b321741 Ensure user always has first turn for Google Gen AI (#141893) 2025-03-30 23:31:45 -04:00
John Karabudak
85d2e3d006 Fix LLM to speed up prefill (#141156)
* fix: two minor LLM changes to speed up prefill

- moved the current date/time to the end of the prompt
- started sorting all entities by last_changed

* addressed PR comments

* fixed tests

* reduced scope of try/catch in LLM prompt

* addressed more PR comments

* fixed Anthropic test

* addressed another PR comment

* fixed remainder of tests
2025-03-30 13:30:40 -07:00
Ivan Lopez Hernandez
56cc4044e4 Fix a type error when using google-genai==1.7.0 (#141431)
* Fix parts

* Fix the type being sent to the SDK

* Revert changes to __init__

* Test fixes

* Bump version back to 1.7
2025-03-25 19:59:21 -07:00
SLaks
c8f839068c Bump google-genai to 1.7.0 (#140770)
Gemini: Upgrade google-genai to support generating images
2025-03-24 10:52:16 -07:00
Mirko Liebender
d3b8dbb76c Google gen ai fix for empty chat log messages (#136019) (#140315)
* Google gen ai fix for empty chat log messages (#136019)

* Google gen ai test for empty chat history fields (#136019)
2025-03-23 22:27:35 -07:00
Ivan Lopez Hernandez
6a7fa3769d Add Google Search tool in Google Generative AI (#140772)
* Added Google Search grounding

* Added testing
2025-03-23 22:23:52 -07:00
Allen Porter
f14b76c54b Add Gemini/OpenAI token stats to the conversation trace (#141118)
* Add gemini token status to the conversation trace

* Add OpenAI Token Stats

* Revert input_tokens_details since its not in the openai version yet

* Fix ruff lint errors
2025-03-23 12:03:06 -04:00
Ivan Lopez Hernandez
d9cf2750d5 Ensure file is correctly uploaded by the GenAI SDK (#140969)
Opened the file outside of the SDK
2025-03-19 22:58:19 -07:00
Ivan Lopez Hernandez
2aa584ce39 Correctly retrieve only loaded Google Generative AI config_entries (#139999)
* Correctly retrieve only loaded config_entries

* Ruff
2025-03-06 13:17:33 -08:00
Ivan Lopez Hernandez
8e35783164 Trim the Schema allowed keys to match the Public Gemini API docs. (#139876)
* Trim the Schema allowed types to match the Public API docs, not the SDK types as those do not match

* Testing
2025-03-05 18:34:11 -08:00
Ivan Lopez Hernandez
4e8186491c Fix Gemini Schema validation for #139416 (#139478)
Fixed Schema validation for issue #139477
2025-02-27 19:10:42 -08:00
SLaks
580c6f2684 Allow arbitrary Gemini attachments (#138751)
* Gemini: Allow arbitrary attachments

This lets me use Gemini to extract information from PDFs, HTML, or other files.

* Gemini: Only add deprecation warning when deprecated parameter has a value

* Gemini: Use Files.upload() for both images and other files

This simplifies the code.

Within the Google client, this takes a different codepath (it uploads images as a file instead of re-saving them into inline bytes).  I think that's a feature (it's probably more efficient?).

* Gemini: Deduplicate filenames
2025-02-23 16:11:38 -08:00
Ivan Lopez Hernandez
3160b7baa0 Swap the Gemini SDK to the newly released Unified SDK (#138246)
* Swapped the old GenAI client with the newly realeased one

* Fixed the Generate Content Action, Config Flow loading and code cleanup

* Add a function to mask the issues with Tools which start with Hass

* Fix most tests

* google-genai==1.1.0

* fixes

* Fixed the remaining tests

* Adressed comments

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: tronikos <tronikos@users.noreply.github.com>
2025-02-21 22:41:05 -08:00
Paulus Schoutsen
35416189f2 Remove some unused tests from Google Generative AI (#138249)
* Remove some unused tests from Google Generative AI

* Remove unused snapshots
2025-02-10 18:25:34 -08:00
Paulus Schoutsen
3b871afcc4 Update default Google model to Gemini Flash 2.0 (#137505) 2025-02-05 23:27:13 -05: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
8ab6bec746 Migrate Google Gen AI to ChatSession (#136779)
* Migrate Google Gen AI to ChatSession

* Remove unused method
2025-01-29 10:42:39 -05:00
Joost Lekkerkerker
8db63adc11 Bump ruff to 0.9.1 (#135197) 2025-01-14 11:46:12 +01:00
Denis Shulyaka
a85ccb94e3 LLM Tool parameters check (#123621)
* LLM Tool parameters check

* fix tests
2024-09-08 18:42:51 -07:00
epenet
25d33e96cc Add missing hass type hint in component tests (g) (#124203) 2024-08-19 00:29:26 -07:00
Paulus Schoutsen
aa6f0cd55a Add CONTROL supported feature to Google conversation when API access (#123046)
* Add CONTROL supported feature to Google conversation when API access

* Better function name

* Handle entry update inline

* Reload instead of update
2024-08-02 23:16:30 -07:00
Denis Shulyaka
f6ad018f8f Change enum type to string for Google Generative AI Conversation (#123069) 2024-08-02 23:14:24 -07:00