Server side implementation for interactive entry edits
This commit is contained in:
50
sia/entry/reasoning_entry.py
Normal file
50
sia/entry/reasoning_entry.py
Normal file
@@ -0,0 +1,50 @@
|
||||
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,
|
||||
}
|
||||
Reference in New Issue
Block a user