Skip to content

Bug: AttributeError: 'str' object has no attribute 'text' during stream_graph #10

@Iamsdt

Description

@Iamsdt

When executing GraphService.stream_graph, the process fails during thread-name generation because messages_str contains plain strings rather than objects with a .text attribute. This results in the following exception:

AttributeError: 'str' object has no attribute 'text'

Where It Occurs

Inside graph_service.py:

if meta["is_new_thread"] and self.config.thread_name_generator_path:
    messages_str = [msg.text() for msg in messages_str]
    thread_name = await self._save_thread_name(
        config, config["thread_id"], messages_str
    )
    meta["thread_name"] = thread_name

What’s Happening

Earlier in the stream handler, messages_str is populated with chunk.message.text(), converting entries into raw strings.
Later, the thread-name generator assumes each item is a message object and tries to call .text() again, causing the failure.

Expected Behavior

Thread naming should work regardless of whether messages are:

  • model objects
  • plain strings

Actual Behavior

Execution crashes with:

AttributeError: 'str' object has no attribute 'text'

Additional Notes

Pydantic V2.11 deprecation warnings also appear, though unrelated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions