How to read/extract text from PDFs through google drive api in custom gpt?

We are facing problem when using Custom GPT actions to read a PDF file stored on Google Drive, Although the connection to the Google API works perfectly for Google Docs, it seems unable to read or extract the text from PDF files. I’m attaching the problem message given by Custom GPT for your reference and the schema we used (1st schema is accessing and downloading the pdf file but could not able to read the content where as in the 2nd schema we wanted to change its document’s format from pdf and then try to read it but we unable to do it) .

openapi: 3.1.0
info:
  title: Google Drive PDF API
  description: API to interact with Google Drive for handling PDF files, including listing, downloading, and converting PDF files.
  version: 1.0.0
servers:
  - url: https://www.googleapis.com/drive/v3
    description: Google Drive API v3
paths:
  /files:
    get:
      operationId: listPDFFiles
      summary: List PDF files in Google Drive
      description: Retrieves a list of PDF files in the user's Google Drive.
      parameters:
        - name: q
          in: query
          description: Query string for searching files. Only PDFs will be returned.
          required: false
          schema:
            type: string
            example: "mimeType='application/pdf'"
        - name: fields
          in: query
          description: Selector specifying a subset of fields to include in the response.
          required: false
          schema:
            type: string
            example: "files(id,name,mimeType)"
      responses:
        '200':
          description: A list of PDF files
          content:
            application/json:
              schema:
                type: object
                properties:
                  files:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        mimeType:
                          type: string
  /files/{fileId}:
    get:
      operationId: downloadPDFFile
      summary: Download a PDF file from Google Drive
      description: Downloads a PDF file from Google Drive by its file ID.
      parameters:
        - name: fileId
          in: path
          description: The ID of the PDF file to download.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: PDF file downloaded successfully
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
  /files/{fileId}/export:
    get:
      operationId: convertPDFFile
      summary: Convert a PDF file to another format
      description: Converts a PDF file from Google Drive to a specified format (e.g., text or image).
      parameters:
        - name: fileId
          in: path
          description: The ID of the PDF file to convert.
          required: true
          schema:
            type: string
        - name: mimeType
          in: query
          description: The MIME type of the format to convert the PDF file to. Example formats could include "text/plain" or "image/png".
          required: true
          schema:
            type: string
            example: "text/plain"
      responses:
        '200':
          description: PDF file converted successfully
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: query
      name: key
  schemas:
    File:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        mimeType:
          type: string
security:
  - apiKeyAuth: []

schema 2:

openapi: 3.1.0
info:
 title: Google Drive PDF API
 description: API to interact with Google Drive for handling PDF files, including listing and downloading PDF files.
 version: 1.0.0
servers:
 - url: https://www.googleapis.com/drive/v3
   description: Google Drive API v3
paths:
 /files:
   get:
     operationId: listPDFFiles
     summary: List PDF files in Google Drive
     description: Retrieves a list of PDF files in the user's Google Drive.
     parameters:
       - name: q
         in: query
         description: Query string for searching files. Only PDFs will be returned.
         required: false
         schema:
           type: string
           example: "mimeType='application/pdf'"
       - name: fields
         in: query
         description: Selector specifying a subset of fields to include in the response.
         required: false
         schema:
           type: string
           example: "files(id,name,mimeType)"
     responses:
       '200':
         description: A list of PDF files
         content:
           application/json:
             schema:
               type: object
               properties:
                 files:
                   type: array
                   items:
                     type: object
                     properties:
                       id:
                         type: string
                       name:
                         type: string
                       mimeType:
                         type: string
 /files/{fileId}:
   get:
     operationId: downloadPDFFile
     summary: Download a PDF file from Google Drive
     description: Downloads a PDF file from Google Drive by its file ID.
     parameters:
       - name: fileId
         in: path
         description: The ID of the PDF file to download.
         required: true
         schema:
           type: string
     responses:
       '200':
         description: PDF file downloaded successfully
         content:
           application/octet-stream:
             schema:
               type: string
               format: binary
 /files/{fileId}/export:
   get:
     operationId: convertPDFFile
     summary: Convert a PDF file to another format
     description: Converts a PDF file from Google Drive to a specified format (e.g., text or image).
     parameters:
       - name: fileId
         in: path
         description: The ID of the PDF file to convert.
         required: true
         schema:
           type: string
       - name: mimeType
         in: query
         description: The MIME type of the format to convert the PDF file to. Example formats could include "text/plain" or "image/png".
         required: true
         schema:
           type: string
           example: "text/plain"
     responses:
       '200':
         description: PDF file converted successfully
         content:
           application/octet-stream:
             schema:
               type: string
               format: binary
components:
 securitySchemes:
   apiKeyAuth:
     type: apiKey
     in: query
     name: key
 schemas:
   File:
     type: object
     properties:
       id:
         type: string
       name:
         type: string
       mimeType:
         type: string
security:
 - apiKeyAuth: []

The goal is to use the Google Drive API to access and retrieve these PDF files, and then use a custom GPT (Generative Pre-trained Transformer) model to read and extract text from them. The extracted text will be used for further processing.

Expected Outcome: A solution that can access PDF files in Google Drive, extract the text from them, and integrate this text with a custom GPT model for various applications, such as content analysis or automated summarization.

As a test, have it try to read or extract a txt file from your Google Drive.

Yes, it is listing the PDFs from the drive and downloading them as well. But when I try to convert them to any readable format, it prompts me to sign in again, as shown in the picture below.

I’m facing the exact same issue. Did you find a solution?