Implement `finish_reason` in API response
Created by: frankxu2004
🚀 Feature Request
Implement finish_reason
as in the OpenAI API specification. Currently it's default to "length"
.
Motivation
It is useful for saving generation times and generate only until needed. It is especially useful for interactive prompt-based NLP tasks.
Note that the finish_reason
field in the response should be under response["choices"][0]["finish_reason"]
instead of response["choices"][0]["logprobs"]["finish_reason"]
as implemented now in https://github.com/facebookresearch/metaseq/blob/51871bd73cd04c038f239ea2a26db1d7f6b37927/metaseq/service/responses.py#L33