Skip to main content

Sinapsis templates for chat history management.

Project description



Sinapsis Chat History

Sinapsis templates for persistent chat history in chatbot workflows.

🐍 Installation🚀 Features📚 Usage example📙 Documentation🔍 License

The sinapsis-chat-history package provides templates for fetching, saving, deleting, and resetting persistent chat history associated with LLMConversationPacket conversations. It supports SQLite by default, plus optional PostgreSQL-compatible backends such as PostgreSQL and Supabase through the postgres extra.

🐍 Installation

Install using your preferred package manager. We strongly recommend using uv.

Install the base package:

uv pip install sinapsis-chat-history --extra-index-url https://pypi.sinapsis.tech

Or with raw pip:

pip install sinapsis-chat-history --extra-index-url https://pypi.sinapsis.tech

[!IMPORTANT] The base installation includes the sqlite provider. PostgreSQL and Supabase require the optional postgres extra:

uv pip install sinapsis-chat-history[postgres] --extra-index-url https://pypi.sinapsis.tech

all installs every optional dependency exposed by the package:

uv pip install sinapsis-chat-history[all] --extra-index-url https://pypi.sinapsis.tech

🚀 Features

Templates Supported

  • ChatHistoryFetch: Loads stored messages into LLMConversationPacket.messages.
  • ChatHistorySave: Persists packet messages to the configured history backend.
  • ChatHistoryDelete: Deletes stored messages using explicit user/session scopes.
  • ChatHistoryReset: Clears the configured history table or storage scope.

Providers Supported

  • sqlite: Default provider for local development and lightweight deployments.
  • postgres: Shared relational backend for multi-user or concurrent workloads.
  • supabase: PostgreSQL-compatible backend reachable through the Supabase database connection.
🧩 Common Attributes
  • provider ("sqlite" | "postgres" | "supabase", optional): Storage backend to use. Defaults to sqlite.
  • db_config (dict, optional): Provider-specific configuration.
    • sqlite: use db_path and optionally table.
    • postgres / supabase: use user, password, host, port, db_name, sslmode, and optionally table.

[!TIP] Use CLI command sinapsis info --all-template-names to show a list with all the available Template names installed with Sinapsis Chat History.

📚 Usage example

The following agent fetches stored chat history for the given user_id and session_id into LLMConversationPacket.messages.

Config
agent:
  name: chat_history_fetch_messages
  description: Fetches stored chat history into the conversation packet messages.

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: LLMConversationInput
    class_name: LLMConversationInput
    template_input: InputTemplate
    attributes:
      prompt: I'm thinking about taking Barnaby for a run, do you think I'm ready given my training?
      user_id: Sarah
      session_id: conv_1234

  - template_name: ChatHistoryFetch
    class_name: ChatHistoryFetch
    template_input: LLMConversationInput
    attributes:
      provider: sqlite
      db_config:
        db_path: "chat_history.sqlite3"
        table: "chat"
      fetch_args:
        limit: 10
        offset: 0
        order: asc
        order_by: created_at

📙 Documentation

Documentation for this and other sinapsis packages is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

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

sinapsis_chat_history-0.2.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

sinapsis_chat_history-0.2.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_chat_history-0.2.0.tar.gz.

File metadata

File hashes

Hashes for sinapsis_chat_history-0.2.0.tar.gz
Algorithm Hash digest
SHA256 130464781fd53091c51b44d0de6e8adb97b1fe63486a92e9a990aa289d01d2fc
MD5 5402bb346acdbd8202e8a8ab4e0b150e
BLAKE2b-256 2e2fec94e36abf58d2a26d69052251d55a764f63a49794045d0a324acb7dc23f

See more details on using hashes here.

File details

Details for the file sinapsis_chat_history-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_chat_history-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf0471549fdc0652abfe837e429006a3c5badb63ee9bbef85c00a9ddbb222215
MD5 4beaffd50021b79b0980dc1ff36438f7
BLAKE2b-256 f99a21315dd1d69bfc98d378303d6655a4d46b89cf749001690266207efe23d5

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