Created on 22 May 2023, about 1 year ago
Updated 30 August 2023, 10 months ago

How does this module handle OpenAI rate limits?

For example, if I have a 45,000 word body field and I send that to OpenAI to summarize, shouldn't that hit the TPM (tokens per minute) rate limit? I attempted this, and it appeared to work fine (without hitting a limit). What am I missing?

I'm using a paid account.

thanks,
-mike

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States ultimike Florida, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ultimike
  • 🇺🇸United States kevinquillen

    There are hardcoded limits in place currently for openai_content, which is why it may appear to work:

        $body = StringHelper::prepareText($body, [], 3900);
    
        $response = $client->completions()->create(
          [
            'model' => 'text-davinci-003',
            'prompt' => 'Create a detailed summary of the following text in less than 130 words:\r\n"' . $body . '"',
            'temperature' => 0.7,
            'max_tokens' => 2048,
          ],
        );
    

    A few action items to do is to enable it to look at any node text field as well as open up the model to use. There are one or two other issues where its been discussed to obtain a token counter for PHP so we can get right on the edge of a request limit.

  • 🇮🇳India saranyamariappan

    I have tried to install the openai on my fresh Drupal10 and I really excited to see the wonders that openai can do on my local Drupal setup while creating content on Basic Page content type on Basic HTML CKEditor but it throws Website encountered error.

    When I do check the watchdog, I got OpenAI\Exceptions\ErrorException: You exceeded your current quota, please check your plan and billing details. in OpenAI\Transporters\HttpTransporter->throwIfJsonError() (line 130 of /var/www/html/vendor/openai-php/client/src/Transporters/HttpTransporter.php).

    Do we have any sandbox accounts to playaround on openai before going for paid version. Please advise. I am documenting this openai setup and all cases to mentor my team.

    Thanks in advance.

  • 🇺🇸United States kevinquillen

    No, API keys are designated through OpenAI, not from us.

  • 🇮🇳India saranyamariappan

    Hi @ Kevinquillen → ,

    I want to install and use the OpenAI and its submodules to generate text for my Basic Page Content Type. I have created account on platform.openai.com and I have added my OpenAI Key copied from the openai.com on the settings forms of my local D10. But I am getting Website encountered error on the CKEditor.

    When I check the watchdog, I got

    OpenAI\Exceptions\ErrorException: You exceeded your current quota, please check your plan and billing details. in OpenAI\Transporters\HttpTransporter->throwIfJsonError() (line 130 of /var/www/html/vendor/openai-php/client/src/Transporters/HttpTransporter.php).

  • 🇮🇳India saranyamariappan

    Attaching this screenshot for your better understanding.

  • 🇺🇸United States kevinquillen

    Is it mandatory to go for Payment plan on Openai.com to use the OpenAI Drupal contributed Module

    Yes, this is dictated by OpenAI, not us.

Production build 0.69.0 2024