Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the tesla adapter protocols to use http1 #3

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/openai/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ defmodule OpenAI.Client do
def with_stream_opts(%{stream: true}, opts) do
# This looks weird, but is the format that Tesla requires in order to
# properly set the adapter options.
Keyword.put(opts, :opts, adapter: [body_as: :stream])
# The protocols is part of an open issue with Tesla where HTTP2 cannot upload more than 65535 bytes
Keyword.put(opts, :opts, adapter: [body_as: :stream, protocols: [:http1]])
end

def with_stream_opts(_params, opts), do: opts
def with_stream_opts(_params, opts) do
# The protocols is part of an open issue with Tesla where HTTP2 cannot upload more than 65535 bytes
Keyword.put(opts, :opts, adapter: [protocols: [:http1]])
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule OpenAI.MixProject do
def project do
[
app: :openai_client,
version: "0.4.1",
version: "0.4.2",
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
Expand Down