Skip to content

Accept file paths, bytes, and file objects in ImageToTextTask#119

Merged
ad-m merged 1 commit intomasterfrom
image-to-text-flexible-input
Mar 7, 2026
Merged

Accept file paths, bytes, and file objects in ImageToTextTask#119
ad-m merged 1 commit intomasterfrom
image-to-text-flexible-input

Conversation

@ad-m
Copy link
Owner

@ad-m ad-m commented Mar 7, 2026

Summary

  • ImageToTextTask now accepts str/Path (file path), bytes, or file-like objects (existing behavior)
  • Image is base64-encoded eagerly in __init__ instead of lazily in serialize(), stored as self._body
  • Added tests for bytes, string path, and pathlib.Path inputs

Test plan

  • All existing tests pass
  • New tests cover bytes, str path, and Path inputs
  • File-object input (backward compat) verified via existing test

🤖 Generated with Claude Code

ImageToTextTask now accepts three input types instead of only file
objects: file path (str/Path), raw bytes, or file-like object (existing
behavior). The image is base64-encoded eagerly in __init__ instead of
lazily in serialize().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ad-m ad-m merged commit 0a79cf6 into master Mar 7, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant