cohere-python
cohere-python copied to clipboard
Incorrect `finish_reason` for `generate`?
I'm not sure if this is the right place to ask this, but generate with max_tokens=3 finshes with finish_reason=COMPLETE
$ curl --request POST \
--url https://api.cohere.ai/v1/generate \
--header 'accept: application/json' \
--header "authorization: Bearer $COHERE_API_KEY" \
--header 'content-type: application/json' \
--data '
{
"max_tokens": 3,
"stream": true,
"prompt": "Please explain to me how LLMs work"
}
'
{"text":" LL","is_finished":false}
{"text":"Ms","is_finished":false}
{"text":",","is_finished":false}
{"is_finished":true,"finish_reason":"COMPLETE","response":{"id":"05835269-8d06-422d-8f4e-fc3e8a2b8a96","generations":[{"id":"73b93e8c-ee35-4831-a3be-c7534b31dbb9","text":" LLMs,","finish_reason":"COMPLETE"}],"prompt":"Please explain to me how LLMs work"}}
Should it finish with MAX_TOKENS?
Hi @harupy, I'm not sure this is the best place to ask your question since it is not really related to Python's SDK per se. Indeed, your question is related to a CURL query.
You would stand a better chance to get a prompt answer by asking your question on Cohere's Discord community, in the #general-chat channel.
However, I'm not able to reproduce, since I get MAX_TOKENS as expected:
$ curl --request POST \
--url https://api.cohere.ai/v1/generate \
--header 'accept: application/json' \
--header "authorization: Bearer $COHERE_API_KEY" \
--header 'content-type: application/json' \
--data '
{
"max_tokens": 3,
"stream": true,
"prompt": "Please explain to me how LLMs work"
}
'
{"text":" LL","is_finished":false}
{"text":"Ms","is_finished":false}
{"text":",","is_finished":false}
{"is_finished":true,"finish_reason":"MAX_TOKENS","response":{"id":"379fb392-fa7c-4e26-9940-0e0a5b057b08","generations":[{"id":"fa961ef2-6f0e-4fc6-98eb-0df16e9960c5","text":" LLMs,","finish_reason":"MAX_TOKENS"}],"prompt":"Please explain to me how LLMs work"}}
Can you try again to see if you still encounter this issue?