Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d2659d0
Update README.md
gritaro Feb 13, 2024
c434390
Added gitignore
gritaro Feb 13, 2024
bf8ea46
Cleanup code and fix requirements versions
gritaro Feb 13, 2024
84f92b4
Fix broken release 0.1.0
gritaro Feb 13, 2024
df6197a
Add support for multiple LLM engines
gritaro Feb 13, 2024
511cdbd
Merge pull request #1 from gritaro/rc-0.1.2
gritaro Feb 14, 2024
65b044c
Bump version to 0.1.2
gritaro Feb 14, 2024
1b4ceef
Merge pull request #2 from gritaro/bump-manifest-version
gritaro Feb 14, 2024
da89b50
- Add support for completion models configuration
gritaro Feb 14, 2024
96582f6
Merge pull request #3 from gritaro/rc-0.1.3
gritaro Feb 16, 2024
378d51f
Bump version
gritaro Feb 16, 2024
8976efe
Merge pull request #4 from gritaro/rc-0.1.3-bump
gritaro Feb 16, 2024
6653779
Add support for choosing models
gritaro Feb 18, 2024
f1edeb0
Merge pull request #5 from gritaro/rc-0.1.4
gritaro Feb 18, 2024
44c42b8
Enhance github actions files
gritaro Feb 20, 2024
1d33534
Merge pull request #7 from gritaro/github-actions-enh
gritaro Feb 20, 2024
c50d09f
Support inbuilt functionality for controlling home-assistant (#6)
gritaro Feb 20, 2024
75a5c78
Support Anyscale LLM (#8)
gritaro Feb 21, 2024
2f23407
Correct
gritaro Feb 23, 2024
c6a2ea1
0.1.7 HA compatibility fix (#9)
gritaro May 16, 2024
95cdc20
Fix compatibility with HA 2024.12.1+ (#12)
gritaro Jan 12, 2025
38da792
Update README.md
gritaro Jan 12, 2025
a7bc725
Update README-ru.md
gritaro Jan 12, 2025
005f95d
feat: migrate to ConversationEntity, add tests, changelog and docs
dzerik Mar 10, 2026
9d8cc00
feat: ChatLog для истории, миграция на langchain-gigachat/langchain-o…
dzerik Mar 10, 2026
4610f4c
feat: streaming ответов LLM через async_add_delta_content_stream
dzerik Mar 10, 2026
7cdb61c
feat: rename GigaChain -> SmartChain + add AI Task entity (v0.7.0)
dzerik Mar 10, 2026
b52e915
docs: add CLAUDE.md project rules
dzerik Mar 10, 2026
917ddec
feat: register AI Task platform + add 7 AI Task tests + lint fixes (v…
dzerik Mar 10, 2026
2f894cd
docs: update all documentation for SmartChain rename
dzerik Mar 10, 2026
51c3a4e
build: migrate to uv + pyproject.toml
dzerik Mar 10, 2026
b8100df
fix: make ai_task optional, fix dependency resolution (v0.8.0)
dzerik Mar 10, 2026
63eab1f
feat: add Ollama, DeepSeek, Anthropic providers (v0.8.0)
dzerik Mar 10, 2026
f91f14c
docs: update all documentation for v0.8.0
dzerik Mar 10, 2026
37a0ce5
docs: update CLAUDE.md project rules for v0.8.0
dzerik Mar 10, 2026
8eaede1
fix: pin gigachat>=0.2.0 for Python 3.14 compatibility (v0.8.1)
dzerik Mar 10, 2026
a18e50a
chore: add secrets/ to gitignore, update uv.lock
dzerik Mar 10, 2026
b3ec31e
docs: add critical workflow rules and SOLID/DRY/KISS/YAGNI to CLAUDE.md
dzerik Mar 10, 2026
8a8f6a9
test: add Options Flow tests + fix OptionsFlow init for modern HA
dzerik Mar 10, 2026
99240c2
test: add E2E tool calling loop test
dzerik Mar 10, 2026
120404a
feat: v0.9 sub-entries — multiple agents per provider
dzerik Mar 10, 2026
2a1ea53
test: add 8 sub-entries tests
dzerik Mar 10, 2026
e732312
docs: update TODO, CHANGELOG, ROADMAP, README for v0.9.0
dzerik Mar 10, 2026
9657dd7
build(deps-dev): Update langchain-openai requirement
dependabot[bot] Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @gritaro
17 changes: 17 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
36 changes: 36 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
name: ha-smartchain
description: "SmartChain — multi-provider LLM conversation agent for Home Assistant (GigaChat, YandexGPT, OpenAI) with tool calling and streaming"
homepage: https://github.com/gritaro/ha-smartchain
topics: homeassistant, hacs-integration, voice-assistant, langchain, gigachat, yandexgpt, openai, llm, smart-home, ai-agent
private: false
has_issues: true
has_projects: false
has_wiki: false
default_branch: main
allow_squash_merge: true
use_squash_pr_title_as_default: true
allow_merge_commit: false
allow_rebase_merge: true
delete_branch_on_merge: true
enable_vulnerability_alerts: true

labels:
- name: "Feature Request"
color: "00ffbb"
- name: "Bug"
color: "e30000"
- name: "Wont Fix"
color: "ffffff"
- name: "Enhancement"
color: "48ff00"
- name: "Documentation"
color: "0077ff"
- name: "Help needed"
color: "fbca04"
- name: "dependencies"
color: "000000"
- name: "github_actions"
color: "000000"
21 changes: 21 additions & 0 deletions .github/workflows/cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Cron HACS actions

on:
schedule:
- cron: "0 0 * * *"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v4"

- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
17 changes: 0 additions & 17 deletions .github/workflows/hacs.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/hassfest.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Pull actions

on:
pull_request:

env:
PYTHON_VERSION: "3.12"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v4"

- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

lint:
runs-on: "ubuntu-latest"
name: Lint with ruff
steps:
- uses: "actions/checkout@v4"
- uses: "astral-sh/setup-uv@v5"
- run: uv run ruff check .
- run: uv run ruff format --check .

test:
runs-on: "ubuntu-latest"
name: Run tests
steps:
- uses: "actions/checkout@v4"
- uses: "astral-sh/setup-uv@v5"
- run: uv sync
- run: uv run pytest tests/ -v
44 changes: 44 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Push actions

on:
push:
branches:
- main
- rc-*

env:
PYTHON_VERSION: "3.12"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v4"

- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

lint:
runs-on: "ubuntu-latest"
name: Lint with ruff
steps:
- uses: "actions/checkout@v4"
- uses: "astral-sh/setup-uv@v5"
- run: uv run ruff check .
- run: uv run ruff format --check .

test:
runs-on: "ubuntu-latest"
name: Run tests
steps:
- uses: "actions/checkout@v4"
- uses: "astral-sh/setup-uv@v5"
- run: uv sync
- run: uv run pytest tests/ -v
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__pycache__
.idea
/shelf/
/workspace.xml
/httpRequests/
/dataSources/
/dataSources.local.xml
*.iws
*.iml
*.ipr
/.mcp.json
/.serena/
.pytest_cache
/secrets/
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
hooks:
- id: ruff
- id: ruff-format
115 changes: 115 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Changelog

All notable changes to this project are documented in this file.

Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
project follows [Semantic Versioning](https://semver.org/).

## [0.9.0] - 2026-03-10

### Added
- **Sub-entries** — multiple conversation agents per provider via `ConfigSubentryFlow`. Each sub-entry has its own model, prompt, temperature, LLM API, and creates independent ConversationEntity + AITaskEntity
- `ConversationSubentryFlow` with `async_step_user()` and `async_step_reconfigure()` for adding/editing agents
- `async_get_supported_subentry_types()` on ConfigFlow returns `{"conversation": ConversationSubentryFlow}`
- Backward compatible: entries without sub-entries continue working in legacy mode (single agent from `entry.options`)
- **Options Flow tests** — 7 new tests covering form display, model validation, GigaChat-specific fields, LLM API handling
- **E2E tool calling loop test** — full simulation: user request → tool_call → tool execution → final response
- **Sub-entries tests** — 8 tests covering subentry flow, setup with subentries, multiple agents, legacy fallback

### Changed
- `conversation.py` — `SmartChainConversationEntity` now accepts `subentry_id` and `options` params; uses `_agent_options` and `_client` properties
- `ai_task.py` — `SmartChainAITaskEntity` now accepts `subentry_id`; uses `_client` property
- `__init__.py` — `async_setup_entry` creates per-subentry clients dict or single legacy client
- `config_flow.py` — renamed `common_config_option_schema()` → `_subentry_schema()` (backward-compatible alias kept)
- `OptionsFlow` — removed `__init__` (config_entry is read-only property in modern HA)
- Total: 67 tests passing

### Fixed
- `OptionsFlow.__init__` — removed setter for `self.config_entry` (read-only property in HA 2025+)

## [0.8.0] - 2026-03-10

### Added
- **Ollama provider** — local models (Llama 3.3, Qwen3, Gemma 3, T-Pro 2, T-Lite, DeepSeek R1, Phi 4, Home-3B). Config: base_url only, no API key needed
- **DeepSeek provider** — cheapest cloud LLM (deepseek-chat, deepseek-reasoner). Uses ChatOpenAI with DeepSeek base URL
- **Anthropic provider** — Claude models (claude-sonnet-4-6, claude-haiku-4-5, claude-opus-4-6) via ChatAnthropic

### Changed
- **ai_task made optional** — no longer in manifest.json dependencies, detected dynamically. Fixes hang on HA versions without ai_task support
- Config Flow extended with `async_step_ollama`, `async_step_deepseek`, `async_step_anthropic`
- `client_util.py` — new client factories for Ollama (ChatOllama), DeepSeek (ChatOpenAI), Anthropic (ChatAnthropic)
- `manifest.json` — added `langchain-anthropic`, `langchain-ollama` to requirements
- `pyproject.toml` — migrated to `requires-python>=3.13`, added all langchain dev deps

### Fixed
- ResponseError test updated for new gigachat API signature
- Dependency resolution: pinned langchain packages to compatible ranges (core<1)

## [0.7.0] - 2026-03-10

### Changed
- **Project renamed: GigaChain -> SmartChain** — reflects multi-provider nature (not GigaChat-only)
- Domain: `gigachain` -> `smartchain`
- Entity classes: `GigaChainConversationEntity` -> `SmartChainConversationEntity`
- New GitHub repository: `ha-smartchain`
- HACS name: SmartChain
- Version bumped to 0.7.0

### Added
- **AI Task entity** — `SmartChainAITaskEntity` implements `ai_task.AITaskEntity` with `_async_generate_data()` for automation-driven text generation via `ai_task.generate_data` service
- Structured output support in AI Task (JSON parsing with `task.structure`)
- Tool calling support in AI Task (reuses conversation entity's LangChain integration)

## [0.6.0] - 2026-03-10

### Added
- **Assist API for device control** — integration with HA LLM API (`async_provide_llm_data`) allows LLM to call Home Assistant services (turn on/off lights, locks, etc.)
- `llm_hass_api` option in Options Flow — select HA API for LLM (Assist, custom APIs)
- HA `llm.Tool` (voluptuous schema) -> LangChain tools conversion via `voluptuous_openapi` + `client.bind_tools()`
- Tool calling loop with `MAX_TOOL_ITERATIONS = 10`
- `tool_calls` in `AIMessageChunk` -> HA `ToolInput` in stream deltas
- `ToolResultContent` <-> LangChain `ToolMessage` conversion in `_chatlog_to_langchain()`

### Changed
- `_async_handle_message` — uses `async_provide_llm_data` when LLM API configured, manual prompt otherwise
- Options Flow: `common_config_option_schema` takes `hass` to list available LLM APIs

## [0.5.0] - 2026-03-10

### Added
- **Streaming responses** — `_attr_supports_streaming = True`, responses streamed via `ChatLog.async_add_delta_content_stream()`
- Async generator `_async_langchain_stream()` for `AIMessageChunk` -> HA delta dicts

### Changed
- `client.invoke()` via `async_add_executor_job` replaced with `client.astream()` (async, no executor)

## [0.4.0] - 2026-03-10

### Changed
- **ChatLog for history** — removed custom `OrderedDict`, uses native HA `ChatLog`
- **Migration to langchain-gigachat/langchain-openai** — proper package imports

## [0.3.0] - 2026-03-10

### Added
- **Migration to ConversationEntity** — entity-based conversation agent with `_async_handle_message(user_input, chat_log)`

## [0.2.0] - 2026-03-10

### Fixed
- Blocking LLM calls, deprecated LangChain API, memory leaks, model defaults

### Removed
- Anyscale support completely removed

## [0.1.8] - 2024-12-01

### Fixed
- Compatibility with Home Assistant 2024.12.1+

## [0.1.1] - 2024-03-01

### Added
- Initial release with GigaChat, YandexGPT support
- Config Flow and Options Flow
- Chat history and Jinja2 system prompts
Loading
Loading