fix: remove stop_reason field and add deserialization test for ChatCo…#127
Conversation
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 9. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
There was a problem hiding this comment.
Pull Request Overview
This PR removes the provider-specific stop_reason field from ChatCompletionResponseChoice to simplify the struct, relying solely on the standard finish_reason field. A new test case is added for GLM model deserialization.
- Removed
stop_reasonfield and its documentation fromChatCompletionResponseChoicestruct - Added
test_chat_completion_response_deserialization_glmtest case demonstrating deserialization of GLM model responses
Comments suppressed due to low confidence (1)
crates/inference_providers/src/models.rs:655
- The
stop_reasonfield has been removed fromChatCompletionResponseChoicestruct but still appears in this test's JSON. While serde ignores unknown fields during deserialization, this field should be removed from the test data to maintain consistency with the struct definition and avoid confusion.
"stop_reason":null,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| "logprobs": null, | ||
| "finish_reason": "stop", | ||
| "stop_reason": 151336, |
There was a problem hiding this comment.
The stop_reason field is included in the test JSON but has been removed from the ChatCompletionResponseChoice struct definition. This field will be silently ignored during deserialization. Consider removing it from the test data to accurately reflect the struct's schema, or add a comment explaining why it's present if testing that unknown fields are gracefully ignored.
| "stop_reason": 151336, |
…mpletionResponse