Skip to content

docs: fix UserContext example #1280

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

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

kankute-sameer
Copy link
Contributor

Fix documentation inconsistency in UserContext example

Problem

The documentation in docs/agents.md & docs/ja/agents.md contained an inconsistency where the dynamic_instructions function referenced context.context.name, but the UserContext dataclass only defined uid and is_pro_user fields. This would cause a runtime AttributeError when users tried to follow the example.

Solution

  • Added the missing name: str field to the UserContext dataclass to match what the dynamic_instructions function expects.

Changes Made

  • Added name: str field to the UserContext dataclass in the Context section
  • Maintained consistency between the dataclass definition and the dynamic instructions example
  • Fixed formatting issues in related files

Testing

✅ Code formatting passes (make format-check)
✅ Documentation example is now consistent and functional
✅ No runtime errors when following the example
✅ Verified locally: Ran make serve-docs and confirmed the documentation renders correctly with the fix(make serve-docs)

Issue number

Fixes #1262

@seratch seratch added the documentation Improvements or additions to documentation label Jul 28, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@seratch seratch enabled auto-merge (squash) July 28, 2025 23:52
@seratch seratch merged commit 2224d45 into openai:main Jul 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: context.context.name used in dynamic instruction in Agent documentation, but name not in UserContext
3 participants