enrobie.plugins.logger package#

Subpackages#

Submodules#

enrobie.plugins.logger.history module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enrobie.plugins.logger.history.LoggerHistory(plugin: LoggerPlugin)[source]#

Bases: object

Store the historical information for chat interactions.

Parameters:

plugin – Plugin class instance for Chatting Robie.

expunge(client: str, kind: str, anchor: str) None[source]#

Remove the expired historical chat interaction records.

Parameters:
  • client – Unique identifier for the client object.

  • kind – What kind of Robie message we dealing with.

  • anchor – Unique identifier for the chat context.

insert(*, client: str, person: str | None, kind: str, author: str, anchor: str, message: str) None[source]#

Insert the record into the historical chat interactions.

plaintext(limit: int | None = None, mitem: RobieMessage | None = None, *, client: str | None = None, person: str | None = None, kind: str | None = None, author: str | None = None, anchor: str | None = None) list[str][source]#

Return the historical records for the chat interactions.

Note

Additional keyword arguments ignored when mitem.

Parameters:
  • limit – Optionally restrict the records returned.

  • mitem – Item containing information for operation.

Returns:

Historical records for the chat interactions.

process(mitem: RobieMessage) None[source]#

Insert the record into the historical chat interactions.

Parameters:

mitem – Item containing information for operation.

records(mitem: RobieMessage, limit: int | None = None) list[LoggerHistoryRecord][source]#

Return the historical records for the chat interactions.

Parameters:
  • mitem – Item containing information for operation.

  • limit – Optionally restrict the records returned.

Returns:

Historical records for the chat interactions.

search(limit: int | None = None, *, client: str | None = None, person: str | None = None, kind: str | None = None, author: str | None = None, anchor: str | None = None) list[LoggerHistoryRecord][source]#

Return the historical records for the chat interactions.

Parameters:

limit – Optionally restrict the records returned.

Returns:

Historical records for the chat interactions.

pydantic model enrobie.plugins.logger.history.LoggerHistoryRecord[source]#

Bases: BaseModel

Contain the information regarding the chatting history.

Parameters:
  • record – Record from the SQLAlchemy query routine.

  • kwargs – Keyword arguments passed for downstream.

Show JSON schema
{
   "title": "LoggerHistoryRecord",
   "description": "Contain the information regarding the chatting history.\n\n:param record: Record from the SQLAlchemy query routine.\n:param kwargs: Keyword arguments passed for downstream.",
   "type": "object",
   "properties": {
      "plugin": {
         "description": "Plugin name where originated",
         "minLength": 1,
         "title": "Plugin",
         "type": "string"
      },
      "client": {
         "description": "Client name where originated",
         "minLength": 1,
         "title": "Client",
         "type": "string"
      },
      "person": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Person that author is matched",
         "title": "Person"
      },
      "kind": {
         "description": "What kind of original message",
         "enum": [
            "privmsg",
            "chanmsg"
         ],
         "minLength": 1,
         "title": "Kind",
         "type": "string"
      },
      "author": {
         "description": "Nickname of message author",
         "minLength": 1,
         "title": "Author",
         "type": "string"
      },
      "anchor": {
         "default": null,
         "description": "Channel or private context",
         "minLength": 1,
         "title": "Anchor",
         "type": "string"
      },
      "message": {
         "description": "Historical interaction content",
         "title": "Message",
         "type": "string"
      },
      "create": {
         "description": "When the record was created",
         "maxLength": 32,
         "minLength": 20,
         "title": "Create",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "plugin",
      "client",
      "kind",
      "author",
      "message",
      "create"
   ]
}

Config:
  • extra: str = forbid

Fields:
field anchor: Annotated[str, FieldInfo(annotation=NoneType, required=False, default=None, description='Channel or private context', metadata=[MinLen(min_length=1)])] = None#

Channel or private context

Constraints:
  • min_length = 1

field author: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Nickname of message author', metadata=[MinLen(min_length=1)])] [Required]#

Nickname of message author

Constraints:
  • min_length = 1

field client: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Client name where originated', metadata=[MinLen(min_length=1)])] [Required]#

Client name where originated

Constraints:
  • min_length = 1

field create: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='When the record was created', metadata=[MinLen(min_length=20), MaxLen(max_length=32)])] [Required]#

When the record was created

Constraints:
  • min_length = 20

  • max_length = 32

field kind: Annotated[Literal['privmsg', 'chanmsg'], FieldInfo(annotation=NoneType, required=True, description='What kind of original message', metadata=[MinLen(min_length=1)])] [Required]#

What kind of original message

Constraints:
  • min_length = 1

field message: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Historical interaction content')] [Required]#

Historical interaction content

field person: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Person that author is matched', metadata=[MinLen(min_length=1)])] = None#

Person that author is matched

Constraints:
  • min_length = 1

field plugin: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Plugin name where originated', metadata=[MinLen(min_length=1)])] [Required]#

Plugin name where originated

Constraints:
  • min_length = 1

class enrobie.plugins.logger.history.LoggerHistoryTable(**kwargs)[source]#

Bases: SQLBase

Schematic for the database operations using SQLAlchemy.

Note

Fields are not completely documented for this model.

anchor#
author#
client#
create#
kind#
message#
person#
plugin#
class enrobie.plugins.logger.history.SQLBase(**kwargs: Any)[source]#

Bases: DeclarativeBase

Some additional class that SQLAlchemy requires to work.

metadata: ClassVar[MetaData] = MetaData()#

Refers to the _schema.MetaData collection that will be used for new _schema.Table objects.

registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>#

Refers to the _orm.registry in use where new _orm.Mapper objects will be associated.

enrobie.plugins.logger.params module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

pydantic model enrobie.plugins.logger.params.LoggerPluginParams[source]#

Bases: RobiePluginParams

Process and validate the Robie configuration parameters.

Show JSON schema
{
   "title": "LoggerPluginParams",
   "description": "Process and validate the Robie configuration parameters.",
   "type": "object",
   "properties": {
      "enable": {
         "default": false,
         "description": "Determine whether child enabled",
         "title": "Enable",
         "type": "boolean"
      },
      "locate": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "For which plugin are parameters",
         "examples": [
            "enrobie.plugins.AinswerPlugin",
            "enrobie.plugins.AutoJoinPlugin",
            "enrobie.plugins.AutoNickPlugin",
            "enrobie.plugins.StatusPlugin"
         ],
         "title": "Locate"
      },
      "trusted": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "minItems": 1,
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Users are trusted by the plugin",
         "title": "Trusted"
      },
      "database": {
         "default": "sqlite:///:memory:",
         "description": "Database connection string",
         "minLength": 1,
         "title": "Database",
         "type": "string"
      },
      "histories": {
         "default": 100,
         "description": "Number of messages per anchor",
         "maximum": 10000,
         "minimum": 1,
         "title": "Histories",
         "type": "integer"
      },
      "clients": {
         "description": "List of clients to enable plugin",
         "items": {
            "type": "string"
         },
         "minItems": 1,
         "title": "Clients",
         "type": "array"
      },
      "output": {
         "anyOf": [
            {
               "minLength": 4,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional path where logs append",
         "title": "Output"
      },
      "status": {
         "$ref": "#/$defs/StatusPluginIconParams",
         "description": "Icon used per chat platform"
      }
   },
   "$defs": {
      "StatusPluginIconParams": {
         "additionalProperties": false,
         "description": "Contain information for constructing the chat messages.",
         "properties": {
            "irc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Irc"
            },
            "dsc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Dsc"
            },
            "mtm": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Mtm"
            }
         },
         "title": "StatusPluginIconParams",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "clients"
   ]
}

Config:
  • extra: str = forbid

Fields:
field clients: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, description='List of clients to enable plugin', metadata=[MinLen(min_length=1)])] [Required]#

List of clients to enable plugin

Constraints:
  • min_length = 1

field database: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='sqlite:///:memory:', description='Database connection string', metadata=[MinLen(min_length=1)])] = 'sqlite:///:memory:'#

Database connection string

Constraints:
  • min_length = 1

field enable: Annotated[bool, Field(False, description='Determine whether child enabled')] = False#

Determine whether child enabled

field histories: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=100, description='Number of messages per anchor', metadata=[Ge(ge=1), Le(le=10000)])] = 100#

Number of messages per anchor

Constraints:
  • ge = 1

  • le = 10000

field locate: Annotated[str | None, Field(None, description='For which plugin are parameters', examples=['enrobie.plugins.AinswerPlugin', 'enrobie.plugins.AutoJoinPlugin', 'enrobie.plugins.AutoNickPlugin', 'enrobie.plugins.StatusPlugin'], min_length=1)] = None#

For which plugin are parameters

Constraints:
  • min_length = 1

field output: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Optional path where logs append', metadata=[MinLen(min_length=4)])] = None#

Optional path where logs append

Constraints:
  • min_length = 4

field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#

Icon used per chat platform

field trusted: Annotated[list[str] | None, Field(None, description='Users are trusted by the plugin', min_length=1)] = None#

Users are trusted by the plugin

Constraints:
  • min_length = 1

enrobie.plugins.logger.plugin module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enrobie.plugins.logger.plugin.LoggerPlugin(robie: Robie, name: str, params: RobieChildParams)[source]#

Bases: RobiePlugin

Integrate with the Robie routine and perform operations.

Note

This plugin allows for interacting with an LLM model.

property history: LoggerHistory#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

operate() None[source]#

Perform the operation related to Robie service threads.

property params: LoggerPluginParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

classmethod schema() Type[LoggerPluginParams][source]#

Return the configuration parameters relevant for class.

Returns:

Configuration parameters relevant for class.

validate() None[source]#

Perform advanced validation on the parameters provided.

Module contents#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enrobie.plugins.logger.LoggerPlugin(robie: Robie, name: str, params: RobieChildParams)[source]#

Bases: RobiePlugin

Integrate with the Robie routine and perform operations.

Note

This plugin allows for interacting with an LLM model.

property history: LoggerHistory#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

operate() None[source]#

Perform the operation related to Robie service threads.

property params: LoggerPluginParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

classmethod schema() Type[LoggerPluginParams][source]#

Return the configuration parameters relevant for class.

Returns:

Configuration parameters relevant for class.

validate() None[source]#

Perform advanced validation on the parameters provided.

pydantic model enrobie.plugins.logger.LoggerPluginParams[source]#

Bases: RobiePluginParams

Process and validate the Robie configuration parameters.

Show JSON schema
{
   "title": "LoggerPluginParams",
   "description": "Process and validate the Robie configuration parameters.",
   "type": "object",
   "properties": {
      "enable": {
         "default": false,
         "description": "Determine whether child enabled",
         "title": "Enable",
         "type": "boolean"
      },
      "locate": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "For which plugin are parameters",
         "examples": [
            "enrobie.plugins.AinswerPlugin",
            "enrobie.plugins.AutoJoinPlugin",
            "enrobie.plugins.AutoNickPlugin",
            "enrobie.plugins.StatusPlugin"
         ],
         "title": "Locate"
      },
      "trusted": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "minItems": 1,
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Users are trusted by the plugin",
         "title": "Trusted"
      },
      "database": {
         "default": "sqlite:///:memory:",
         "description": "Database connection string",
         "minLength": 1,
         "title": "Database",
         "type": "string"
      },
      "histories": {
         "default": 100,
         "description": "Number of messages per anchor",
         "maximum": 10000,
         "minimum": 1,
         "title": "Histories",
         "type": "integer"
      },
      "clients": {
         "description": "List of clients to enable plugin",
         "items": {
            "type": "string"
         },
         "minItems": 1,
         "title": "Clients",
         "type": "array"
      },
      "output": {
         "anyOf": [
            {
               "minLength": 4,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional path where logs append",
         "title": "Output"
      },
      "status": {
         "$ref": "#/$defs/StatusPluginIconParams",
         "description": "Icon used per chat platform"
      }
   },
   "$defs": {
      "StatusPluginIconParams": {
         "additionalProperties": false,
         "description": "Contain information for constructing the chat messages.",
         "properties": {
            "irc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Irc"
            },
            "dsc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Dsc"
            },
            "mtm": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Mtm"
            }
         },
         "title": "StatusPluginIconParams",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "clients"
   ]
}

Config:
  • extra: str = forbid

Fields:
field clients: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, description='List of clients to enable plugin', metadata=[MinLen(min_length=1)])] [Required]#

List of clients to enable plugin

Constraints:
  • min_length = 1

field database: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='sqlite:///:memory:', description='Database connection string', metadata=[MinLen(min_length=1)])] = 'sqlite:///:memory:'#

Database connection string

Constraints:
  • min_length = 1

field enable: Annotated[bool, Field(False, description='Determine whether child enabled')] = False#

Determine whether child enabled

field histories: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=100, description='Number of messages per anchor', metadata=[Ge(ge=1), Le(le=10000)])] = 100#

Number of messages per anchor

Constraints:
  • ge = 1

  • le = 10000

field locate: Annotated[str | None, Field(None, description='For which plugin are parameters', examples=['enrobie.plugins.AinswerPlugin', 'enrobie.plugins.AutoJoinPlugin', 'enrobie.plugins.AutoNickPlugin', 'enrobie.plugins.StatusPlugin'], min_length=1)] = None#

For which plugin are parameters

Constraints:
  • min_length = 1

field output: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Optional path where logs append', metadata=[MinLen(min_length=4)])] = None#

Optional path where logs append

Constraints:
  • min_length = 4

field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#

Icon used per chat platform

field trusted: Annotated[list[str] | None, Field(None, description='Users are trusted by the plugin', min_length=1)] = None#

Users are trusted by the plugin

Constraints:
  • min_length = 1