Troubleshooting of OpenAI API: Difference between revisions
Jump to navigation
Jump to search
Invalid parameter: 'response_format' of type 'json_object' is not supported with this model.
No edit summary |
(Invalid parameter: 'response_format' of type 'json_object' is not supported with this model.) |
||
| Line 120: | Line 120: | ||
"temperature": 0.9, | "temperature": 0.9, | ||
"messages": "" | "messages": "" | ||
} | |||
</pre> | |||
=== How to fix "Invalid parameter: 'response_format' of type 'json_object' is not supported with this model" === | |||
Error message | |||
<pre> | |||
Invalid parameter: 'response_format' of type 'json_object' is not supported with this model. | |||
</pre> | |||
Example Input | |||
<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": null} | |||
] | |||
} | |||
</pre> | |||
Solution: | |||
* The model "gpt-4" was not supported. Need to use model of {{kbd | key=gpt-3.5-turbo-1106}} or {{kbd | key=gpt-4-1106-preview}} <ref>[https://github.com/openai/openai-python/issues/887 response_format error · Issue #887 · openai/openai-python]</ref><ref>[https://platform.openai.com/docs/api-reference/chat/create API Reference - OpenAI API]</ref>. | |||
<pre> | |||
{ | |||
"model": "gpt-4-1106-preview", | |||
"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> | </pre> | ||
| Line 163: | Line 198: | ||
} | } | ||
</pre> | </pre> | ||
=== How to fix "Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out" === | === How to fix "Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out" === | ||