Checked other resources
Package (Required)
Related Issues / PRs
#36666
Reproduction Steps / Example Code (Python)
from langchain_core.documents.base import Blob
blob = Blob.from_data("hello")
with blob.as_bytes_io() as f:
print(f.read())
Error Message and Stack Trace (if applicable)
NotImplementedError: Unable to convert blob Blob 0x... metadata={} data='hello'
Description
I'm trying to use Blob.as_bytes_io() on a blob created with string data. I expect it to return a byte stream of the string, just like as_bytes() does. Instead, it raises NotImplementedError.
This is an API inconsistency: as_string() and as_bytes() both work with string data, but as_bytes_io() does not.
System Info
System Information
OS: Linux
OS Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
Python Version: 3.10.20 (main, Mar 11 2026, 17:46:40) [GCC 14.3.0]
Package Information
langchain_core: 1.2.19
langchain: 1.2.13
langchain_community: 0.4.1
langsmith: 0.7.17
langchain_chroma: 1.1.0
langchain_classic: 1.0.3
langchain_deepseek: 1.0.1
langchain_huggingface: 1.2.1
langchain_openai: 1.1.11
langchain_text_splitters: 1.1.1
langgraph_sdk: 0.3.11
Optional packages not installed
deepagents
deepagents-cli
Other Dependencies
aiohttp: 3.13.3
async-timeout: 4.0.3
chromadb: 1.5.5
dataclasses-json: 0.6.7
httpx: 0.28.1
httpx-sse: 0.4.3
huggingface-hub: 1.7.1
jsonpatch: 1.33
langgraph: 1.1.2
numpy: 2.2.6
openai: 2.28.0
opentelemetry-api: 1.40.0
opentelemetry-sdk: 1.40.0
orjson: 3.11.7
packaging: 25.0
pydantic: 2.12.5
pydantic-settings: 2.13.1
pytest: 9.0.3
pyyaml: 6.0.3
PyYAML: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
rich: 14.3.3
sentence-transformers: 5.3.0
sqlalchemy: 2.0.48
SQLAlchemy: 2.0.48
tenacity: 9.1.4
tiktoken: 0.12.0
tokenizers: 0.22.2
transformers: 5.3.0
typing-extensions: 4.15.0
uuid-utils: 0.14.1
websockets: 16.0
xxhash: 3.6.0
zstandard: 0.25.0
Checked other resources
Package (Required)
Related Issues / PRs
#36666
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
NotImplementedError: Unable to convert blob Blob 0x... metadata={} data='hello'Description
I'm trying to use
Blob.as_bytes_io()on a blob created with string data. I expect it to return a byte stream of the string, just likeas_bytes()does. Instead, it raisesNotImplementedError.This is an API inconsistency:
as_string()andas_bytes()both work with string data, butas_bytes_io()does not.System Info
System Information
Package Information
Optional packages not installed
Other Dependencies