Skip to content

[exa-py]: fix Result.__str__ to handle optional text/summary fields#141

Open
MiguelAtExa wants to merge 1 commit into
masterfrom
devin/1766394989-fix-result-str-optional-fields
Open

[exa-py]: fix Result.__str__ to handle optional text/summary fields#141
MiguelAtExa wants to merge 1 commit into
masterfrom
devin/1766394989-fix-result-str-optional-fields

Conversation

@MiguelAtExa

Copy link
Copy Markdown
Contributor

Summary

Fixes Result.__str__ to only include text and summary fields when they are not None, matching the behavior of highlights and highlight_scores which already have conditional checks.

Previously, the __str__ method always appended Text: None and Summary: None even 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

  • Verify the behavior difference between None (field absent) vs "" (empty string) is acceptable - this PR uses is not None so empty strings will still be printed
  • Quick sanity check: run str(Result(url="x", id="y")) and confirm no Text: or Summary: lines appear

Notes

  • Verified parity with exa-js SDK where text and summary come from ContentsResultComponent and are conditionally added
  • Verified Vulcan types show text: z.string().optional() and summary: z.string().optional()
  • Unit tests pass locally

Link to Devin run: https://app.devin.ai/sessions/e66881e28a914d1bae92943ed2f358f2
Requested by: Miguel Brandão (@MiguelAtExa)

Co-Authored-By: Miguel Brandão <miguel@exa.ai>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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