Skip to content

chatgpt command limit response length #840

Closed

Description

@marko-radosavljevic

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.

Activity

  1. added
    bug
    on May 23, 2023
  2. tmcdonnell2 commented on May 24, 2023

    @tmcdonnell2
    Contributor

    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?

  3. marko-radosavljevic commented on May 24, 2023

    @marko-radosavljevic
    ContributorAuthor

    Sending the rest as a separate message is probably the best solution, because getting another response would likely be too slow?

  4. github-actions commented on Jun 24, 2023

    @github-actions

    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.

  5. added
    inactivity-closed
    on Jun 24, 2023
  6. added
    valid
    and removed
    inactivity-closed
    on Jun 30, 2023
  7. r4huldeveloper commented on Jul 23, 2023

    @r4huldeveloper

    I want to work on this bug , can you please tell me is it about gpt 3.5 or gpt 4?

  8. Zabuzard commented on Jul 25, 2023

    @Zabuzard
    Member

    gpt 3.5

  9. r4huldeveloper commented on Jul 25, 2023

    @r4huldeveloper

    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.

  10. Zabuzard commented on Jul 25, 2023

    @Zabuzard
    Member

    or we post multiple embeds, as originally intended.

  11. r4huldeveloper commented on Jul 25, 2023

    @r4huldeveloper

    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

  12. Zabuzard commented on Jul 25, 2023

    @Zabuzard
    Member

    @tmcdonnell2 are u still on it, or can @r4huldeveloper take over? do u perhaps have some unmerged changes ready?

  13. r4huldeveloper commented on Jul 25, 2023

    @r4huldeveloper

    @Zabuzard Sir we just need to half the response given by gpt , right?

  14. tmcdonnell2 commented on Jul 25, 2023

    @tmcdonnell2
    Contributor

    @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.

  15. linked a pull request that will close this issueChat gpt attempt questions #865on Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugvalid

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions