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",
        system_prompt="Ты — дружелюбный помощник.",
        pairs_limit=10,
        char_soft_limit=8000,
        payload_base={"temperature": 0.2},
    )
    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);

Поддержка

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.4.tar.gz (7.5 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.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for tg_jarv_dialogue_manager-0.1.4.tar.gz
Algorithm Hash digest
SHA256 678d8b3e705e1b1b3d28a1b6132d80b45ab73e517e5b5196f4b354a3facbce12
MD5 510ad87cddb6309ef6f6501e74271e97
BLAKE2b-256 dc84b970425d29344c9d2ff3a5a07819a078731ee5ce1369cad109690cd68bd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tg_jarv_dialogue_manager-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 51111480fc769f1af944496989f92b6dde0ca853a1d553bceb1318ba6d443f86
MD5 252f382f88a5c14f9a2dbd8d4d198c41
BLAKE2b-256 83f386ede7c8129c3ac2eae61485e87d1aaab882675ce0f57f3061ab4e61cbbf

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