mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
fix iteration error (#208)
* fix iteration error array iteration error: sentences up till max_len of token exceeds should be returned * split list once instead of twice split list once instead of twice and take parsed string up till max token length is exceeded
This commit is contained in:
parent
feb53449e0
commit
3dde564948
@ -154,7 +154,7 @@
|
||||
" for i, sentence in enumerate(sentences):\n",
|
||||
" ntokens += 1 + count_tokens(sentence)\n",
|
||||
" if ntokens > max_len:\n",
|
||||
" return \". \".join(sentences[:i][:-1]) + \".\"\n",
|
||||
" return \". \".join(sentences[:i]) + \".\"\n",
|
||||
"\n",
|
||||
" return long_text\n",
|
||||
"\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user