Hey, thank you for providing this package!
I noticed that I quite often get a Mint.TransportError exception that is not being caught by the retry logic. So I have to wrap the Instructor call with another retry, which is not ideal.
Call:
case Instructor.chat_completion(
model: "gpt-4o",
temperature: 0.5,
max_retries: 5,
response_model: MyResponseModel,
messages: [
%{role: "system", content: system_message},
%{role: "user", content: user_message}
]
) do
{:ok, %MyResponseModel{} = result} ->
{:ok, result}
{:error, error} ->
Logger.error("Failed to generate model: #{inspect(error)}")
{:error, error}
end
Exception
[error] Task #PID<0.2901.0> started from #PID<0.2900.0> terminating
** (Mint.TransportError) socket closed
(req 0.4.14) lib/req.ex:996: Req.request!/2
(instructor 0.0.5) lib/instructor/adapters/openai.ex:80: Instructor.Adapters.OpenAI.do_chat_completion/2
(instructor 0.0.5) lib/instructor.ex:430: Instructor.do_chat_completion/3
(my_app 0.1.0) lib/my_app/reports/generate_report.ex:94: MyApp.Reports.generate_dimension_scores/1
(my_app 0.1.0) lib/my_app/reports/generate_report.ex:24: MyApp.Reports.generate_report/1
(elixir 1.16.0) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
Function: #Function<0.44892832/0 in MyAppWeb.PersonalityProfileChannel.handle_in/3>
Args: []
iex(3)>
My expectation is, that the exception is caught and Instructor tries again (4 more times). This is not happening.
Thanks!
Hey, thank you for providing this package!
I noticed that I quite often get a
Mint.TransportErrorexception that is not being caught by the retry logic. So I have to wrap the Instructor call with another retry, which is not ideal.Call:
Exception
My expectation is, that the exception is caught and Instructor tries again (4 more times). This is not happening.
Thanks!