Skip to content

fix(function_schema): description issue #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HafizFasih
Copy link

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:

description=description_override or doc_info.description if doc_info else None

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:

description=(description_override or doc_info.description) if doc_info else None
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

from agents.function_schema import function_schema

def my_func():
pass

schema = function_schema(
my_func,
description_override ="CustomDescription",
use_docstring_info=False
)

print(schema.description) # Expected: "CustomDescription", Actual: None

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)

@HafizFasih HafizFasih changed the title fix(function_schema): list comprehension issue fix(function_schema): description issue Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant