Skip to main content

Jarv AI клиент и диалог-менеджер для Telegram с хранением истории в ClickHouse

Project description

tg-jarv-dialogue-manager

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

Установка

pip install tg-jarv-dialogue-manager

Опционально для Telegram:

pip install "tg-jarv-dialogue-manager[telegram]"

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

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 по умолчанию

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 приветствуются.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tg_jarv_dialogue_manager-0.1.8.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tg_jarv_dialogue_manager-0.1.8-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file tg_jarv_dialogue_manager-0.1.8.tar.gz.

File metadata

File hashes

Hashes for tg_jarv_dialogue_manager-0.1.8.tar.gz
Algorithm Hash digest
SHA256 98a1f1ad2fa90443bb6484d9cda3c2b99efb979c50501634041815ac637e807c
MD5 cf19ccb4c1386f5d0144159b1ab5f46f
BLAKE2b-256 7747953851885d342421ce1971445b181a9d9e8cbed8274d0c248aa65bfcb58b

See more details on using hashes here.

File details

Details for the file tg_jarv_dialogue_manager-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for tg_jarv_dialogue_manager-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 29a5a43f302d5a6dea30ae2c1272bcdd5b1529ac311a1ed57dfdc3d635e55252
MD5 db53c1abd00c9c8fab4b2a93d08fc19d
BLAKE2b-256 b8c69d8799a4547435e50f9bacbdd870d8fcf55cefda80d8564fea79d51e51fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page