Skip to content

fix(files): infer document upload content types#198

Open
jeet-dekivadia wants to merge 1 commit into
anthropics:mainfrom
jeet-dekivadia:codex/infer-document-upload-content-type
Open

fix(files): infer document upload content types#198
jeet-dekivadia wants to merge 1 commit into
anthropics:mainfrom
jeet-dekivadia:codex/infer-document-upload-content-type

Conversation

@jeet-dekivadia

@jeet-dekivadia jeet-dekivadia commented May 30, 2026

Copy link
Copy Markdown

Summary

  • infer application/pdf and text/plain for multipart files with .pdf and .txt filenames
  • keep explicit Anthropic::FilePart#content_type values authoritative
  • preserve the existing application/octet-stream fallback for unknown formats and add focused regression coverage

Addresses #128.

Validation

  • git diff --check
  • verified File.extname handling for Pathname, missing filenames, and uppercase extensions
  • added util regressions for PDF inference, text inference, and explicit MIME override precedence

Remote Linux validation

  • git diff --check
  • bundle install
  • ./scripts/lint
  • ./scripts/test

Signed-off-by: Jeet Dekivadia <jeet.university@gmail.com>
@jeet-dekivadia jeet-dekivadia requested a review from a team as a code owner May 30, 2026 09:20
@jeet-dekivadia

Copy link
Copy Markdown
Author

Small follow-up while this is waiting for review. The content-type inference only fills in common document uploads by filename extension when the caller has not already supplied an explicit Anthropic::FilePart#content_type. Explicit content types stay authoritative, and unknown extensions continue to use the existing octet-stream fallback.

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