Commit 251c3ff
committed
feat: preserve logprobs from chat completions API in ModelResponse
The SDK already accepts `top_logprobs` in ModelSettings and passes it to the
API, but the logprobs returned in the response were discarded during
conversion. This change:
1. Adds an optional `logprobs` field to ModelResponse dataclass
2. Extracts logprobs from `choice.logprobs.content` in the chat completions
model and includes them in the ModelResponse
This enables use cases like RLHF training, confidence scoring, and
uncertainty estimation that require access to token-level log probabilities.1 parent db68d1c commit 251c3ff
2 files changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
359 | 366 | | |
360 | 367 | | |
361 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
| |||
0 commit comments