OpenAI-API-dotnet icon indicating copy to clipboard operation
OpenAI-API-dotnet copied to clipboard

Remove UserInput

Open j4587698 opened this issue 2 years ago • 4 comments

The maximum number of tokens in GPT3.5 is 4096, so after multiple calls to AppendUserInput, it may exceed 4096. How can I remove early input and corresponding Assistant?

j4587698 avatar Apr 05 '23 01:04 j4587698

I would also like to implement this.

birkb85 avatar Apr 19 '23 14:04 birkb85

I’m working on a way to fix this, hope to have it landed this week. Thanks for your patience!

OkGoDoIt avatar Apr 19 '23 20:04 OkGoDoIt

I am facing this problem too. Please fix this. I also can't remove messages from Chat Request through my codes to create a workaround. Messages inside ChatRequest is a readonly list.

gunpal5 avatar Apr 21 '23 17:04 gunpal5

I found me a temporary solution.

When the number of conversation messages is greater than x I create a new conversation and append the last x number of messages from the previous conversation.

If I then set MaxTokens for the completion to a number which multiplied with the number of messages I am keeping in history is lower than the token limit, it is hopefully all right.

Its probably not the most optimal solution but I think it works. Good enough for me at least, until a better solution is provided.

Great library by the way. 👍 Good work.

birkb85 avatar Apr 22 '23 04:04 birkb85