Metadata-Version: 2.4
Name: tg-jarv-dialogue-manager
Version: 0.1.8
Summary: Jarv AI клиент и диалог-менеджер для Telegram с хранением истории в ClickHouse
Author: Александр Гаганов
License: MIT License
        
        Copyright (c) 2025 Aleksandr Gaganov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://pypi.org/project/tg-jarv-dialogue-manager/
Project-URL: Repository, https://github.com/GaganovAlexander/tg-jarv-dialogue-manager
Project-URL: Issues, https://github.com/GaganovAlexander/tg-jarv-dialogue-manager/issues
Keywords: jarv,telegram,clickhouse,dialogue,chat,asyncio,httpx
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1.0,>=0.24
Provides-Extra: telegram
Requires-Dist: python-telegram-bot>=21; extra == "telegram"
Dynamic: license-file

# tg-jarv-dialogue-manager

Асинхронный клиент Jarv AI и диалог-менеджер с хранением истории в ClickHouse.

## Установка

```bash
pip install tg-jarv-dialogue-manager
```

Опционально для Telegram:
```bash
pip install "tg-jarv-dialogue-manager[telegram]"
```

## Быстрый старт

```python
import asyncio
from tg_jarv_dialogue_manager import JarvDialogueManager

async def main():
    dm = JarvDialogueManager(
        bot_name="DiscountBot",
        model="gpt-4o-mini",
        user_id="bot@synergetic",
        jarv_api_key="...",
        jarv_endpoint="https://api.jarv.tech/v1/chat",
        clickhouse_url="http://localhost:8123",
        clickhouse_database="jarv",
        clickhouse_user=None,
        clickhouse_password=None,
        table="dialogue_history",
        pairs_limit=10,
        char_soft_limit=2000,
        payload_base={"profect_id": "12abcd3e-4f5g-1111-aaaa-1111abc22de3"},
    )
    answer = await dm.ask(tg_id=123456789, user_text="Привет!")
    print(answer)
    await dm.close()

asyncio.run(main())
```

## Схема ClickHouse по умолчанию

```sql
CREATE TABLE IF NOT EXISTS dialogue_history (
  tg_id UInt64,
  bot_name String,
  seq_in_dialogue UInt32,
  role LowCardinality(String),
  content String,
  created_at DateTime DEFAULT now()
) ENGINE = MergeTree
ORDER BY (tg_id, bot_name, seq_in_dialogue)
TTL created_at + INTERVAL 14 DAY;
```

## Поддержка

Issues и PR приветствуются.
