Commit Graph
71 Commits
Author SHA1 Message Date
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
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
Allen Porter 8d0e998e54 Improve conversation agent tracing to help with eval and data collection (#122542) 2024-07-31 14:38:44 +02:00
Denis Shulyaka 975cfa6457 Fix gemini api format conversion (#122403)
* Fix gemini api format conversion

* add tests

* fix tests

* fix tests

* fix coverage
2024-07-22 17:56:13 -07:00
Denis Shulyaka ac1ad9680b Goofle Generative AI: Fix string format (#122348)
* Ignore format for string tool args

* Add tests
2024-07-21 21:54:31 -07:00
epenet 43e4223a8e Improve type hints in google_generative_ai tests (#121170) 2024-07-04 02:09:34 -07:00
tronikos 8354aa434e Remove a useless line in Google Generative AI test (#120903) 2024-07-01 17:48:39 +02:00
tronikos 5ce54c2174 Replace GoogleAPICallError with GoogleAPIError (#120902) 2024-07-01 17:48:12 +02:00
tronikos d2a457c24f Fix Google Generative AI: 400 Request contains an invalid argument (#120741) 2024-06-28 13:25:55 +02:00
Michael Hansen 1e16afb43b Fix pylint error in Google generative AI tests (#120371)
* Fix pylint error

* Add second fix
2024-06-24 16:03:34 -05:00
Paulus Schoutsen 5c2db162c4 Remove "no API" prompt (#120280) 2024-06-24 08:57:59 +02:00
tronikos ad1f0db5a4 Pass prompt as system_instruction for Gemini 1.5 models (#120147) 2024-06-22 12:35:48 +02:00
Sid 721b2c2ca8 Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
tronikos f605c10f42 Properly handle escaped unicode characters passed to tools in Google Generative AI (#119117) 2024-06-08 09:02:00 +02:00
tronikos f9dff1632e Use ISO format when passing date to LLMs (#118705) 2024-06-03 19:48:50 +02:00
tronikos a4612143e6 Use gemini-1.5-flash-latest in google_generative_ai_conversation.generate_content (#118594) 2024-05-31 21:57:14 -07:00
tronikos 7af469f81e Strip Google AI text responses (#118593)
* Strip Google AI test responses

* strip each part
2024-05-31 21:55:52 -07:00
Paulus Schoutsen f3b20d30ae Add base prompt for LLMs (#118592) 2024-06-01 00:21:37 -04:00
Denis ShulyakaandPaulus Schoutsen bae96e7d36 Add Google Generative AI Conversation system prompt user_name and llm_context variables (#118510)
* Google Generative AI Conversation: Add variables to the system prompt

* User name and llm_context

* test for template variables

* test for template variables

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-05-31 15:28:44 -04:00
Paulus Schoutsen 6dd01dbff7 Rename llm.ToolContext to llm.LLMContext (#118566) 2024-05-31 11:11:24 -04:00
tronikos 272c51fb38 Fix unnecessary single quotes escaping in Google AI (#118522) 2024-05-30 19:56:06 -04:00
tronikos aeee222df4 Default to gemini-1.5-flash-latest in Google Generative AI (#118367)
Default to flash
2024-05-29 08:04:47 -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 0cf574dc42 Update the recommended model for Google Gen AI (#118323) 2024-05-28 21:21:28 -04:00
tronikos 4f7a91828e Mock llm prompts in test_default_prompt for Google Generative AI (#118286) 2024-05-28 00:40:26 -04:00
tronikos 63227f14ed Add diagnostics to Google Generative AI (#118262)
* Add diagnostics for Google Generative AI

* Remove quality scale from manifest

* include options in diagnostics
2024-05-28 00:02:32 -04:00
tronikos 0c245f1976 Fix freezing on HA startup when there are multiple Google Generative AI config entries (#118282)
* Fix freezing on HA startup when there are multiple Google Generative AI config entries

* Add timeout to list_models
2024-05-27 23:49:16 -04:00
tronikos 722feb285b Handle multiple function_call and text parts in Google Generative AI (#118270) 2024-05-27 19:57:03 -04: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
tronikos 0972b29510 Add Google Generative AI reauth flow (#118096)
* Add reauth flow

* address comments
2024-05-26 11:44:48 -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
tronikos 0182bfcc81 Google Generative AI: 100% test coverage for conversation (#118112)
100% coverage for conversation
2024-05-25 07:52:20 -04:00
Paulus Schoutsen 81f3387d06 Flip prompts to put user prompt on top (#118085) 2024-05-25 00:33:24 -04:00
Paulus Schoutsen 69f237fa9e Update Google safety defaults to match Google (#118084) 2024-05-25 00:02:53 -04:00
Paulus Schoutsen c59d4f9bba Add no-API LLM prompt back to Google (#118082)
* Add no-API LLM prompt back

* Use string join
2024-05-25 00:00:04 -04:00
Paulus Schoutsen 86a24cc3b9 Fix default Google AI prompt on initial setup (#118078) 2024-05-24 23:55:11 -04:00
tronikos 620487fe75 Add Google Generative AI safety settings (#117679)
* Add safety settings

* snapshot-update

* DROPDOWN

* fix test

* rename const

* Update const.py

* Update strings.json
2024-05-24 21:48:39 -04:00