openai / openai-python

The official Python library for the OpenAI API
https://pypi.org/project/openai/
Apache License 2.0
22.92k stars 3.21k forks source link

use openai cli "chat_completions.create" failed to generate a response of sufficient length, and setting "--max-tokens" did not work. #283

Closed oiuv closed 1 year ago

oiuv commented 1 year ago

Describe the bug

use openai cli “chat_completions.create" failed to generate a response of sufficient length, and setting "--max-tokens" did not work.

To Reproduce

By default, the number of tokens the model can return will be (4096 - prompt tokens). but not in cli mode

Code snippets

openai api chat_completions.create  -m gpt-3.5-turbo -g user '请给出10个使用chatGPT的示例'

OS

Ubuntu

Python version

Python v3.10.6

Library version

openai v0.27.0

hallacy commented 1 year ago

What happened when you tried to set --max-tokens? Do you have output showing it not generating enough tokens?

oiuv commented 1 year ago

What happened when you tried to set --max-tokens? Do you have output showing it not generating enough tokens?

just like this:

openai api chat_completions.create -m gpt-3.5-turbo -g user "20 examples of AI applications" -M 2048

1. Intelligent virtual assistants like Siri, Alexa, and Google Assistant
2. Chatbots for customer service and support
3. Spam filters for email
4. Predictive text and autocorrect in messaging apps
5. Fraud detection in financial transactions
6. Personalized product recommendations on e-commerce sites
7. Sentiment analysis of social media posts and customer reviews
8. Image and speech recognition for security and surveillance
9. AI-powered medical diagnosis and treatment recommendations
10. Intelligent

Incomplete content display~

Versus2017 commented 1 year ago

I have the same issue, Incomplete content display~ happened to me. and it will stuck for a long time. no response!

einarpersson commented 1 year ago

Same problem here!