Base

Base module to track all the abstract classes for the history module.

class BaseHistoryPlugin(config)[source]

Abstract base class for history

Constructor of the class.

Parameters:

config (Config) – Instance of config.

_abc_impl = <_abc._abc_data object>
abstract clear(user_id)[source]

Abstract method to represent a clear operation

Return type:

None

Parameters:

user_id (str) – The user’s identifier

abstract clear_from_chat(user_id, from_chat)[source]

Abstract method to represent a clear from chat operation

Return type:

None

Parameters:
  • user_id (str) – The user’s identifier

  • from_chat (str) – The chat name

abstract read(user_id)[source]

Abstract method to represent a read operation

Return type:

list[HistoryModel]

Parameters:

user_id (str) – The user’s identifier

Returns:

Should return an instance of History schema.

Return type:

list[HistoryModel]

abstract read_from_chat(user_id, from_chat)[source]

Abstract method to represent a read operation from a specific chat

Return type:

Optional[HistoryModel]

Parameters:
  • user_id (str) – The user’s identifier

  • from_chat (str) – The chat name

Returns:

An optional single history entry

Return type:

Optional[HistoryModel]

abstract write(chat_id, user_id, query, response)[source]

Abstract method to represent a write operation

Return type:

None

Parameters:
  • chat_id (str) – The chat identifier

  • user_id (str) – The user’s identifier

  • query (str) – The user question

  • response (str) – The LLM response