Run a sufficient number of requests against any Mistral model such that you trigger a need for a retry.
Observe that a IndexError: list index out of range occurs in this code:
File "[...]/lib/python3.10/site-packages/mistralai/_hooks/custom_user_agent.py", line 14, in before_request
"mistral-client-python/" + request.headers["user-agent"].split(" ")[1]
Expected Behavior
I expect the request to be retried rather than failing with a permanent error.
Additional Context
It looks to me like that code isn't written for retries. The first time a request is seen, it updates the user agent. The second time there's no longer a space in the user agent, so it fails.
Suggested Solutions
The easiest fix is to check if there's a space in the user agent before expecting there to be one.
Python -VV
Pip Freeze
Reproduction Steps
IndexError: list index out of range
occurs in this code:Expected Behavior
I expect the request to be retried rather than failing with a permanent error.
Additional Context
It looks to me like that code isn't written for retries. The first time a request is seen, it updates the user agent. The second time there's no longer a space in the user agent, so it fails.
Suggested Solutions
The easiest fix is to check if there's a space in the user agent before expecting there to be one.