File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ defmodule HyperLLM.Provider.OpenAI do
4848 See `HyperLLM.Chat.completion/3` for more information.
4949 """
5050 @ spec completion ( HyperLLM.Provider . completion_params ( ) , HyperLLM.Provider . completion_config ( ) ) ::
51- { :ok , binary ( ) } | { :error , binary ( ) }
51+ { :ok , map ( ) } | { :error , binary ( ) }
5252 @ impl HyperLLM.Provider
5353 def completion ( params , config \\ [ ] ) do
5454 if ! Map . has_key? ( params , :messages ) do
@@ -71,13 +71,13 @@ defmodule HyperLLM.Provider.OpenAI do
7171 { :ok , body }
7272
7373 % { status: 400 , body: body } ->
74- { :error , body . error . message }
74+ { :error , get_in ( body [ " error" ] [ " message" ] ) }
7575
7676 % { status: 401 } ->
7777 { :error , "OpenAI API key is invalid" }
7878
79- % { status: 404 } ->
80- { :error , "OpenAI API not found" }
79+ % { status: 404 , body: body } ->
80+ { :error , get_in ( body [ "error" ] [ "message" ] ) }
8181
8282 % { status: 500 } ->
8383 { :error , "OpenAI Server error" }
You can’t perform that action at this time.
0 commit comments