Commit 6701d88
committed
fix: handle None choices in ChatCompletion response (provider error payloads)
When a provider (e.g. OpenRouter) returns an error payload, the ChatCompletion
response object has choices=None. Previously this caused a silent no-op or a
downstream TypeError. Now a ModelBehaviorError is raised before choices[0] is
accessed, including the provider's error field in the message when present.1 parent fa50899 commit 6701d88
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | 145 | | |
136 | 146 | | |
| |||
0 commit comments