dimagi / open-chat-studio

A web based platform for building Chatbots backed by Large Language Models
BSD 3-Clause "New" or "Revised" License
15 stars 7 forks source link

Detect filetype for uploads and let assistants know #601

Closed bderenzi closed 3 months ago

bderenzi commented 3 months ago

Relevant threads on Slack: https://dimagi.slack.com/archives/C05PK63Q89H/p1722930702167019 https://dimagi.slack.com/archives/C05PK63Q89H/p1723539681446419

I am proposing we implement two changes:

  1. For all uploaded files we use the magic library (or similar) to confirm the filetype on the server side.
  2. We append a user message with instructions stating the mimetype of the file.

For # 1, we would ideally send a message back to the user if this was an unsupported filetype and ask them to try again. If that's more complicated, I'd be happy to move that to a separate issue instead of blocking on it.

For # 2, here's a first pass on that instruction:

I have confirmed file is of type `{mimetype}`, so proceed to process it that way without any additional checks.