Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Add None checks for usage_metadata to prevent potential NoneType errors when accessing properties.

Changes:

  • Added 'and result.usage_metadata is not None' check in langchain_core/patch.py
  • Added similar None checks in gemini/patch.py for multiple locations
  • Added None check in vertexai/patch.py
  • Added None check in utils/llm.py

These changes prevent potential NoneType errors when accessing usage_metadata properties by ensuring the attribute exists and is not None before attempting to access it.

Link to Devin run: https://app.devin.ai/sessions/0b652b52a33a4edcab6abacf838cd4b9

Co-Authored-By: karthik@scale3labs.com <karthik@scale3labs.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 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
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add "(aside)" to your comment to have me ignore it.

@karthikscale3 karthikscale3 merged commit 6cc2b23 into development Dec 10, 2024
4 checks passed
@karthikscale3 karthikscale3 deleted the devin/1733798157-add-usage-metadata-none-checks branch December 10, 2024 03:24
karthikscale3 added a commit that referenced this pull request Dec 10, 2024
* remove logs

* remove requirements

* Bump version

* Squash

* minor

* switch to http exporter

* fix: add usage_metadata None checks to prevent NoneType errors (#429)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: karthik@scale3labs.com <karthik@scale3labs.com>

* chore: bump version to 3.3.14 (#430)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: karthik@scale3labs.com <karthik@scale3labs.com>

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

2 participants