Add initial ChatGPT support to release notes script#183
Conversation
|
Pull requests must include at least one of the required labels: |
|
I updated the editing instructions to include our style guide: |
|
Hm, I just tried this with an OpenAI API key I generated but I think I don't have the right permissions on my account to be able to run the script correctly. (I also got the "exceeds token length" one when I tried with our shared API key saved in 1Password.) Again, might be a user error day 😓 |
'Exceeds token length' is not so much an error as a feature, it just means you've passed more text to ChatGPT than it can digest in one go. There are a few ways around this (chunk, sequential input) but the current version doesn't handle this. Generally, release notes should be short and for cases like really long ones, you probably want a human to take a closer look anyway. I can demo this when we meet but basically the script should run like it did before, only it now also edits the release notes text and PR titles with calls to a new function that feeds the content to ChatGPT with a prompt and your style guide. |
|
FYI, I broke something in this script when I added more editing instructions. Please hold off on reviewing until it's fixed! |
|
OK, I have a fix working locally — somewhere along the way of cleaning up the script to get it ready for review, I broke the logic for edited content and didn't notice. 🙃 My apologies, especially to @validbeck! I'm making some additional improvements to the script now to handle longer release notes that exceed the maximum token length and then I will ask you to review again when ready. [Elevator music ...] |
|
OK, so after spending several more hours on this, I've come to the conclusion that the script works as intended and might always have worked that way. Every once in a while, ChatGPT simply returns what it was given but it seem to be an issue with ChatGPT rather than the script. It is possible this is what was happening earlier today, but I have no way of proving this. I have removed the style guide from the editing instructions as it seems to make the output less predictable and might have contributed to the issue. Instead, I have added some more short editing instructions right into the script. I've also reworked how we pass the prompt to ChatGPT a bit, experimenting with several different options. We continue to pass system and user prompts separately, as in the original script, after an interim experiment of combining the two. Some editing examples:
--
--
--
--
|
|
Also, I was able to figure out the maximum token length issue: the issue was with the API call itself and how Since the script can take a minute or two to run, I also added some additional processing output. Here's a clean run that edited the release notes with no maximum token errors from the OpenAI API: |
validbeck
left a comment
There was a problem hiding this comment.
It works now! Shame about the style guide assist, but it sparks the conversation around edits anyway which is half the battle. :)
|
@validbeck in case it's helpful, I just created a quick pull request with this PR here: #185 |
Ah, just saw you approved — thank you! Yes, this works but let's tweak the editing instructions as we gain more experience with ChatGPT. Thank you so much for re-reviewing! |
Internal Notes for Reviewers
This PR borrows some ideas from Andres' gist and adds editing via ChatGPT to our release notes script. The editing instructions mirror what I have been using with ChatGPT manually and now also include a pointer to our new style guide.
You can test with
make release-notes(read the process doc). The output example uses these release URLs:Requires an OpenAI API key in a .env file in the same path.
Caveats:
Output example
External Release Notes