openai
openai copied to clipboard
Support .NET Standard 2.0
Things that were added/changed.
- Add UnitTest Project for net6.0 and net48
- Add missing packages for netstandard2.0
- Change interface methods to extension
- Change
PostAsStreamAsync
to async
thanks for the contribution, but it is quite a big one. Next time if you can create with small changes it would be easier to review.
The first thing I have noticed with these changes we lose the async stream ability. The method waits until the whole response is completed. Please compare in the playground before your changes and after.
I found a little odd that the method PostAsStreamAsync was not async, but the name of the method is so I changed. And the netstandard does not have Send method in the client that's the reason I changed, are you sure the method was working async, I try to create a test for test that but I'm not sure if is working like before.
I only changed that was necessary to make work with netstandard, add the Test just to make sure does not break anything.
Please check this comment (https://github.com/betalgo/openai/pull/73#issuecomment-1385371235). We struggled a bit to make this method work. I will check it to see if it fits with the suggested implementation whenever I have time. currently, in the master branch, it works.
with .netstandart2 support, we may need to consider creating a new project in the solution. I just created a discussion about this https://github.com/betalgo/openai/discussions/86. It would be nice to see your thoughts there
I gonna create a new branch and create a unit test project to see how the PostAsStreamAsync
works without the change.
I gonna create a new branch and create a unit test project to see how the
PostAsStreamAsync
works without the change.
I didn't find any difference between the master
and the unit_test
versions of the CreateCompletionAsStream
.
I tested it in the Playground and works in the same way...
- https://github.com/ricaun/openai/tree/unit_test
I will prepare a video to show the difference as soon as I find some time.
https://youtu.be/rGc1X2aD2ms As I promised I made a video. At the first run(current dev branch), you can see stream data shown as soon as we received it. At the second run(your PR) We are waiting for the completion of the entire stream.
https://github.com/betalgo/openai/tree/feature/DotNetStandardSupport I have created a new branch for .dotnet standard support. I think it is better to keep it as a separate project. So this way it doesn't slow us while we update the .net 6 project. Currently, there are 5 build time errors in the project, which you already solved in your pr. Could you apply your changes there?
Completed in a different branch and released as part of v6.8.0