Includes changes in schemas. Change type of `norms` in `Program` imperceptibly, big changes in schema of `BeliefMessage` to support deleting beliefs. ref: N25B-380
33 lines
873 B
Python
33 lines
873 B
Python
from pydantic import BaseModel
|
|
|
|
|
|
class Belief(BaseModel):
|
|
"""
|
|
Represents a single belief in the BDI system.
|
|
|
|
:ivar name: The functor or name of the belief (e.g., 'user_said').
|
|
:ivar arguments: A list of string arguments for the belief, or None if the belief has no
|
|
arguments.
|
|
"""
|
|
|
|
name: str
|
|
arguments: list[str] | None
|
|
|
|
|
|
class BeliefMessage(BaseModel):
|
|
"""
|
|
A container for communicating beliefs between agents.
|
|
|
|
:ivar create: Beliefs to create.
|
|
:ivar delete: Beliefs to delete.
|
|
:ivar replace: Beliefs to replace. Deletes all beliefs with the same name, replacing them with
|
|
one new belief.
|
|
"""
|
|
|
|
create: list[Belief] = []
|
|
delete: list[Belief] = []
|
|
replace: list[Belief] = []
|
|
|
|
def has_values(self) -> bool:
|
|
return len(self.create) > 0 or len(self.delete) > 0 or len(self.replace) > 0
|