guidance icon indicating copy to clipboard operation
guidance copied to clipboard

Remove the last empty assistant message for ChatGPT API call

Open bhy opened this issue 2 years ago • 0 comments

Due to the way the regex was written, currently there is always an empty message produced at the end of messages list, eg: [{'role': 'system', 'content': 'You are a helpful assistant.'}, {'role': 'user', 'content': 'Whats is the meaning of life??'}, {'role': 'assistant', 'content': ''}].

This PR fix the regex and thus remove this empty message.

bhy avatar Jun 12 '23 15:06 bhy