Skip to content

No easy way to reuse an uploaded file from its id聽#417

Closed

Description

@thisisnic

I've just implemented tidyverse/ellmer#1119 aimed at improving a bit of UX in ellmer; here's the 馃 summary of the equivalent in chatlas:

Once a file has been uploaded, reusing it in a later session means rebuilding the ContentUploaded yourself from what chat.files.get() returns:

from chatlas import ChatAnthropic, ContentUploaded

chat = ChatAnthropic()
meta = chat.files.get("file_011CRabc...")
report = ContentUploaded(id=meta.id, mime_type=meta.mime_type, provider=meta.provider)
chat.chat("Summarize the key findings.", report)

That works for Anthropic and Google, but fails for OpenAI because its file_get() sets mime_type=None and ContentUploaded.mime_type is a required str, so you have to guess the type from meta.filename yourself. ellmer is resolving this by having chat$file_get() return a ContentUploaded with the metadata on extra and guessing OpenAI's MIME type from the filename (tidyverse/ellmer#1116, tidyverse/ellmer#1119). Might be worth aligning, either by doing the same or by adding a FileMetadata.to_content() helper.

Activity

  1. added
    Priority: LowLow-impact bug, docs polish, papercut, or unclear low-severity request.
    ai-triage:doneMarks an issue whose AI triage workflow is complete.
    on Sep 3, 2026
  2. AbarnaaSree commented on Sep 9, 2026

    @AbarnaaSree

    Hi, I鈥檇 like to work on this issue. I can look into adding a convenient way to convert FileMetadata into ContentUploaded, including handling the missing MIME type for OpenAI files, and add tests to cover the different providers. Please let me know if I can take this up.

  3. added a commit that references this issue on Oct 12, 2026
    97723da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: LowLow-impact bug, docs polish, papercut, or unclear low-severity request.ai-triage:doneMarks an issue whose AI triage workflow is complete.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions