Skip to content

Commit

Permalink
Tweaks to work with Azure OpenAI service.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulchedrese committed Jan 27, 2024
1 parent 0bd291b commit 7f47c17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/openai_ex/chat_completion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defmodule OpenaiEx.ChatCompletion do
args |> Map.take(@api_fields)
end

@ep_url "/chat/completions"
@ep_url "/chat/completions?api-version=2023-12-01-preview"

@doc """
Calls the chat completion 'create' endpoint.
Expand Down
3 changes: 2 additions & 1 deletion lib/openai_ex/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ defmodule OpenaiEx.Http do

@doc false
def headers(openai = %OpenaiEx{}) do
base = [{"Authorization", "Bearer #{openai.token}"}]
# base = [{"Authorization", "Bearer #{openai.token}"}]
base = [{"api-key", "#{openai.token}"}]

org =
if is_nil(openai.organization), do: [], else: [{"OpenAI-Organization", openai.organization}]
Expand Down

0 comments on commit 7f47c17

Please sign in to comment.