ResponseReasoningItem' object has no attribute 'arguments'
- [x ] This is actually a bug report.
- [ ] I am not getting good LLM Results
- [ ] I have tried asking for help in the community on discord or discussions and have not received a response.
- [ ] I have tried searching the documentation and have not found an answer.
What Model are you using?
- [ ] gpt-3.5-turbo
- [ ] gpt-4-turbo
- [ ] gpt-4
- [x] Other (please specify 03 with code interpreter)
Describe the bug This is a bit of a stochastic bug, so find it hard to provide a lot of context, but just leaving it just in case.
I have a a structured extraction for which I am use o3 with code interpreter mode=Mode.RESPONSES_TOOLS_WITH_INBUILT_TOOLS
response, completion = await client.responses.create_with_completion(
model="03",
tools=[{"type": "code_interpreter", "container": {"type": "auto"}}],
instructions=system_prompt
+ f"\n\nYou must call the {response_model.__name__} function to return your final extraction.",
input=inputs,
response_model=response_model,
reasoning={"effort": "high"},
max_retries=AsyncRetrying(
stop=stop_after_attempt(3),
after=lambda retry: logger.info(
f"Retrying code interpreter call after validation error: {retry}"
),
),
)
And then every now and then I see this in the logs:
<RetryCallState 4455142688: attempt #1; slept for 0.0; last result: failed (AttributeError 'ResponseReasoningItem' object has no attribute 'arguments')>
I think calls to an .arguments attribute are mostly related at trying to extract the arguments of a function call?
So looking at this cookbook sometimes openai returns both a ResponseReasoningItem and the ResponseFunctionToolCall
https://cookbook.openai.com/examples/responses_api/reasoning_items
response.output
[ResponseReasoningItem(id='rs_68210c71a95c81919cc44afadb9d220400c77cc15fd2f785', summary=[], type='reasoning', status=None), ResponseFunctionToolCall(arguments='{"latitude":48.8566,"longitude":2.3522}', call_id='call_9ylqPOZUyFEwhxvBwgpNDqPT', name='get_weather', type='function_call', id='fc_68210c78357c8191977197499d5de6ca00c77cc15fd2f785', status='completed')]
So seems sometimes we try to get the arguments from the reasoning instead of the function tool call?
Sorry cannot be more specific.
I get a similar error by
- Getting the example from https://python.useinstructor.com/blog/2025/05/11/announcing-responses-api-support/?h=responses+api#whats-new
- Replacing
"openai/gpt-4.1-mini"with"openai/gpt-5-mini"
Full example below
import instructor
from dotenv import load_dotenv
from pydantic import BaseModel
load_dotenv()
# Initialize the client with Responses mode
client = instructor.from_provider(
"openai/gpt-5-mini",
mode=instructor.Mode.RESPONSES_TOOLS
)
class User(BaseModel):
name: str
age: int
# Create structured output
profile = client.responses.create(
input="Extract out Ivan is 28 years old",
response_model=User,
)
print(profile)
#> name='Ivan' age=28
Error
Traceback (most recent call last):
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/retry.py", line 251, in retry_sync
raise e
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/retry.py", line 191, in retry_sync
return process_response( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/processing/response.py", line 336, in process_response
model = response_model.from_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/processing/function_calls.py", line 200, in from_response
return cls.parse_responses_tools(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/processing/function_calls.py", line 577, in parse_responses_tools
message.name == cls.openai_schema["name"] # type: ignore[index]
^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/pydantic/main.py", line 991, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'ResponseReasoningItem' object has no attribute 'name'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/retry.py", line 180, in retry_sync
for attempt in max_retries:
File "/home/user/project/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 443, in __iter__
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
result = action(retry_state)
^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 419, in exc_check
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f2f36e21880 state=finished raised AttributeError>]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/project/app/test.py", line 18, in <module>
profile = client.responses.create(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/client.py", line 58, in create
return self.client.create(
^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/client.py", line 366, in create
return self.create_fn(
^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/patch.py", line 258, in new_create_sync
response = retry_sync(
^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/instructor/core/retry.py", line 254, in retry_sync
raise InstructorRetryException(
instructor.core.exceptions.InstructorRetryException: 'ResponseReasoningItem' object has no attribute 'name'
I used the latest library version (1.11.2)
I get the same error as @christos-bsq also only for the GPT-5 family. 4.1 and 4o have been working fine
Can confirm same issue ('ResponseReasoningItem' object has no attribute 'name') with mode=PatchMode.RESPONSES_TOOLS. However the issue is fixed using mode=PatchMode.RESPONSES_TOOLS_WITH_INBUILT_TOOLS
Closing per triage: no confirmed repro or scoped plan. If this still reproduces on a current version, reopen with a minimal repro + versions/provider details. For feature requests/questions, please open a Discussion with concrete scope.