TinyTroupe icon indicating copy to clipboard operation
TinyTroupe copied to clipboard

attempt to write read-only attribute in grounding.py

Open simra opened this issue 4 months ago • 1 comments

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.

simra avatar Aug 27 '25 00:08 simra

Your fix perfectly worked. Thanks.

pearlchandru avatar Sep 10 '25 20:09 pearlchandru