Commit 37b83fd
Update OpenAiChatModel.java
Auto-cherry-pick to 1.0.x
Fixes #3376
Fix NullPointerException caused by empty choice.index() and Map.of() with null value
- Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
- Ensure that Map.of() does not accept null values to prevent runtime errors.
- Implement null checks and provide default values to handle edge cases gracefully.
- Update unit tests to cover scenarios where choice.index() is empty or null.
Signed-off-by: yiangjm <[email protected]>1 parent f391ff2 commit 37b83fd
File tree
1 file changed
+2
-2
lines changed- models/spring-ai-openai/src/main/java/org/springframework/ai/openai
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
0 commit comments