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

Chat gpt attempt questions #865

Closed
wants to merge 43 commits into from
Closed

Conversation

tmcdonnell2
Copy link
Contributor

@tmcdonnell2 tmcdonnell2 commented Jul 25, 2023

New and improved version of ChatGPT posting to Discord:

  • Longer wait time before timeout
  • Break apart responses into max 2000 character limit
  • Included test cases for testing breaking up messages

Also attempts questions posted in the question forum (attempts due to fear of timeouts and the classic "I'm sorry, as a LLM I can't...")

Resolves /issues/814,
Resolves /issues/839,
Resolves /issues/840

tmcdonnell2 and others added 30 commits April 4, 2023 16:39
…iting on time per user. Include modal when no option is included for formatting question to ChatGPT.
- Variable name clean up
- Command now only uses modal
- Remove optional s from string
- CACHE_DURATION -> COMMAND_COOLDOWN
- Unwind if statement
… allow for correct path to indicate to users that something went wrong.
…question. So far, all the system does is read the title and attempt to answer the question. More refinements to come.
…ould come from and if it's asked at all. Code has an error on line 143 of HelpSystemHelper.java.
…sage if possible OR use the title and a shortened version of the message. Appending tags still possible.

- Increase to ChatGptService timeout time. Otherwise, responses would just fail for even slightly complex questions. Also change temperature, which should create more strictly technical answers.
- Tags are only appended if the question is still less than the maximum length.
- Also included info log test to determine what the final question asked is.
- Changed thrown error to mentioning slash command to users instead of silently failing.
- Minor string edits.
- Create method to return information on /chatgpt, used if no useful response or error from AI.
- Improve substring clipping to include space for question construction.
… checking if string contains desired sequence.
- Remove need for question mark in title requirement.
- Pull out question preparation code into own function
- Use orElseThrow() instead of get()
- Use toLowerCase(Locale.US)
- Update StringBuilder variable name to questionBuilder.
- Remove potentially erroneous comment
- Change from 'member' to 'human'
- Refactor 'questionFirstMessage' to 'originalQuestion'
- Refactor code for creating question to improve readability in case of adding question text versus remaining characters for question.
- Include new tagBuilder StringBuilder to decrease insert calls down to one.
- Remove throw block which housed logic.
- Limit length of question string moved to creation of question string
- Remove test for bad AI answer (produces false negatives)
- Increase of timeout time to two minutes.
- Initialize and send setup message to AI per query to restrict answers to limit.

ChatGptServiceTest
- Include new testing suite.
- Include tests to check response time and functioning of error detection.
- Test for length of response from AI to be less than 2000 characters.

ChatGptCommand
- Creation of local variables for better flexibility and readability.

HelpSystemHelper
- Rename variable to better describe use.
- Refactoring to accommodate above change in other classes amd methods.
- Refactor HelpThreadCreatedListener to make creating AI response its own method.
- Refactor HelpSystemHelper.constructChatGptAttempt() to place all required messages from AI response into embeds when answering a question.
…y to only break up by new lines and try not to be in code when doing so.

- Change messages sent from ChatGPT from embeds into plain messages.
- Add ChatGptServiceTest.java for testing AI responses of different length
- Add response.txt which contains test AI responses (just one for now).
- Refactor ChatGptService to not include response parsing/break up. Moved to new util class AIResponseParser
@sonarcloud
Copy link

sonarcloud bot commented Aug 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Taz03
Taz03 previously approved these changes Aug 3, 2023
@tmcdonnell2
Copy link
Contributor Author

When this is pulled, is it possible to have it running on the test server? I am sure there is some edge cases that will come up with more testing/questions. The only thing might be to add a way to save the response from the AI so we can test it again (given that AI usually don't give the same responses twice).

@Taz03
Copy link
Member

Taz03 commented Aug 10, 2023

@Together-Java/moderators

* Update chatgpt package name and refactoring due to change.
@surajkumar surajkumar closed this Aug 16, 2023
@surajkumar surajkumar deleted the chatGPT-attempt-questions branch August 16, 2023 16:25
@surajkumar surajkumar restored the chatGPT-attempt-questions branch August 16, 2023 16:25
@surajkumar surajkumar reopened this Aug 16, 2023
@SquidXTV
Copy link
Member

can I ask why this literally deletes the website?

@tmcdonnell2
Copy link
Contributor Author

can I ask why this literally deletes the website?

I was trying to merge with develop to keep the branch up to date. I think they removed the website from this repository and gave the website its own repository. I am just trying to merge the changes. I ultimately regret trying haha.

@SquidXTV
Copy link
Member

can I ask why this literally deletes the website?

I was trying to merge with develop to keep the branch up to date. I think they removed the website from this repository and gave the website its own repository. I am just trying to merge the changes. I ultimately regret trying haha.

ah ok, but couldnt you not just fetch/pull from develop again, so yours is up-to-date?

@SquidXTV
Copy link
Member

it also shows that your pr is adding the JShell stuff which is simply not true

@tmcdonnell2
Copy link
Contributor Author

can I ask why this literally deletes the website?

I was trying to merge with develop to keep the branch up to date. I think they removed the website from this repository and gave the website its own repository. I am just trying to merge the changes. I ultimately regret trying haha.

ah ok, but couldnt you not just fetch/pull from develop again, so yours is up-to-date?

I believe I have. A lot of merge conflicts emerge that despite fixing can't be merged into the branch? I am very confused. We are trying to reconstruct this branch in another branch. I am wondering if a roll back would be better?

@tmcdonnell2
Copy link
Contributor Author

it also shows that your pr is adding the JShell stuff which is simply not true

Again - because I am trying to merge in from the develop branch. I was just trying to keep it updated with the main branch. Not trying to get credit or anything like that.

I thought keeping the branch as updated with the main branch was a good idea? Or is that not the way to go?

@SquidXTV
Copy link
Member

I believe I have. A lot of merge conflicts emerge that despite fixing can't be merged into the branch? I am very confused. We are trying to reconstruct this branch in another branch. I am wondering if a roll back would be better?

I am not sure how to revert this in the best way, but fetch/pull from develop should update your branch so stuff like the website folder remove or JShell feature add will automatically be in your branch as well

@SquidXTV
Copy link
Member

SquidXTV commented Aug 16, 2023

Again - because I am trying to merge in from the develop branch. I was just trying to keep it updated with the main branch. Not trying to get credit or anything like that.

yeah I wasnt saying that you want credits for that lol
I am just saying that you prob added those files yourself instead of doing fetch/pull

I thought keeping the branch as updated with the main branch was a good idea? Or is that not the way to go?

I think you would even need to fetch/pull new updates before being able to merge

@surajkumar
Copy link
Contributor

yeah the PR is fudged so my advice is to create a new branch and recreate the PR

@SquidXTV
Copy link
Member

yeah the PR is fudged so my advice is to create a new branch and recreate the PR

is it possible that you save your progress and completely roll back your branch + fetch/pull and then add your stuff to it

* Refactor AIResponseParserTest to use ints instead of strings for test parameters.
@tmcdonnell2 tmcdonnell2 deleted the chatGPT-attempt-questions branch August 27, 2023 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new command Add a new command or group of commands to the bot priority: normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chatgpt command limit response length chatgpt command timeouts too early ChatGPT - Answer attempt
4 participants