Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the last empty assistant message for ChatGPT API call #222

Merged
merged 2 commits into from
Jun 17, 2023

Conversation

bhy
Copy link
Contributor

@bhy bhy commented Jun 12, 2023

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 and others added 2 commits June 12, 2023 23:51
Allow for partial content in case open ai eventually supports that, also clean up the whitespace handling.
@slundberg
Copy link
Contributor

Thanks! I tweaked things to be a bit more future compatible, and handle whitespace more cleanly. Will merge soon :)

@codecov-commenter
Copy link

codecov-commenter commented Jun 17, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@d6b855a). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #222   +/-   ##
=======================================
  Coverage        ?   70.15%           
=======================================
  Files           ?       49           
  Lines           ?     2858           
  Branches        ?        0           
=======================================
  Hits            ?     2005           
  Misses          ?      853           
  Partials        ?        0           

@slundberg slundberg merged commit 5f7fa7f into guidance-ai:main Jun 17, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants