Support for PDF files as base64 of the OpenAI SDK

Christian Korherr 0 Reputation points
2025-03-26T06:58:13.5833333+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"
  }
}
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,915 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Christian Korherr 0 Reputation points
    2025-04-01T05:13:35.91+00:00

    For everyone interested, you can vote for the feature here: https://feedback.azure.com/d365community/idea/5c414e8f-d40a-f011-a4de-6045bdbc7eba

    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.