[exa-py]: fix Result.__str__ to handle optional text/summary fields#141
Open
MiguelAtExa wants to merge 1 commit into
Open
[exa-py]: fix Result.__str__ to handle optional text/summary fields#141MiguelAtExa wants to merge 1 commit into
MiguelAtExa wants to merge 1 commit into
Conversation
Co-Authored-By: Miguel Brandão <miguel@exa.ai>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes
Result.__str__to only includetextandsummaryfields when they are not None, matching the behavior ofhighlightsandhighlight_scoreswhich already have conditional checks.Previously, the
__str__method always appendedText: NoneandSummary: Noneeven when these optional fields weren't requested/returned. This was inconsistent with the type annotations (Optional[str]) and with how exa-js/Vulcan handle these fields (both are optional in the API response schema).Review & Testing Checklist for Human
None(field absent) vs""(empty string) is acceptable - this PR usesis not Noneso empty strings will still be printedstr(Result(url="x", id="y"))and confirm noText:orSummary:lines appearNotes
textandsummarycome fromContentsResultComponentand are conditionally addedtext: z.string().optional()andsummary: z.string().optional()Link to Devin run: https://app.devin.ai/sessions/e66881e28a914d1bae92943ed2f358f2
Requested by: Miguel Brandão (@MiguelAtExa)