ex_openai
ex_openai copied to clipboard
Invalid Request for `Files.create_file`
Hello :wave: and thank you for this neat library.
I ran into the issue below:
ExOpenAI.Files.create_file({"Test Document.pdf", testfile}, "assistants", openai_api_key: api_key)
{:error,
%{
"error" => %{
"code" => nil,
"message" => "Additional properties are not allowed ('openai_api_key' was unexpected)",
"param" => nil,
"type" => "invalid_request_error"
}
}}
I was able to fix locally with a modification to client.ex:
multipart_body =
{:multipart,
params
+ |> Enum.into(%{})
+ |> Map.delete(:openai_organization_key)
+ |> Map.delete(:openai_api_key)
+ |> Map.to_list()
|> Enum.map(&multipart_param/1)}
I'm happy to test further and contribute if appropriate.
Thanks for spotting this. Can you create a PR to fix this issue?
The behaviour of stripping the args should probably be aligned with the other methods so we can just re-use the same thing
Sure! Giving it a try now
Released in https://github.com/dvcrn/ex_openai/releases/tag/1.6.0