mochi-neko / ChatGPT-API-unity

A client library of ChatGPT chat completion API for Unity.
MIT License
117 stars 14 forks source link

CompleteChatAsStreamAsync example #6

Closed SeanBannister closed 1 year ago

SeanBannister commented 1 year ago

Thanks for this project, as someone new to C# I would love an example of using CompleteChatAsStreamAsync. I totally appreciate that this might not be a priority but I'm sure it'd help other people looking into this project.

I've been running into problems returning the results and can't quite seem to get it working.

mochi-neko commented 1 year ago

Thank you for your request.

OK, I am going to support stream option by IAsyncEnumerable and add an example code.

Please wait a moment.

SeanBannister commented 1 year ago

That would be awesome thanks so much.

mochi-neko commented 1 year ago

I added streaming API support as IAsyncEnumerable by ver0.7.0.

You can take chunk (= delta of completion result) by await foreach.

Please check streaming sample code.

SeanBannister commented 1 year ago

This is awesome, thank you so much.