Closed dvcrn closed 8 months ago
Instead of spawning a new process, simplify handling of streams a bit with a callback function:
callback = fn :finish -> IO.puts "Done" {:data, data} -> IO.puts "Data: #{inspect(data)}" {:error, err} -> IO.puts "Error: #{inspect(err)}" end ExOpenAI.Completions.create_completion "text-davinci-003", "hello world", stream: true, stream_to: callback
Inspired by finch
Instead of spawning a new process, simplify handling of streams a bit with a callback function:
Inspired by finch