Skip to content

Commit

Permalink
Remove passed tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
dvcrn committed Jan 31, 2025
1 parent 1905dc5 commit 73a8679
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ex_openai/streaming_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,16 @@ defmodule ExOpenAI.StreamingClient do
case Jason.decode(attempt) do
{:ok, decoded} ->
# Once successfully decoded, forward, and reset partial buffer
message = st.convert_response_fx.({:ok, decoded})
forward_response(st.stream_to, {:data, message})
case st.convert_response_fx.({:ok, decoded}) do
{:ok, message} ->
forward_response(st.stream_to, {:data, message})

e ->
Logger.warning(
"Something went wrong trying to decode the response: #{inspect(e)}"
)
end

{"", st}

{:error, _} ->
Expand Down

0 comments on commit 73a8679

Please sign in to comment.