enrobie.plugins.ainswer package#
Subpackages#
- enrobie.plugins.ainswer.test package
Submodules#
enrobie.plugins.ainswer.ainswer 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.
- async enrobie.plugins.ainswer.ainswer.ainswer_memory_delete(context: RunContext[AinswerDepends], unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique identifier for memory', metadata=[MinLen(min_length=36), MaxLen(max_length=36)])]) None [source]#
Delete the record from the historical person memorables.
Note
This tool will allow for deleting the memories for the provided username, also known as a Robie person.
- async enrobie.plugins.ainswer.ainswer.ainswer_memory_insert(context: RunContext[AinswerDepends], message: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Historical person memorable', metadata=[MinLen(min_length=1), MaxLen(max_length=400)])]) None [source]#
Insert the memory into the historical person memorables.
Do not add memories of previous questions or discussion. Do not add new memories without confirmation as there is limited storage that the person may have for memorables. Only add the memory one time after ensuring it does not already exist, using the ainswer_memory_records tool. Always confirm with the person before inserting message. Be very cautious and conservative with use of this tool, the bot is configured by default to remove older entries once the limit for the person memories has been reached!
Note
This tool will allow for inserting new memories for the provided username, also known as a Robie person.
- async enrobie.plugins.ainswer.ainswer.ainswer_memory_records(context: RunContext[AinswerDepends]) list[AinswerMemoryRecord] | None [source]#
Return the historical records for the person memorables.
Note
This tool will return historical memorable items for the provided username, also known as a Robie person.
enrobie.plugins.ainswer.common 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.ainswer.common.AinswerDepends(plugin: AinswerPlugin, mitem: RobieMessage | None)[source]#
Bases:
object
Dependencies related to operation with PydanticAI tools.
- mitem: RobieMessage | None#
- plugin: AinswerPlugin#
- pydantic model enrobie.plugins.ainswer.common.AinswerResponse[source]#
Bases:
BaseModel
Contains the response for question for the client type.
Show JSON schema
{ "title": "AinswerResponse", "description": "Contains the response for question for the client type.", "type": "object", "properties": { "text": { "description": "Simple and concise format.", "title": "Text", "type": "string" } }, "additionalProperties": false, "required": [ "text" ] }
- Config:
extra: str = forbid
- Fields:
- pydantic model enrobie.plugins.ainswer.common.AinswerResponseDSC[source]#
Bases:
AinswerResponse
Contains the response for question for the client type.
Show JSON schema
{ "title": "AinswerResponseDSC", "description": "Contains the response for question for the client type.", "type": "object", "properties": { "text": { "description": "Format intended for Discord.", "maxLength": 1900, "title": "Text", "type": "string" } }, "additionalProperties": false, "required": [ "text" ] }
- Config:
extra: str = forbid
- Fields:
- pydantic model enrobie.plugins.ainswer.common.AinswerResponseIRC[source]#
Bases:
AinswerResponse
Contains the response for question for the client type.
Show JSON schema
{ "title": "AinswerResponseIRC", "description": "Contains the response for question for the client type.", "type": "object", "properties": { "text": { "description": "Format intended for IRCv2.", "maxLength": 350, "title": "Text", "type": "string" } }, "additionalProperties": false, "required": [ "text" ] }
- Config:
extra: str = forbid
- Fields:
- pydantic model enrobie.plugins.ainswer.common.AinswerResponseMTM[source]#
Bases:
AinswerResponse
Contains the response for question for the client type.
Show JSON schema
{ "title": "AinswerResponseMTM", "description": "Contains the response for question for the client type.", "type": "object", "properties": { "text": { "description": "Format intended for Mattermost.", "maxLength": 1900, "title": "Text", "type": "string" } }, "additionalProperties": false, "required": [ "text" ] }
- Config:
extra: str = forbid
- Fields:
enrobie.plugins.ainswer.helpers 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.
- enrobie.plugins.ainswer.helpers.composedsc(plugin: AinswerPlugin, mitem: RobieMessage) None [source]#
Construct and format message for related chat platform.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
mitem – Item containing information for operation.
- enrobie.plugins.ainswer.helpers.composeirc(plugin: AinswerPlugin, mitem: RobieMessage) None [source]#
Construct and format message for related chat platform.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
mitem – Item containing information for operation.
- enrobie.plugins.ainswer.helpers.composemtm(plugin: AinswerPlugin, mitem: RobieMessage) None [source]#
Construct and format message for related chat platform.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
mitem – Item containing information for operation.
enrobie.plugins.ainswer.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.ainswer.history.AinswerHistory(plugin: AinswerPlugin)[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, ainswer: str) None [source]#
Insert the record into the historical chat interactions.
- process(mitem: RobieMessage, ainswer: str) None [source]#
Insert the record into the historical chat interactions.
- Parameters:
mitem – Item containing information for operation.
ainswer – Response from LLM relevant to question.
- records(mitem: RobieMessage, limit: int | None = None) list[AinswerHistoryRecord] [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[AinswerHistoryRecord] [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.ainswer.history.AinswerHistoryRecord[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": "AinswerHistoryRecord", "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" }, "ainswer": { "description": "Historical interaction content", "title": "Ainswer", "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", "ainswer", "create" ] }
- Config:
extra: str = forbid
- Fields:
- field ainswer: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Historical interaction content')] [Required]#
Historical interaction content
- 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
- class enrobie.plugins.ainswer.history.AinswerHistoryTable(**kwargs)[source]#
Bases:
SQLBase
Schematic for the database operations using SQLAlchemy.
Note
Fields are not completely documented for this model.
- ainswer#
- anchor#
- author#
- client#
- create#
- kind#
- message#
- person#
- plugin#
- class enrobie.plugins.ainswer.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.See also
- 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.ainswer.memory 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.ainswer.memory.AinswerMemory(plugin: AinswerPlugin)[source]#
Bases:
object
Store the historical information for the person memory.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
- delete(person: str, unique: str) None [source]#
Delete the record from the historical person memorables.
- Parameters:
person – Unique identifier for the person object.
unique – Unique identifier for person memorable.
- expunge(person: str) None [source]#
Remove the expired historical person memorable records.
- Parameters:
person – Unique identifier for the person object.
- insert(*, person: str, message: str) None [source]#
Insert the record into the historical person memorables.
- records(mitem: RobieMessage) list[AinswerMemoryRecord] [source]#
Return the historical records for the person memorables.
- Parameters:
mitem – Item containing information for operation.
- Returns:
Historical records for the person memorables.
- pydantic model enrobie.plugins.ainswer.memory.AinswerMemoryRecord[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": "AinswerMemoryRecord", "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" }, "person": { "default": null, "description": "Person that author is matched", "minLength": 1, "title": "Person", "type": "string" }, "unique": { "description": "Unique identifier for memory", "maxLength": 36, "minLength": 36, "title": "Unique", "type": "string" }, "message": { "description": "Historical person memorable", "maxLength": 400, "minLength": 1, "title": "Message", "type": "string" }, "create": { "description": "When the record was created", "maxLength": 32, "minLength": 20, "title": "Create", "type": "string" } }, "additionalProperties": false, "required": [ "plugin", "unique", "message", "create" ] }
- Config:
extra: str = forbid
- Fields:
- 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 message: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Historical person memorable', metadata=[MinLen(min_length=1), MaxLen(max_length=400)])] [Required]#
Historical person memorable
- Constraints:
min_length = 1
max_length = 400
- field person: Annotated[str, 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
- class enrobie.plugins.ainswer.memory.AinswerMemoryTable(**kwargs)[source]#
Bases:
SQLBase
Schematic for the database operations using SQLAlchemy.
Note
Fields are not completely documented for this model.
- create#
- message#
- person#
- plugin#
- unique#
- class enrobie.plugins.ainswer.memory.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.See also
- 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.ainswer.models 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.ainswer.models.AinswerModels(plugin: AinswerPlugin)[source]#
Bases:
object
Return the class object that was imported within method.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
- classmethod agent() Type[Agent[AinswerDepends, str]] [source]#
Return the class object that was imported within method.
- property anthropic: AnthropicModel#
Return the class object that was imported within method.
- property openai: OpenAIModel#
Return the class object that was imported within method.
enrobie.plugins.ainswer.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.ainswer.params.AinswerPluginAinswerParams[source]#
Bases:
RobieParamsModel
Process and validate the Robie configuration parameters.
Show JSON schema
{ "title": "AinswerPluginAinswerParams", "description": "Process and validate the Robie configuration parameters.", "type": "object", "properties": { "origin": { "description": "Which platform hosts the model", "enum": [ "anthropic", "openai" ], "title": "Origin", "type": "string" }, "model": { "description": "Platform model that will be used", "minLength": 1, "title": "Model", "type": "string" }, "secret": { "description": "Model in platform that is used", "minLength": 1, "title": "Secret", "type": "string" }, "timeout": { "default": 30, "description": "Time to wait during the request", "maximum": 300, "minimum": 1, "title": "Timeout", "type": "integer" }, "sleep": { "default": [ 15, 30 ], "description": "Time to wait before the request", "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "title": "Sleep", "type": "array" } }, "additionalProperties": false, "required": [ "origin", "model", "secret" ] }
- Config:
extra: str = forbid
- Fields:
- field model: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Platform model that will be used', metadata=[MinLen(min_length=1)])] [Required]#
Platform model that will be used
- Constraints:
min_length = 1
- field origin: Annotated[Literal['anthropic', 'openai'], FieldInfo(annotation=NoneType, required=True, description='Which platform hosts the model')] [Required]#
Which platform hosts the model
- field secret: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Model in platform that is used', metadata=[MinLen(min_length=1)])] [Required]#
Model in platform that is used
- Constraints:
min_length = 1
- pydantic model enrobie.plugins.ainswer.params.AinswerPluginParams[source]#
Bases:
RobiePluginParams
Process and validate the Robie configuration parameters.
Show JSON schema
{ "title": "AinswerPluginParams", "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": 10, "description": "Number of messages per anchor", "maximum": 1000, "minimum": 1, "title": "Histories", "type": "integer" }, "memories": { "default": 10, "description": "Number of messages per person", "maximum": 1000, "minimum": 1, "title": "Memories", "type": "integer" }, "clients": { "description": "List of clients to enable plugin", "items": { "type": "string" }, "minItems": 1, "title": "Clients", "type": "array" }, "ainswer": { "$ref": "#/$defs/AinswerPluginAinswerParams", "description": "Parameters for the AI platforms" }, "prompt": { "$ref": "#/$defs/AinswerPluginPromptParams", "description": "Override the agent system prompt" }, "plugins": { "anyOf": [ { "items": { "type": "string" }, "minItems": 1, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of plugins to load tools", "title": "Plugins" }, "logger": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Logger for including recents", "title": "Logger" }, "status": { "$ref": "#/$defs/StatusPluginIconParams", "description": "Icon used per chat platform" } }, "$defs": { "AinswerPluginAinswerParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "origin": { "description": "Which platform hosts the model", "enum": [ "anthropic", "openai" ], "title": "Origin", "type": "string" }, "model": { "description": "Platform model that will be used", "minLength": 1, "title": "Model", "type": "string" }, "secret": { "description": "Model in platform that is used", "minLength": 1, "title": "Secret", "type": "string" }, "timeout": { "default": 30, "description": "Time to wait during the request", "maximum": 300, "minimum": 1, "title": "Timeout", "type": "integer" }, "sleep": { "default": [ 15, 30 ], "description": "Time to wait before the request", "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "title": "Sleep", "type": "array" } }, "required": [ "origin", "model", "secret" ], "title": "AinswerPluginAinswerParams", "type": "object" }, "AinswerPluginPromptClientParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "dsc": { "default": "In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Dsc", "type": "string" }, "irc": { "default": "In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.", "description": "Supplement the system prompt", "minLength": 1, "title": "Irc", "type": "string" }, "mtm": { "default": "In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Mtm", "type": "string" } }, "title": "AinswerPluginPromptClientParams", "type": "object" }, "AinswerPluginPromptParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "system": { "default": "You are a helpful chatbot assistant named Robie. You were built by Robert, at the Enasis Network.", "description": "Override the agent system prompt", "minLength": 1, "title": "System", "type": "string" }, "client": { "$ref": "#/$defs/AinswerPluginPromptClientParams", "description": "Additional chat platform prompt" }, "header": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional header before question", "title": "Header" }, "footer": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional footer after question", "title": "Footer" }, "ignore": { "default": [ "If you believe that you are being abused by the user asking the quesiton." ], "description": "Reasons for LLM to decline response", "items": { "type": "string" }, "minItems": 1, "title": "Ignore", "type": "array" } }, "title": "AinswerPluginPromptParams", "type": "object" }, "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", "ainswer" ] }
- Config:
extra: str = forbid
- Fields:
- field ainswer: Annotated[AinswerPluginAinswerParams, FieldInfo(annotation=NoneType, required=True, description='Parameters for the AI platforms')] [Required]#
Parameters for the AI platforms
- 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=10, description='Number of messages per anchor', metadata=[Ge(ge=1), Le(le=1000)])] = 10#
Number of messages per anchor
- Constraints:
ge = 1
le = 1000
- 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 logger: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Logger for including recents', metadata=[MinLen(min_length=1)])] = None#
Logger for including recents
- Constraints:
min_length = 1
- field memories: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=10, description='Number of messages per person', metadata=[Ge(ge=1), Le(le=1000)])] = 10#
Number of messages per person
- Constraints:
ge = 1
le = 1000
- field plugins: Annotated[list[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='List of plugins to load tools', metadata=[MinLen(min_length=1)])] = None#
List of plugins to load tools
- Constraints:
min_length = 1
- field prompt: Annotated[AinswerPluginPromptParams, FieldInfo(annotation=NoneType, required=False, default_factory=AinswerPluginPromptParams, description='Override the agent system prompt')] [Optional]#
Override the agent system prompt
- field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#
Icon used per chat platform
- pydantic model enrobie.plugins.ainswer.params.AinswerPluginPromptClientParams[source]#
Bases:
RobieParamsModel
Process and validate the Robie configuration parameters.
Show JSON schema
{ "title": "AinswerPluginPromptClientParams", "description": "Process and validate the Robie configuration parameters.", "type": "object", "properties": { "dsc": { "default": "In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Dsc", "type": "string" }, "irc": { "default": "In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.", "description": "Supplement the system prompt", "minLength": 1, "title": "Irc", "type": "string" }, "mtm": { "default": "In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Mtm", "type": "string" } }, "additionalProperties": false }
- field dsc: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.', description='Supplement the system prompt', metadata=[MinLen(min_length=1)])] = 'In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.'#
Supplement the system prompt
- Constraints:
min_length = 1
- field irc: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.', description='Supplement the system prompt', metadata=[MinLen(min_length=1)])] = 'In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.'#
Supplement the system prompt
- Constraints:
min_length = 1
- field mtm: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.', description='Supplement the system prompt', metadata=[MinLen(min_length=1)])] = 'In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.'#
Supplement the system prompt
- Constraints:
min_length = 1
- pydantic model enrobie.plugins.ainswer.params.AinswerPluginPromptParams[source]#
Bases:
RobieParamsModel
Process and validate the Robie configuration parameters.
Show JSON schema
{ "title": "AinswerPluginPromptParams", "description": "Process and validate the Robie configuration parameters.", "type": "object", "properties": { "system": { "default": "You are a helpful chatbot assistant named Robie. You were built by Robert, at the Enasis Network.", "description": "Override the agent system prompt", "minLength": 1, "title": "System", "type": "string" }, "client": { "$ref": "#/$defs/AinswerPluginPromptClientParams", "description": "Additional chat platform prompt" }, "header": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional header before question", "title": "Header" }, "footer": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional footer after question", "title": "Footer" }, "ignore": { "default": [ "If you believe that you are being abused by the user asking the quesiton." ], "description": "Reasons for LLM to decline response", "items": { "type": "string" }, "minItems": 1, "title": "Ignore", "type": "array" } }, "$defs": { "AinswerPluginPromptClientParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "dsc": { "default": "In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Dsc", "type": "string" }, "irc": { "default": "In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.", "description": "Supplement the system prompt", "minLength": 1, "title": "Irc", "type": "string" }, "mtm": { "default": "In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Mtm", "type": "string" } }, "title": "AinswerPluginPromptClientParams", "type": "object" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
- field client: Annotated[AinswerPluginPromptClientParams, FieldInfo(annotation=NoneType, required=False, default_factory=AinswerPluginPromptClientParams, description='Additional chat platform prompt')] [Optional]#
Additional chat platform prompt
Optional footer after question
- Constraints:
min_length = 1
- field header: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Optional header before question', metadata=[MinLen(min_length=1)])] = None#
Optional header before question
- Constraints:
min_length = 1
- field ignore: Annotated[list[str], FieldInfo(annotation=NoneType, required=False, default=['If you believe that you are being abused by the user asking the quesiton.'], description='Reasons for LLM to decline response', metadata=[MinLen(min_length=1)])] = ['If you believe that you are being abused by the user asking the quesiton.']#
Reasons for LLM to decline response
- Constraints:
min_length = 1
- field system: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='You are a helpful chatbot assistant named Robie. You were built by Robert, at the Enasis Network.', description='Override the agent system prompt', metadata=[MinLen(min_length=1)])] = 'You are a helpful chatbot assistant named Robie. You were built by Robert, at the Enasis Network.'#
Override the agent system prompt
- Constraints:
min_length = 1
enrobie.plugins.ainswer.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.ainswer.plugin.AinswerPlugin(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 agent: Agent[AinswerDepends, str]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- ainswer(mitem: RobieMessage, prompt: str, respond: Type[AinswerResponse]) str [source]#
Submit the question to the LLM and return the response.
- Parameters:
mitem – Item containing information for operation.
prompt – Additional prompt insert before question.
respond – Model to describe the expected response.
- Returns:
Response adhering to provided specifications.
- property history: AinswerHistory#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property memory: AinswerMemory#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property models: AinswerModels#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property params: AinswerPluginParams#
Return the Pydantic model containing the configuration.
- Returns:
Pydantic model containing the configuration.
- printer(source: dict[str, Any], color: int = 6) None [source]#
Print the contents for the object within Robie instance.
- Parameters:
source – Content which will be shown after header.
color – Override the color used for box character.
- property question: AinswerQuestion#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- classmethod schema() Type[AinswerPluginParams] [source]#
Return the configuration parameters relevant for class.
- Returns:
Configuration parameters relevant for class.
- property toolset: AinswerToolset#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
enrobie.plugins.ainswer.question 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.ainswer.question.AinswerQuestion(plugin: AinswerPlugin)[source]#
Bases:
object
Construct prompt and allow for interacting with the LLM.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
- prompt(mitem: RobieMessage, prompt: str) str [source]#
Return the message prefixed with runtime prompt values.
- Parameters:
mitem – Item containing information for operation.
prompt – Additional prompt insert before question.
- Returns:
Message prefixed with runtime prompt values.
- submit(prompt: str, respond: Type[AinswerResponse], mitem: RobieMessage | None = None) AinswerResponse [source]#
Submit the question to the LLM and return the response.
- Parameters:
prompt – Question that will be asked of the LLM.
respond – Model to describe the expected response.
mitem – Item containing information for operation.
- Returns:
Response adhering to provided specifications.
enrobie.plugins.ainswer.toolset 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.ainswer.toolset.AinswerToolset(plugin: AinswerPlugin)[source]#
Bases:
object
Enumerate the plugins and return those that are related.
- Parameters:
plugin – Plugin class instance for Chatting Robie.
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.ainswer.AinswerDepends(plugin: AinswerPlugin, mitem: RobieMessage | None)[source]#
Bases:
object
Dependencies related to operation with PydanticAI tools.
- mitem: RobieMessage | None#
- plugin: AinswerPlugin#
- class enrobie.plugins.ainswer.AinswerPlugin(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 agent: Agent[AinswerDepends, str]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- ainswer(mitem: RobieMessage, prompt: str, respond: Type[AinswerResponse]) str [source]#
Submit the question to the LLM and return the response.
- Parameters:
mitem – Item containing information for operation.
prompt – Additional prompt insert before question.
respond – Model to describe the expected response.
- Returns:
Response adhering to provided specifications.
- property history: AinswerHistory#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property memory: AinswerMemory#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property models: AinswerModels#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property params: AinswerPluginParams#
Return the Pydantic model containing the configuration.
- Returns:
Pydantic model containing the configuration.
- printer(source: dict[str, Any], color: int = 6) None [source]#
Print the contents for the object within Robie instance.
- Parameters:
source – Content which will be shown after header.
color – Override the color used for box character.
- property question: AinswerQuestion#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- classmethod schema() Type[AinswerPluginParams] [source]#
Return the configuration parameters relevant for class.
- Returns:
Configuration parameters relevant for class.
- property toolset: AinswerToolset#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- pydantic model enrobie.plugins.ainswer.AinswerPluginParams[source]#
Bases:
RobiePluginParams
Process and validate the Robie configuration parameters.
Show JSON schema
{ "title": "AinswerPluginParams", "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": 10, "description": "Number of messages per anchor", "maximum": 1000, "minimum": 1, "title": "Histories", "type": "integer" }, "memories": { "default": 10, "description": "Number of messages per person", "maximum": 1000, "minimum": 1, "title": "Memories", "type": "integer" }, "clients": { "description": "List of clients to enable plugin", "items": { "type": "string" }, "minItems": 1, "title": "Clients", "type": "array" }, "ainswer": { "$ref": "#/$defs/AinswerPluginAinswerParams", "description": "Parameters for the AI platforms" }, "prompt": { "$ref": "#/$defs/AinswerPluginPromptParams", "description": "Override the agent system prompt" }, "plugins": { "anyOf": [ { "items": { "type": "string" }, "minItems": 1, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of plugins to load tools", "title": "Plugins" }, "logger": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Logger for including recents", "title": "Logger" }, "status": { "$ref": "#/$defs/StatusPluginIconParams", "description": "Icon used per chat platform" } }, "$defs": { "AinswerPluginAinswerParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "origin": { "description": "Which platform hosts the model", "enum": [ "anthropic", "openai" ], "title": "Origin", "type": "string" }, "model": { "description": "Platform model that will be used", "minLength": 1, "title": "Model", "type": "string" }, "secret": { "description": "Model in platform that is used", "minLength": 1, "title": "Secret", "type": "string" }, "timeout": { "default": 30, "description": "Time to wait during the request", "maximum": 300, "minimum": 1, "title": "Timeout", "type": "integer" }, "sleep": { "default": [ 15, 30 ], "description": "Time to wait before the request", "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "title": "Sleep", "type": "array" } }, "required": [ "origin", "model", "secret" ], "title": "AinswerPluginAinswerParams", "type": "object" }, "AinswerPluginPromptClientParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "dsc": { "default": "In 1875 characters or less, answer the user question. Format for Discord. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Dsc", "type": "string" }, "irc": { "default": "In 325 characters or less, answer the user question. Format for IRCv2. Do not use markdown. Do not use colors.", "description": "Supplement the system prompt", "minLength": 1, "title": "Irc", "type": "string" }, "mtm": { "default": "In 1875 characters or less, answer the user question. Format for Mattermost. Markdown is encouraged.", "description": "Supplement the system prompt", "minLength": 1, "title": "Mtm", "type": "string" } }, "title": "AinswerPluginPromptClientParams", "type": "object" }, "AinswerPluginPromptParams": { "additionalProperties": false, "description": "Process and validate the Robie configuration parameters.", "properties": { "system": { "default": "You are a helpful chatbot assistant named Robie. You were built by Robert, at the Enasis Network.", "description": "Override the agent system prompt", "minLength": 1, "title": "System", "type": "string" }, "client": { "$ref": "#/$defs/AinswerPluginPromptClientParams", "description": "Additional chat platform prompt" }, "header": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional header before question", "title": "Header" }, "footer": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional footer after question", "title": "Footer" }, "ignore": { "default": [ "If you believe that you are being abused by the user asking the quesiton." ], "description": "Reasons for LLM to decline response", "items": { "type": "string" }, "minItems": 1, "title": "Ignore", "type": "array" } }, "title": "AinswerPluginPromptParams", "type": "object" }, "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", "ainswer" ] }
- Config:
extra: str = forbid
- Fields:
- field ainswer: Annotated[AinswerPluginAinswerParams, FieldInfo(annotation=NoneType, required=True, description='Parameters for the AI platforms')] [Required]#
Parameters for the AI platforms
- 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=10, description='Number of messages per anchor', metadata=[Ge(ge=1), Le(le=1000)])] = 10#
Number of messages per anchor
- Constraints:
ge = 1
le = 1000
- 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 logger: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Logger for including recents', metadata=[MinLen(min_length=1)])] = None#
Logger for including recents
- Constraints:
min_length = 1
- field memories: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=10, description='Number of messages per person', metadata=[Ge(ge=1), Le(le=1000)])] = 10#
Number of messages per person
- Constraints:
ge = 1
le = 1000
- field plugins: Annotated[list[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='List of plugins to load tools', metadata=[MinLen(min_length=1)])] = None#
List of plugins to load tools
- Constraints:
min_length = 1
- field prompt: Annotated[AinswerPluginPromptParams, FieldInfo(annotation=NoneType, required=False, default_factory=AinswerPluginPromptParams, description='Override the agent system prompt')] [Optional]#
Override the agent system prompt
- field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#
Icon used per chat platform