You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chatgpt command will crash if the response is over 2000 characters. To prevent that, we have to limit the response.
Just limiting the max tokens is a bad solution, because it would cut the answer short. Getting a guide or a code solution that is 90% there is not very helpful.
The solution is to add 'Answer in 1500 characters or less.' to the user question. And if chatgpt still goes over the limit, we can hard limit to prevent it from crashing.
When you say 'hard limit', do you mean do cut the response off if too long? Or attempt to get another response from chatGPT? Can we cut it in "half" and send the rest as a separate message?
This issue is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.
public static String truncate(String text, int limit) {
if (text.length() <= limit) {
return text;
} else {
return text.substring(0, limit);
}
}
After getting the response from the API, we can implement a method to truncate it if it exceeds the desired character limit.
@tmcdonnell2 are u still on it, or can @r4huldeveloper take over? do u perhaps have some unmerged changes ready?
I have some changes I pushed recently on my branch of the project. It breaks up the response instead of just trimming down the original.
I don't have a PR open but it might be "good enough" to pull and allow for testing in the dev server. It would be best if this time we get a lot of manual/user testing done on it to see where it breaks and get more test cases. I can open a PR later.
Activity
tmcdonnell2 commentedon May 24, 2023
When you say 'hard limit', do you mean do cut the response off if too long? Or attempt to get another response from chatGPT? Can we cut it in "half" and send the rest as a separate message?
marko-radosavljevic commentedon May 24, 2023
Sending the rest as a separate message is probably the best solution, because getting another response would likely be too slow?
github-actions commentedon Jun 24, 2023
This issue is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.
r4huldeveloper commentedon Jul 23, 2023
I want to work on this bug , can you please tell me is it about gpt 3.5 or gpt 4?
Zabuzard commentedon Jul 25, 2023
gpt 3.5
r4huldeveloper commentedon Jul 25, 2023
public static String truncate(String text, int limit) {
if (text.length() <= limit) {
return text;
} else {
return text.substring(0, limit);
}
}
After getting the response from the API, we can implement a method to truncate it if it exceeds the desired character limit.
Zabuzard commentedon Jul 25, 2023
or we post multiple embeds, as originally intended.
r4huldeveloper commentedon Jul 25, 2023
I didn't said I completely know how to do it , but with the help of gpt and docs I can make it correct , so assign me
Zabuzard commentedon Jul 25, 2023
@tmcdonnell2 are u still on it, or can @r4huldeveloper take over? do u perhaps have some unmerged changes ready?
r4huldeveloper commentedon Jul 25, 2023
@Zabuzard Sir we just need to half the response given by gpt , right?
tmcdonnell2 commentedon Jul 25, 2023
I have some changes I pushed recently on my branch of the project. It breaks up the response instead of just trimming down the original.
I don't have a PR open but it might be "good enough" to pull and allow for testing in the dev server. It would be best if this time we get a lot of manual/user testing done on it to see where it breaks and get more test cases. I can open a PR later.