• Resolved Lwifunyo Mangula

    (@lwifunyo)


    When i entered long text i got

    Error while calling OpenAI: This model’s maximum context length is 4097 tokens, however you requested 5893 tokens (4869 in your prompt; 1024 for the completion). Please reduce your prompt; or completion length.

    How can i remove this incase user in frontend ask and then get bad message like that… which has brand of another company?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @lwifunyo,

    This is an error message, from OpenAI; it’s important to keep those errors in order to understand what the problem is, and so that the user can fix it 🙂

    Why would you like to remove it? And if you can remove it, what would you like instead?

    Thread Starter Lwifunyo Mangula

    (@lwifunyo)

    i don’t want my website users at front end to see it, cause it is business

    Plugin Author Jordy Meow

    (@tigroumeow)

    But where do you get this error message? In the ChatBot?

    Thread Starter Lwifunyo Mangula

    (@lwifunyo)

    yes… in chatbot

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    So in case of an error, it would be okay to show something like “System: An error occurred. Please contact us.” and that’s it, right?

    Of course, I will make this message editable, you’ll be able to choose it. But error messages will not be shared with the users anymore.

    Plugin Author Jordy Meow

    (@tigroumeow)

    From version 0.4.8, you will be able to do this:

    add_filter( 'mwai_ai_exception', function ( $exception ) {
      if ( substr( $exception, 0, 26 ) === "Error while calling OpenAI" ) {
        error_log( $exception );
        return "There was an AI system error. Please contact us.";
      }
      return $exception;
    } );
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to remove words like OpenAI when charting from reply?’ is closed to new replies.