You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this lib ! 🚀 Describe the bug
When there is a retry, a 400 error is raised from the API. The error message states that the 'content' property is required in the 'messages.1' object.
$> python poc.py
Traceback (most recent call last):
File "/private/tmp/poc/poc.py", line 23, in<module>
user = client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 260, in new_chatcompletion_sync
response = retry_sync(
^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 186, in retry_sync
response = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/openai/_utils/_utils.py", line 301, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 598, in create
return self._post(
^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1063, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 842, in request
return self._request(
^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 885, in _request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "'content' is a required property - 'messages.1'", 'type': 'invalid_request_error', 'param': None, 'code': None}}
Expected behavior
I imagine we prefer Specific error or JsonDecode error or Pydantic validation error
$> python poc.py
Traceback (most recent call last):
File "/private/tmp/poc/poc.py", line 26, in<module>
user = client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 263, in new_chatcompletion_sync
response = retry_sync(
^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 209, in retry_sync
raise e
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 191, in retry_sync
return process_response(
^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/patch.py", line 128, in process_response
model = response_model.from_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/instructor/function_calls.py", line 218, in from_response
return cls.model_validate_json(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/poc/.venv/lib/python3.11/site-packages/pydantic/main.py", line 532, in model_validate_json
return cls.__pydantic_validator__.validate_json(json_data, strict=strict, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for UserDetail
name
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
age
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
Thank you for this lib ! 🚀
Describe the bug
When there is a retry, a 400 error is raised from the API. The error message states that the 'content' property is required in the 'messages.1' object.
To Reproduce
Try create extraction will failed
Expected behavior
I imagine we prefer Specific error or JsonDecode error or Pydantic validation error
Idea 💡
These lines :
The text was updated successfully, but these errors were encountered: