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

Add a way to stop waiting for response and stop receiving response by StreamCompletionAsync (add CancelationToken parameter)

Open jeffdapaz opened this issue 1 year ago • 2 comments

Hello,

First I would like to congratulate you for your work! This library encouraged me to create the Visual chatGPT Studio extension that uses this library to communicate with OpenAI.

About the issue, one of the users of my extension requested to add a way to stop waiting for the response and also to stop continuing to receive the response when the request is made via StreamCompletionAsync.

I tried to do this on my own but was unsuccessful. I also looked to see if somehow the library allowed this but I didn't find anything.

Is there already a way to do this through the library? If not, would it be possible to add this possibility?

I believe that this possibility from the library would be a great addition.

jeffdapaz avatar May 21 '23 00:05 jeffdapaz

@jeffdapaz , are you looking for something like CancellationToken, that you can use to stop streaming?

zeecorleone avatar Jun 10 '23 10:06 zeecorleone

Hi @zeecorleone,

yes. If there be a way to call the requests and pass as parameter the CancellationToken, problably this will resolve my problem.

But it's seen that is not possible to use CancellationToken as I saw in this issue.

Will be great if there are this possibility.

jeffdapaz avatar Jun 12 '23 19:06 jeffdapaz