openai.ex
openai.ex copied to clipboard
Feature: Atomize string keys in stream responses
Describe the feature or improvement you're requesting
Currently when stream: true
is set, we're receiving responses with string keys:
%{
"choices" => [
%{"delta" => %{"role" => "assistant"}, "finish_reason" => nil, "index" => 0}
],
"created" => 1682700668,
"id" => "chatcmpl-7ALbIuLju70hXy3jPa3o5VVlrxR6a",
"model" => "gpt-3.5-turbo-0301",
"object" => "chat.completion.chunk"
}
In line with the standard (non-stream) responses, I'd expect this map to use atom keys i.e.
%{
choices: [
%{delta: %{role: "assistant"}, finish_reason: nil, index: 0}
],
created: 1682700668,
id: "chatcmpl-7ALbIuLju70hXy3jPa3o5VVlrxR6a",
model: "gpt-3.5-turbo-0301",
object: "chat.completion.chunk"
}
Additional context
No response