50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
import xml.etree.ElementTree as ET
|
|
|
|
from . import Entry
|
|
|
|
class ReasoningEntry(Entry):
|
|
"""
|
|
Entry type for agent reasoning steps.
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
id: str,
|
|
content: str,
|
|
):
|
|
"""
|
|
Initialize a new reasoning entry.
|
|
|
|
Args:
|
|
id: Unique identifier for this entry
|
|
timestamp: Creation timestamp for this entry
|
|
content: The reasoning text
|
|
"""
|
|
super().__init__(id)
|
|
self.content = content
|
|
|
|
def update(self) -> None:
|
|
"""No update needed for reasoning entries."""
|
|
pass
|
|
|
|
def generate_context(self) -> ET.Element:
|
|
"""
|
|
Generate an XML Element representing this reasoning entry.
|
|
|
|
Returns:
|
|
ET.Element: XML element containing the entry's data
|
|
"""
|
|
element = ET.Element("reasoning", {"id": self._id})
|
|
element.text = self.content
|
|
|
|
return element
|
|
|
|
def serialize(self):
|
|
"""
|
|
Collect all public attributes of the entry into a dictionary.
|
|
"""
|
|
return {
|
|
"type": "reasoning",
|
|
"id": self._id,
|
|
"content": self.content,
|
|
} |