More null checks for llamacpp logprobs parser
| @@ -1039,11 +1039,13 @@ export function parseTextgenLogprobs(token, logprobs) { | ||
| 1039 | 1039 | return { token, topLogprobs: candidates }; |
| 1040 | 1040 | } |
| 1041 | 1041 | case LLAMACPP: { |
| 1042 | - /** @type {Record<string, number>[]} */ | |
| 1043 | 1042 | if (!logprobs?.length) { |
| 1044 | 1043 | return null; |
| 1045 | 1044 | } |
| 1046 | 1045 | const candidates = logprobs?.[0]?.probs?.map(x => [x.tok_str, x.prob]); |
| 1046 | + if (!candidates) { | |
| 1047 | + return null; | |
| 1048 | + } | |
| 1047 | 1049 | return { token, topLogprobs: candidates }; |
| 1048 | 1050 | } |
| 1049 | 1051 | default: |