47 lines
1.2 KiB
Python
47 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, content: str, id: str, timestamp: datetime):
|
|
"""
|
|
Initialize a new reasoning entry.
|
|
|
|
Args:
|
|
content: The reasoning text
|
|
id: Unique identifier for this entry
|
|
timestamp: Creation timestamp for this entry
|
|
"""
|
|
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 |