Skip to content

[JS] Bug in OpenAI Compatible API plugin: Not supporting non-image files #3917

@tpiaggio

Description

@tpiaggio

When we have a prompt that has part.media, when using OpenAI we're hard-coding type: 'image_url' and image_url parameter.

type: 'image_url',

This is resulting in errors when we try to do OCR with other types of files:

BadRequestError: 400 Invalid MIME type. Only image types are supported..

As we can see in the official docs, OpenAI supports other type of files. We should be able to, for example, send PDF file inputs as Base64-encoded inputs:

"type": "file",
  "file": {
      "filename": "draconomicon.pdf",
      "file_data": "...base64 encoded bytes here..."
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions