Skip to content

fix(core): support string data in Blob.as_bytes_io#36945

Closed
zxuhan7 (zxuhan) wants to merge 1 commit intolangchain-ai:masterfrom
zxuhan:fix/36667-blob-as-bytes-io-string
Closed

fix(core): support string data in Blob.as_bytes_io#36945
zxuhan7 (zxuhan) wants to merge 1 commit intolangchain-ai:masterfrom
zxuhan:fix/36667-blob-as-bytes-io-string

Conversation

@zxuhan
Copy link
Copy Markdown

Closes #36667


Blob.as_string and Blob.as_bytes both handle data: str (encoding it via self.encoding when bytes are needed), but Blob.as_bytes_io only handled bytes and file paths and raised NotImplementedError for string data. The fix adds the missing isinstance(self.data, str) branch, encoding with the blob's configured encoding for parity with as_bytes.

AI agent involvement: this contribution was drafted with assistance from an AI coding agent.

@github-actions github-actions Bot added core `langchain-core` package issues & PRs fix For PRs that implement a fix size: XS < 50 LOC labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically closed because you are not assigned to the linked issue.

External contributors must be assigned to an issue before opening a PR for it. Please:

  1. Comment on the linked issue to request assignment from a maintainer
  2. Once assigned, your PR will be reopened automatically

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

@github-actions github-actions Bot closed this Apr 22, 2026
@zxuhan zxuhan7 (zxuhan) deleted the fix/36667-blob-as-bytes-io-string branch April 22, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs external fix For PRs that implement a fix missing-issue-link new-contributor size: XS < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blob.as_bytes_io() raises NotImplementedError for string data

1 participant