Troubleshooting of OpenAI API: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:


== Troubleshooting of OpenAI API ==
=== How to fix "The message you submitted was too long" ===
=== 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."
* Error message: "The message you submitted was too long, please reload the conversation and submit something shorter."
Line 10: Line 11:
=== 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
* Solution: Check the payload data if the messages property is exists
* Example Input
<pre>
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
  }
</pre>
* Solution: Check the payload data if the messages property is exists e.g.
 
<pre>
{
    "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 ... ..."}
        ]
  }
</pre>
 
=== How to fix '' is not of type 'array' - 'messages' ===
* Error message: '' is not of type 'array' - 'messages'
* Example Input
<pre>
{
    "model": "gpt-4",
    "max_tokens": 1000,
    "temperature": 0.9,
    "messages": ""
  }
</pre>
 
* Solution: The property messages should an array e.g.
 
<pre>
{
    "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 ... ..."}
        ]
  }
</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' ===
Anonymous user

Navigation menu