Files
SIA/sia/reasoning_entry.py
2024-11-13 17:48:39 +01:00

52 lines
1.2 KiB
Python

from datetime import datetime
import xml.etree.ElementTree as ET
from .entry import Entry
class ReasoningEntry(Entry):
"""
Entry type for agent reasoning steps.
Attributes:
_content: The reasoning text
"""
def __init__(
self,
id: str,
timestamp: datetime,
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, timestamp)
self._content = content
@property
def content(self) -> str:
"""
Get the reasoning text.
"""
return self._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