TinyTroupe
TinyTroupe copied to clipboard
attempt to write read-only attribute in grounding.py
There's an issue in agent/grounding.py where a pydantic exception is thrown when there is an attempt to overwrite document.text. Here is the fix at line 226:
sanitized_text = utils.sanitize_raw_string(document.text)
# Create a new document with sanitized text if it changed
if sanitized_text != document.text:
document = Document(
text=sanitized_text,
metadata=document.metadata,
id_=document.id_
)
else:
# Keep the original document if no sanitization was needed
pass
It's a quick fix and if I find a moment I'll draft the PR but you may beat me to it.
Your fix perfectly worked. Thanks.