git: Handle None values in ChatMessage content#422
Merged
aniketmaurya merged 2 commits intoLightning-AI:mainfrom Feb 6, 2025
Merged
git: Handle None values in ChatMessage content#422aniketmaurya merged 2 commits intoLightning-AI:mainfrom
aniketmaurya merged 2 commits intoLightning-AI:mainfrom
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #422 +/- ##
===================================
- Coverage 89% 89% -0%
===================================
Files 31 31
Lines 2021 2023 +2
===================================
+ Hits 1807 1808 +1
- Misses 214 215 +1 |
aniketmaurya
approved these changes
Feb 6, 2025
Collaborator
aniketmaurya
left a comment
There was a problem hiding this comment.
Looks great! thanks for the fix 🚀
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.
What does this PR do?
Fixes None values in ChatMessage content.
This PR aligns the
ChatMessagemodel with the OpenAI API spec by allowingcontentto be either astringornull. It also updates thenon_streaming_completionmethod to handleNonevalues, preventing potentialTypeErrorduring message concatenation.Before submitting
💡 How Does This PR Impact Users?
✅ Improved OpenAI API Compatibility:
Users integrating with the OpenAI API will no longer face errors when the content field is null (which is always the case when OpenAI returns a function call). This ensures smooth interoperability, especially when handling function calls.
✅ Flexible Function Call Handling:
When OpenAI returns function calls with
nullcontent, users can now decide whether to handle these functions directly in thepredictfunction, providing greater flexibility in managing LLM responses.PR review
Focus on the changes to the
ChatMessagemodel andnon_streaming_completionmethod.Did you have fun?
Absolutely! 🙃