description_override is not properly used for function_schema.description #1000
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the bug
A clear and concise description of what the bug is.
In the function_schema method of the OpenAI Agents SDK, the following line:
does not honor description_override when
use_docstring_info=False
. This happens because of operator precedence in Python. Without parentheses, the expression is interpreted as:So when doc_info is None, even if description_override is set, it falls back to None
Debug information
Python version (e.g. Python 3.10)
Repro steps
Expected behavior
Even when use_docstring_info=False, if description_override is provided, it should be used for description.
Suggested Fix:
Update this line:
description=description_override or doc_info.description if doc_info else None
To this (with parentheses to enforce correct evaluation):
description=description_override or (doc_info.description if doc_info else None)