GPT4 stopping for length with a short message

Hi, running a couple prompts in gpt4, and getting the following response:

{'prompt_tokens': 652, 'completion_tokens': 999, 'total_tokens': 1651}

all this while

{'finish_reason': 'length'}

Is there some length limitation I’m not aware of?

1 Like

What was your max_token value set to for the API call?

a finish_reason of “length” means that the AI had more data to output but the limitations of that call prevented it from finishing.

3 Likes

Thanks! missed some cap by user API :blush:

The max_tokens is answered in the question, 999.

The API user set their own length limitation.

Reminder: tokens is not words, it is an encoding method, about 1.5 token per word of English, and can be significantly more in other languages, up to three tokens per Chinese character.