openai / openai-cookbook

Examples and guides for using the OpenAI API
https://cookbook.openai.com
MIT License
60.36k stars 9.59k forks source link

[PROBLEM&UPDATE FEATURE] Gmail getMetadata does not support and update feature for modify mail labels #1575

Open chanwookpark opened 3 days ago

chanwookpark commented 3 days ago

Hello, I'm following @alwestmo-openai 's Gmail action cookbook to study and appreciate the work. Thank you!

Describe the problem After testing, I found that the getEmailMetadata action is no longer supported by the Gmail API, which causes a 404 error when querying emails in the prompt.

Describe a solution When I remove getEmailMetadata and run the action, it works well with readEmail. So, I would like to ask if we need to remove the getEmailMetadata related parts from the schema.

Request to Add feature Additionally, I’ve added a schema to change email labels as shown below. I’ve created it to check emails and mark them as read, and I thought it might be a good idea to add it to the cookbook. If you think adding it to the cookbook would be useful, I will submit a PR.

openapi: 3.1.0
info:
  title: Gmail Email API
  version: 1.0.0
  description: API to read, write, and send emails in a Gmail account.
servers:
  - url: https://gmail.googleapis.com
paths:
  …
  /gmail/v1/users/{userId}/messages/{id}/modify:
    post:
      summary: Modify label
      description: Modify label of email.
      operationId: modifyLabels
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
          description: The user's email address. Use "me" to indicate the authenticated user.
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the email to change labels.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Label'
      responses:
        '200':
          description: Modify label success successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal Server Error       
components:
  schemas:
    Label:
      type: object
      properties:
        addLabelIds:
          type: array
          items:
            type: string
        removeLabelIds:
          type: array
          items:
            type: string
…

Thanks! :)

alwestmo-openai commented 3 days ago

Thanks for sharing! Please submit a PR for review!

On Mon, Nov 25, 2024 at 12:32 PM chanwook @.***> wrote:

Hello, I'm following @alwestmo-openai https://github.com/alwestmo-openai 's Gmail action cookbook https://github.com/openai/openai-cookbook/blob/main/examples/chatgpt/gpt_actions_library/gpt_action_gmail.ipynb to study and appreciate the work. Thank you!

Describe the problem After testing, I found that the getEmailMetadata action is no longer supported by the Gmail API, which causes a 404 error when querying emails in the prompt.

Describe a solution When I remove getEmailMetadata and run the action, it works well with readEmail. So, I would like to ask if we need to remove the getEmailMetadata related parts from the schema.

Request to Add feature Additionally, I’ve added a schema to change email labels as shown below. I’ve created it to check emails and mark them as read, and I thought it might be a good idea to add it to the cookbook. If you think adding it to the cookbook would be useful, I will submit a PR.

openapi: 3.1.0 info: title: Gmail Email API version: 1.0.0 description: API to read, write, and send emails in a Gmail account. servers:

  • url: https://gmail.googleapis.com paths: … /gmail/v1/users/{userId}/messages/{id}/modify: post: summary: Modify label description: Modify label of email. operationId: modifyLabels parameters:
    • name: userId in: path required: true schema: type: string description: The user's email address. Use "me" to indicate the authenticated user.
    • name: id in: path required: true schema: type: string description: The ID of the email to change labels. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Label' responses: '200': description: Modify label success successfully content: application/json: schema: $ref: '#/components/schemas/Message' '400': description: Bad Request '401': description: Unauthorized '403': description: Forbidden '500': description: Internal Server Error components: schemas: Label: type: object properties: addLabelIds: type: array items: type: string removeLabelIds: type: array items: type: string …

Thanks! :)

— Reply to this email directly, view it on GitHub https://github.com/openai/openai-cookbook/issues/1575, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ5SX6TYS77RAMMG5L3J5632CNNL3AVCNFSM6AAAAABSOQWDLSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY4TCNJXGY3TEOI . You are receiving this because you were mentioned.Message ID: @.***>