Docs /Templates/ sinapsis-chat-history

ChatHistorySave

sinapsis-chat-historyChat Historychatbotschat_historycontext

Python template · sinapsis_chat_history.templates.chat_history_save

Overview

Template for saving chat messages into a storage backend.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-chat-history==1.0.0
uv pip install sinapsis-chat-history==1.0.0
uv add sinapsis-chat-history==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
provider
typing.Literal['postgres', 'sqlite', 'supabase']
Optional
Default: "sqlite"
db_config
dict[str, typing.Any]
Optional
Default: null
save_args

Save-time options for message persistence.

ChatHistorySaveArgs
Optional
Default: null
include_packet_metadata

Whether packet-level metadata such as provider info, usage, performance, and termination should be merged into the stored message metadata.

bool
Optional
Default: false

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: ChatHistorySave
  class_name: ChatHistorySave
  template_input: InputTemplate
  attributes:
    provider: sqlite
    db_config:
      db_path: "chat_history.sqlite3"
      table: "chat"
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "ChatHistorySave"
    class_name: "ChatHistorySave"
    attributes:
      provider: "sqlite"
      db_config: null
      save_args:
        include_packet_metadata: false

Inheritance

Immediate parent: sinapsis_chat_history.templates.chat_history_base.ChatHistoryBase

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.