Skip to content
Changelog

Text, Markdown and JSON readers accept streams with non-string names

October 8, 20261 min read

Agno's readers build a document name from file.name, and a stream opened from a file descriptor, like os.fdopen(fd, "rb") on a tempfile.mkstemp() handle, reports an integer there. Earlier releases called .split(".") on it. TextReader and MarkdownReader logged the error and returned nothing, and JSONReader raised. All three now fall back to a default name.

Real output reading a descriptor-backed temporary file with each reader:

Before: TextReader     name 3 -> 0 docs []
        MarkdownReader name 4 -> 0 docs []
        JSONReader     -> AttributeError 'int' object has no attribute 'split'
 
Now:    TextReader     name 3 -> 1 docs ['text_file']
        MarkdownReader name 4 -> 1 docs ['file']
        JSONReader     name 3 -> 1 docs ['json_file']

The fix covers read() and async_read() on the text and Markdown readers. A name= argument still wins over the default.

See the cookbook, and learn more about readers, the Markdown reader and the JSON reader in the documentation.

Frequently asked questions

A stream opened from a file descriptor reports an integer as its name. Earlier releases called .split(".") on that name, hit 'int' object has no attribute 'split', logged it and returned an empty list. This release checks the name's type first.

TextReader uses text_file, MarkdownReader uses file and JSONReader uses json_file. Pass name= to read() to choose your own.

Shipped around the same time