anasfik / openai

Dart/Flutter SDK for ChatGPT and all OpenAI APIs (GPT, Dall-e..)
https://pub.dev/packages/dart_openai
MIT License
539 stars 151 forks source link

Can't use createSpeech without saving to file. #168

Open allComputableThings opened 2 months ago

allComputableThings commented 2 months ago

OpenAI.instance.audio.createSpeech insists on saving the result to a file. It doesn't seem necessary (and is problematic for me). (Perhaps it could return the result if the file and directory were null?)

Looking at its implementation, I also can't directly call await OpenAINetworkingClient.post ... since it is not exported.

anasfik commented 1 month ago

Yeah, this makes sense, but what would be the expected behavior here?

dylandhall commented 1 month ago

I'd like to invoke it using a BytesSource: https://pub.dev/documentation/audioplayers/latest/audioplayers/BytesSource-class.html

would that be possible?

dylandhall commented 1 month ago

I have opened a PR that hopefully adds this: https://github.com/anasfik/openai/pull/177

I'm new to Dart so please check it over, it should work however.

Edit: works, example code in PR