guidance
guidance copied to clipboard
Remove the last empty assistant message for ChatGPT API call
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.