ums.utils.types
This represents the basic types used to interact with the management. The types are implemented using pydantic. It provides validation, allow JSON serialization and works well with FastAPI which is used internally for the http request between the agents and the management.
Example
ex = AgentMessage(
id="ex1",
riddle={
"context":"Example 1",
"question":"Get the name of the person."
},
data=[
RiddleData(
type=RiddleDataType.TEXT,
file_plain="./cv.txt"
)
]
)
ex.status.extract.required = False
{
"id": "ex1",
"sub_ids": [],
"riddle": {
"context": "Example 1",
"question": "Get the name of the person.",
"solutions_before": []
},
"solution": [],
"data": [
{
"type": "text",
"file_plain": "/ums-agenten/share/cv.txt",
"file_extracted": null,
"prompt": null
}
],
"status": {
"extract": {
"required": false,
"finished": false
},
"solve": {
"required": true,
"finished": false
},
"validate": {
"required": true,
"finished": false
},
"trial": 0,
"solved": false
},
"contacts": 0
}
ex.solution = RiddleSolution(
solution="Otto",
explanation="Written in line 6 after 'Name:'"
)
{
...
"solution": [{
"solution": "Otto",
"explanation": "Written in line 6 after 'Name:'",
"used_data": [],
"accepted": false,
"review": null
}],
...
}
1# Agenten Plattform 2# 3# (c) 2024 Magnus Bender 4# Institute of Humanities-Centered Artificial Intelligence (CHAI) 5# Universitaet Hamburg 6# https://www.chai.uni-hamburg.de/~bender 7# 8# source code released under the terms of GNU Public License Version 3 9# https://www.gnu.org/licenses/gpl-3.0.txt 10 11""" 12 This represents the basic types used to interact with the management. 13 The types are implemented using [pydantic](https://docs.pydantic.dev/). 14 It provides validation, allow JSON serialization and works well with [FastAPI](https://fastapi.tiangolo.com/) which is used internally for the http request between the agents and the management. 15 16 ### Example 17 18 ```python 19 ex = AgentMessage( 20 id="ex1", 21 riddle={ 22 "context":"Example 1", 23 "question":"Get the name of the person." 24 }, 25 data=[ 26 RiddleData( 27 type=RiddleDataType.TEXT, 28 file_plain="./cv.txt" 29 ) 30 ] 31 ) 32 ex.status.extract.required = False 33 ``` 34 ```json 35 { 36 "id": "ex1", 37 "sub_ids": [], 38 "riddle": { 39 "context": "Example 1", 40 "question": "Get the name of the person.", 41 "solutions_before": [] 42 }, 43 "solution": [], 44 "data": [ 45 { 46 "type": "text", 47 "file_plain": "/ums-agenten/share/cv.txt", 48 "file_extracted": null, 49 "prompt": null 50 } 51 ], 52 "status": { 53 "extract": { 54 "required": false, 55 "finished": false 56 }, 57 "solve": { 58 "required": true, 59 "finished": false 60 }, 61 "validate": { 62 "required": true, 63 "finished": false 64 }, 65 "trial": 0, 66 "solved": false 67 }, 68 "contacts": 0 69 } 70 ``` 71 ```python 72 ex.solution = RiddleSolution( 73 solution="Otto", 74 explanation="Written in line 6 after 'Name:'" 75 ) 76 ``` 77 ```json 78 { 79 ... 80 "solution": [{ 81 "solution": "Otto", 82 "explanation": "Written in line 6 after 'Name:'", 83 "used_data": [], 84 "accepted": false, 85 "review": null 86 }], 87 ... 88 } 89 ``` 90 91""" 92 93import os, warnings 94 95from enum import Enum 96 97from typing import List, Any 98from typing_extensions import Annotated 99 100from pydantic import ( 101 BaseModel, 102 ValidationError, ValidationInfo, 103 ValidatorFunctionWrapHandler, 104 WrapValidator, AfterValidator, BeforeValidator 105) 106 107from ums.utils.const import SHARE_PATH 108from ums.utils.schema import ExtractionSchema 109 110class RiddleInformation(BaseModel): 111 # ignore: 112 # /usr/local/lib/python3.12/dist-packages/pydantic/_internal/_fields.py:172: 113 # UserWarning: Field name "validate" in "RiddleStatus" shadows an attribute in parent 114 # "RiddleInformation" 115 warnings.filterwarnings('ignore', category=UserWarning, lineno=172, module="pydantic") 116 117 """ 118 This is the basic class used as superclass for all message and infos 119 about a riddle. 120 """ 121 122class RiddleDataType(Enum): 123 """ 124 Enum for the three types of data used in a riddle. 125 """ 126 127 TEXT = "text" 128 IMAGE = "image" 129 AUDIO = "audio" 130 131def _check_data_file(file_name:str) -> str: 132 if not file_name.startswith('/'): 133 file_name = os.path.join(SHARE_PATH, file_name) 134 135 assert file_name.startswith(SHARE_PATH), "The data file needs to be in {}!".format(SHARE_PATH) 136 137 file_name = os.path.realpath(file_name, strict=False) 138 139 assert os.path.isfile(file_name), "The data file {} does not exist!".format(file_name) 140 141 return file_name 142 143def _ignore_file_missing( 144 v: Any, handler: ValidatorFunctionWrapHandler, info: ValidationInfo 145 ) -> str: 146 try: 147 return handler(v) 148 except ValidationError: 149 if not info.context is None and \ 150 "require_file_exists" in info.context and \ 151 info.context["require_file_exists"] == False and \ 152 isinstance(v, str): 153 return "missing:{}".format(v) 154 else: 155 raise 156 157class RiddleData(RiddleInformation): 158 159 """ 160 A data item to be used to solve the riddle 161 """ 162 163 type: RiddleDataType 164 """ 165 The type of the data item. 166 """ 167 168 file_plain: Annotated[str, AfterValidator(_check_data_file), WrapValidator(_ignore_file_missing)] 169 """ 170 The plain file (as path to file system) without any processing. 171 172 The path will be validated and must start with `SHARE_PATH` (or be relative to `SHARE_PATH`). 173 The file must exist. 174 """ 175 176 file_extracted: Annotated[str, AfterValidator(_check_data_file), WrapValidator(_ignore_file_missing)] | None = None 177 """ 178 The processed files (as path to file system), i.e., a schematic file containing all extracted informations. 179 180 The path will be validated and must start with `SHARE_PATH` (or be relative to `SHARE_PATH`). 181 The file must exist. 182 """ 183 184 prompt: str | ExtractionSchema | None = None 185 """ 186 An optional prompt giving more details to the extraction agent, e.g., selecting a type of extraction/ task to do with the data. 187 """ 188 189 190class RiddleSolution(RiddleInformation): 191 """ 192 A solution of a riddle. 193 """ 194 195 solution: str 196 """ 197 The textual value of the solution. 198 """ 199 200 explanation: str 201 """ 202 An explanation of the solution. 203 """ 204 205 used_data: List[RiddleData] = [] 206 """ 207 The data items used to create the solution (optional). 208 """ 209 210 accepted : bool = False 211 """ 212 If the solution is accepted by validator/ gatekeeper. 213 """ 214 215 review: str | None = None 216 """ 217 A review of the solution (if None: not tried to validate) 218 """ 219 220class Riddle(RiddleInformation): 221 """ 222 The riddle (the task description and possibly a solution) 223 """ 224 225 context: str 226 """ 227 The context of the riddle (as textual string). 228 """ 229 230 question: str 231 """ 232 The actual main question of the riddle (as textual string). 233 """ 234 235 solutions_before: List[RiddleSolution] = [] 236 """ 237 If already tried to solve this riddle before, the (not accepted) solutions are stored here 238 """ 239 240class RiddleSubStatus(RiddleInformation): 241 """ 242 The sub status for each possible step a riddle may go though. 243 """ 244 245 required: bool = True 246 """ 247 Is this step required (i.e., requested) 248 """ 249 250 finished: bool = False 251 """ 252 Was this step already executed. 253 """ 254 255class RiddleStatus(RiddleInformation): 256 """ 257 The status of a riddle, will be mostly changed by Management when the riddle is sent to different agents while solving it. 258 """ 259 260 extract: RiddleSubStatus = RiddleSubStatus() 261 """ 262 The first extract step (image, text, audio -> more sematic data) 263 264 The `RiddleData` items in `AgentMessage.data` shall have `file_extracted` afterwards. 265 """ 266 267 solve: RiddleSubStatus = RiddleSubStatus() 268 """ 269 The *main* solving step. 270 271 `AgentMessage.solution` shall contain an `RiddleSolution` afterwards. 272 """ 273 274 validate: RiddleSubStatus = RiddleSubStatus() 275 """ 276 The validation step, i.e., does the gatekeeper accept the solution(s) in `AgentMessage.solution`. 277 """ 278 279 trial: int = 0 280 """ 281 A counter for the number of trials. 282 Each time the gatekeeper does not accept a solution of this riddle, the value is incremented. 283 """ 284 285 solved: bool = False 286 """ 287 True, after the gatekeeper accepts the solution(s) at `AgentMessage.solution` 288 """ 289 290def _transform_to_list(value : Any) -> List[Any]: 291 # type check of items is done next by pydantic 292 return value if isinstance(value, list) else [value] 293 294class AgentMessage(RiddleInformation): 295 """ 296 The basic message, which is sent be the agent and the management. 297 The objects will be JSON en- and decoded. 298 """ 299 300 id: str 301 """ 302 The riddle id, e.g., ``ex1`` 303 This is a unique string and identifies the riddle. 304 """ 305 306 sub_ids: List[str] = [] 307 """ 308 There might be cases, when an agent decided to split in riddle in multiple *smaller* steps. 309 Each *sub* riddle will then get its own id (i.e., ``ex1-sub1``) while the sub id is added here as reference. 310 """ 311 312 riddle: Riddle 313 """ 314 The riddle to solve. 315 """ 316 317 solution: Annotated[List[RiddleSolution], BeforeValidator(_transform_to_list)] = [] 318 """ 319 The solutions of the riddle (or empty list if no solutions available) 320 (When assigning a single object of `RiddleSolution` will be convert to list with this single object.) 321 """ 322 323 data: List[RiddleData] = [] 324 """ 325 The data to get the solution from. 326 """ 327 328 status: RiddleStatus = RiddleStatus() 329 """ 330 The status of the riddle. 331 """ 332 333 contacts : int = 0 334 """ 335 A counter representing the number of contacts the management had with this message. 336 Each time the management processes the message, this counter is incremented by 1. 337 Using this counter the management is able to detect cycles and stop them. 338 """ 339 340class AgentResponse(RiddleInformation): 341 """ 342 Returned by the management when receiving an `AgentMessage`. 343 """ 344 345 count : int 346 """ 347 The count of the message (overall numeric id). 348 """ 349 350 msg: str|None = None 351 """ 352 An additional message. 353 """ 354 355 error: bool = False 356 """ 357 If an error occurred. 358 """ 359 360 error_msg: str|None = None 361 """ 362 Error message (if `error` ) 363 """ 364 365class MessageDbRow(BaseModel): 366 """ 367 Object representing a database row. 368 """ 369 370 count : int 371 """ 372 The count (primary key) of the item. 373 """ 374 375 sender : str 376 """ 377 The sender of the message. 378 """ 379 380 recipient : str 381 """ 382 The recipient of the message 383 """ 384 385 time : int 386 """ 387 The time (unix timestamp) the message was received/ sent. 388 """ 389 390 message : AgentMessage 391 """ 392 The message received/ sent. 393 """ 394 395 processed : bool 396 """ 397 Did the management process the message, i.e., did the tasks necessary for this message (mostly only relevant for received messages). 398 """ 399 400 solution : bool|None = None 401 """ 402 Does this message contain a valid solution? 403 True if contains valid solution, False if solution not valid, Null/None if not applicable 404 """
111class RiddleInformation(BaseModel): 112 # ignore: 113 # /usr/local/lib/python3.12/dist-packages/pydantic/_internal/_fields.py:172: 114 # UserWarning: Field name "validate" in "RiddleStatus" shadows an attribute in parent 115 # "RiddleInformation" 116 warnings.filterwarnings('ignore', category=UserWarning, lineno=172, module="pydantic") 117 118 """ 119 This is the basic class used as superclass for all message and infos 120 about a riddle. 121 """
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__
[Signature
][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__
function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__
andModel.__root_validators__
from Pydantic V1. - __pydantic_generic_metadata__: Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel
][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-core
SchemaSerializer
used to dump instances of the model. - __pydantic_validator__: The
pydantic-core
SchemaValidator
used to validate instances of the model. - __pydantic_extra__: A dictionary containing extra values, if [
extra
][pydantic.config.ConfigDict.extra] is set to'allow'
. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
123class RiddleDataType(Enum): 124 """ 125 Enum for the three types of data used in a riddle. 126 """ 127 128 TEXT = "text" 129 IMAGE = "image" 130 AUDIO = "audio"
Enum for the three types of data used in a riddle.
Inherited Members
- enum.Enum
- name
- value
158class RiddleData(RiddleInformation): 159 160 """ 161 A data item to be used to solve the riddle 162 """ 163 164 type: RiddleDataType 165 """ 166 The type of the data item. 167 """ 168 169 file_plain: Annotated[str, AfterValidator(_check_data_file), WrapValidator(_ignore_file_missing)] 170 """ 171 The plain file (as path to file system) without any processing. 172 173 The path will be validated and must start with `SHARE_PATH` (or be relative to `SHARE_PATH`). 174 The file must exist. 175 """ 176 177 file_extracted: Annotated[str, AfterValidator(_check_data_file), WrapValidator(_ignore_file_missing)] | None = None 178 """ 179 The processed files (as path to file system), i.e., a schematic file containing all extracted informations. 180 181 The path will be validated and must start with `SHARE_PATH` (or be relative to `SHARE_PATH`). 182 The file must exist. 183 """ 184 185 prompt: str | ExtractionSchema | None = None 186 """ 187 An optional prompt giving more details to the extraction agent, e.g., selecting a type of extraction/ task to do with the data. 188 """
A data item to be used to solve the riddle
The plain file (as path to file system) without any processing.
The path will be validated and must start with SHARE_PATH
(or be relative to SHARE_PATH
).
The file must exist.
The processed files (as path to file system), i.e., a schematic file containing all extracted informations.
The path will be validated and must start with SHARE_PATH
(or be relative to SHARE_PATH
).
The file must exist.
An optional prompt giving more details to the extraction agent, e.g., selecting a type of extraction/ task to do with the data.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
191class RiddleSolution(RiddleInformation): 192 """ 193 A solution of a riddle. 194 """ 195 196 solution: str 197 """ 198 The textual value of the solution. 199 """ 200 201 explanation: str 202 """ 203 An explanation of the solution. 204 """ 205 206 used_data: List[RiddleData] = [] 207 """ 208 The data items used to create the solution (optional). 209 """ 210 211 accepted : bool = False 212 """ 213 If the solution is accepted by validator/ gatekeeper. 214 """ 215 216 review: str | None = None 217 """ 218 A review of the solution (if None: not tried to validate) 219 """
A solution of a riddle.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
221class Riddle(RiddleInformation): 222 """ 223 The riddle (the task description and possibly a solution) 224 """ 225 226 context: str 227 """ 228 The context of the riddle (as textual string). 229 """ 230 231 question: str 232 """ 233 The actual main question of the riddle (as textual string). 234 """ 235 236 solutions_before: List[RiddleSolution] = [] 237 """ 238 If already tried to solve this riddle before, the (not accepted) solutions are stored here 239 """
The riddle (the task description and possibly a solution)
If already tried to solve this riddle before, the (not accepted) solutions are stored here
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
241class RiddleSubStatus(RiddleInformation): 242 """ 243 The sub status for each possible step a riddle may go though. 244 """ 245 246 required: bool = True 247 """ 248 Is this step required (i.e., requested) 249 """ 250 251 finished: bool = False 252 """ 253 Was this step already executed. 254 """
The sub status for each possible step a riddle may go though.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
256class RiddleStatus(RiddleInformation): 257 """ 258 The status of a riddle, will be mostly changed by Management when the riddle is sent to different agents while solving it. 259 """ 260 261 extract: RiddleSubStatus = RiddleSubStatus() 262 """ 263 The first extract step (image, text, audio -> more sematic data) 264 265 The `RiddleData` items in `AgentMessage.data` shall have `file_extracted` afterwards. 266 """ 267 268 solve: RiddleSubStatus = RiddleSubStatus() 269 """ 270 The *main* solving step. 271 272 `AgentMessage.solution` shall contain an `RiddleSolution` afterwards. 273 """ 274 275 validate: RiddleSubStatus = RiddleSubStatus() 276 """ 277 The validation step, i.e., does the gatekeeper accept the solution(s) in `AgentMessage.solution`. 278 """ 279 280 trial: int = 0 281 """ 282 A counter for the number of trials. 283 Each time the gatekeeper does not accept a solution of this riddle, the value is incremented. 284 """ 285 286 solved: bool = False 287 """ 288 True, after the gatekeeper accepts the solution(s) at `AgentMessage.solution` 289 """
The status of a riddle, will be mostly changed by Management when the riddle is sent to different agents while solving it.
The first extract step (image, text, audio -> more sematic data)
The RiddleData
items in AgentMessage.data
shall have file_extracted
afterwards.
The main solving step.
AgentMessage.solution
shall contain an RiddleSolution
afterwards.
1383 @classmethod 1384 @typing_extensions.deprecated('The `validate` method is deprecated; use `model_validate` instead.', category=None) 1385 def validate(cls, value: Any) -> Self: # noqa: D102 1386 warnings.warn( 1387 'The `validate` method is deprecated; use `model_validate` instead.', category=PydanticDeprecatedSince20 1388 ) 1389 return cls.model_validate(value)
The validation step, i.e., does the gatekeeper accept the solution(s) in AgentMessage.solution
.
A counter for the number of trials. Each time the gatekeeper does not accept a solution of this riddle, the value is incremented.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- update_forward_refs
295class AgentMessage(RiddleInformation): 296 """ 297 The basic message, which is sent be the agent and the management. 298 The objects will be JSON en- and decoded. 299 """ 300 301 id: str 302 """ 303 The riddle id, e.g., ``ex1`` 304 This is a unique string and identifies the riddle. 305 """ 306 307 sub_ids: List[str] = [] 308 """ 309 There might be cases, when an agent decided to split in riddle in multiple *smaller* steps. 310 Each *sub* riddle will then get its own id (i.e., ``ex1-sub1``) while the sub id is added here as reference. 311 """ 312 313 riddle: Riddle 314 """ 315 The riddle to solve. 316 """ 317 318 solution: Annotated[List[RiddleSolution], BeforeValidator(_transform_to_list)] = [] 319 """ 320 The solutions of the riddle (or empty list if no solutions available) 321 (When assigning a single object of `RiddleSolution` will be convert to list with this single object.) 322 """ 323 324 data: List[RiddleData] = [] 325 """ 326 The data to get the solution from. 327 """ 328 329 status: RiddleStatus = RiddleStatus() 330 """ 331 The status of the riddle. 332 """ 333 334 contacts : int = 0 335 """ 336 A counter representing the number of contacts the management had with this message. 337 Each time the management processes the message, this counter is incremented by 1. 338 Using this counter the management is able to detect cycles and stop them. 339 """
The basic message, which is sent be the agent and the management. The objects will be JSON en- and decoded.
There might be cases, when an agent decided to split in riddle in multiple smaller steps.
Each sub riddle will then get its own id (i.e., ex1-sub1
) while the sub id is added here as reference.
The solutions of the riddle (or empty list if no solutions available)
(When assigning a single object of RiddleSolution
will be convert to list with this single object.)
A counter representing the number of contacts the management had with this message. Each time the management processes the message, this counter is incremented by 1. Using this counter the management is able to detect cycles and stop them.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
341class AgentResponse(RiddleInformation): 342 """ 343 Returned by the management when receiving an `AgentMessage`. 344 """ 345 346 count : int 347 """ 348 The count of the message (overall numeric id). 349 """ 350 351 msg: str|None = None 352 """ 353 An additional message. 354 """ 355 356 error: bool = False 357 """ 358 If an error occurred. 359 """ 360 361 error_msg: str|None = None 362 """ 363 Error message (if `error` ) 364 """
Returned by the management when receiving an AgentMessage
.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
366class MessageDbRow(BaseModel): 367 """ 368 Object representing a database row. 369 """ 370 371 count : int 372 """ 373 The count (primary key) of the item. 374 """ 375 376 sender : str 377 """ 378 The sender of the message. 379 """ 380 381 recipient : str 382 """ 383 The recipient of the message 384 """ 385 386 time : int 387 """ 388 The time (unix timestamp) the message was received/ sent. 389 """ 390 391 message : AgentMessage 392 """ 393 The message received/ sent. 394 """ 395 396 processed : bool 397 """ 398 Did the management process the message, i.e., did the tasks necessary for this message (mostly only relevant for received messages). 399 """ 400 401 solution : bool|None = None 402 """ 403 Does this message contain a valid solution? 404 True if contains valid solution, False if solution not valid, Null/None if not applicable 405 """
Object representing a database row.
Did the management process the message, i.e., did the tasks necessary for this message (mostly only relevant for received messages).
Does this message contain a valid solution? True if contains valid solution, False if solution not valid, Null/None if not applicable
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs