Support for PDF files as base64 of the OpenAI SDK

Christian Korherr 0 Reputation points
2025-03-26T06:48:21.5966667+00:00

Will there be support for PDF files as base64 for the OpenAI SDK?

export namespace ChatCompletionContentPart {
  /**
   * Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text
   * generation.
   */
  export interface File {
    file: File.File;

    /**
     * The type of the content part. Always `file`.
     */
    type: 'file';
  }

  export namespace File {
    export interface File {
      /**
       * The base64 encoded file data, used when passing the file to the model as a
       * string.
       */
      file_data?: string;

      /**
       * The ID of an uploaded file to use as input.
       */
      file_id?: string;

      /**
       * The name of the file, used when passing the file to the model as a string.
       */
      file_name?: string;
    }
  }
}

If I use it I'm getting this error:

{
  "error": {
    "message": "Unknown parameter: 'messages[2].content[0].file.file_name'.",
    "type": "invalid_request_error",
    "param": "messages[2].content[0].file.file_name",
    "code": "unknown_parameter"
  }
}

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
43,358 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Christian Korherr 0 Reputation points
    2025-03-26T07:01:28.7533333+00:00

    I've asked the question again with the right tag: https://learn.microsoft.com/en-us/answers/questions/2238965/support-for-pdf-files-as-base64-of-the-openai-sdk

    I can not delete this question for some reason.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.