-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[docs]Add Google-Style comprehensive docstring to dspy/primitives/example Example class #8949
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
[docs]Add Google-Style comprehensive docstring to dspy/primitives/example Example class #8949
Conversation
- Add detailed class-level docstring following Google Python style guide - Include comprehensive usage examples showing various initialization patterns - Document key features: dictionary-like access, input/output separation, serialization - Cover all major use cases: basic usage, dictionary initialization, copying, input/output handling - Provide practical examples for common operations like iteration, key checking, and field access This improves DSPy's docstring coverage and makes the Example class more accessible to users.
Hmm I like this but I'm not the right person to make this decision |
ah fair enough, my bad @chenmoneygithub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, this looks pretty good!
Dropped some comments.
dspy/primitives/example.py
Outdated
- Serialization support for saving/loading examples | ||
- Immutable operations that return new Example instances | ||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Args should go to the __init__
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
and provides convenient methods for handling input/output separation, which is crucial | ||
for DSPy's training and evaluation workflows. | ||
Key features: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section reads a bit strange to me, I suggest just deleting that. "standard data format" should be enough IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have trimmed it down! let me know if i should remove it fully or not?
Hey @chenmoneygithub , i've made the fixes as per suggestion and the comments, let me know if I need to make a new PR separately or if we can continue this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, LGTM!
This PR adds concise Google-style docstrings for example class
✅ No logic or functional changes
This improves DSPy's docstring coverage and makes the Example class more accessible to users.
This is with reference to the issue #8926