openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

fix iteration error

Open justanotherlad opened this issue 2 years ago • 3 comments
trafficstars

array iteration error: sentences up till max_len of token exceeds should be returned

Here's a screenshot of before and after the change (vertically in terminal) in the code. Clearly, the below should be returned: (The numbers vertically represent current tokens and total_tokens number for each iteration.

Screenshot from 2023-03-07 21-16-59

justanotherlad avatar Mar 10 '23 21:03 justanotherlad

Great catch and thanks for the super helpful documentation.

Would it be easier just to write sentences[:i] instead of sentences[:i+1][:-1]? Seems odd that the list is being sliced twice in the first place.

But happy to merge as is if you don't feel like doing any extra work. Your work so far is already appreciated.

ted-at-openai avatar Mar 17 '23 00:03 ted-at-openai

Sure, done. That sounds more convenient unless, as I previously thought, some edge cases were trying to be handled.

justanotherlad avatar Mar 17 '23 13:03 justanotherlad

Also, please see my comment on Document Library Pre-Processing #79 . I think there might be a bug there.

justanotherlad avatar Mar 17 '23 13:03 justanotherlad

@ted-at-openai Do you want to close/merge this PR?

justanotherlad avatar Mar 21 '23 19:03 justanotherlad

Thanks! Merged.

ted-at-openai avatar Mar 21 '23 21:03 ted-at-openai