Troubleshooting of OpenAI API: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:
* Solution: Refresh the webpage https://chat.openai.com/chat
* Solution: Refresh the webpage https://chat.openai.com/chat


=== How to fix 'messages' is a required property ===
=== How to fix "messages is a required property" ===
* Error message: 'messages' is a required property
* Error message: 'messages' is a required property
* Example Input
* Example Input
Line 59: Line 59:
</pre>
</pre>


=== How to fix None is not of type 'string' - 'messages.1.content' ===
=== How to fix "None is not of type string - messages.1.content" ===
* Error message: None is not of type 'string' - 'messages.1.content'
* Error message: None is not of type 'string' - 'messages.1.content'
* Example Input
* Example Input
Line 107: Line 107:
* 或「使用臺灣常用的繁體中文」
* 或「使用臺灣常用的繁體中文」


== Related pages ==
* [[ChatGPT prompts]]


== Further reading ==
== Further reading ==

Revision as of 14:31, 3 April 2023

Troubleshooting of OpenAI API

How to fix "The message you submitted was too long"

  • Error message: "The message you submitted was too long, please reload the conversation and submit something shorter."
  • Solution: Reduce the length of an input message to less than 15,000 characters. The exact characters limit is not listed on official document, 17,000 characters will not allowed in my experience[1].

How to fix "An error occurred"

  • Error message: "An error occurred. If this issue persists please contact us through our help center at help.openai.com."
  • Solution: Refresh the webpage https://chat.openai.com/chat

How to fix "messages is a required property"

  • Error message: 'messages' is a required property
  • Example Input
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
  }
  • Solution: Check the payload data if the messages property is exists e.g.
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": [
            {"role": "system", "content": "#zh-TW You are a helpful assistant. Help me to summarize the article"},
            {"role": "user", "content": "YOUR ARTICLE ... ..."}
        ]
  }

How to fix is not of type 'array' - 'messages'

  • Error message: is not of type 'array' - 'messages'
  • Example Input
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": ""
  }
  • Solution: The property messages should an array e.g.
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": [
            {"role": "system", "content": "#zh-TW You are a helpful assistant. Help me to summarize the article"},
            {"role": "user", "content": "YOUR ARTICLE ... ..."}
        ]
  }

How to fix "None is not of type string - messages.1.content"

  • Error message: None is not of type 'string' - 'messages.1.content'
  • Example Input
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": [
            {"role": "system", "content": "#zh-TW You are a helpful assistant. Help me to summarize the article"},
            {"role": "user", "content": null}
        ]
  }
  • Solution: The property messages.1.content should not be null e.g.
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": [
            {"role": "system", "content": "#zh-TW You are a helpful assistant. Help me to summarize the article"},
            {"role": "user", "content": "YOUR ARTICLE ... ..."}
        ]
  }

How to fix "The model `gtp-4` does not exist"

  • Error message: "The model `gtp-4` does not exist"
  • Solution: Go to Models - OpenAI API the check the model list

How to fix "The server had an error while processing your request"

Error message:

The server had an error while processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if the error persists. (Please include the request ID XXXX1 in your message.)

Solution:

強制保持繁體中文輸出

  • 在問題前面加上 #zh-TW [2]
  • 或「使用臺灣常用的繁體中文」


Related pages

Further reading