[Bugfix] Support logprobs when using guided_json and other constrained decoding fields (#4149)
This commit is contained in:
@@ -116,7 +116,9 @@ class OpenAIServing:
|
||||
|
||||
if num_output_top_logprobs:
|
||||
logprobs.top_logprobs.append({
|
||||
p.decoded_token: p.logprob
|
||||
# Convert float("-inf") to the
|
||||
# JSON-serializable float that OpenAI uses
|
||||
p.decoded_token: max(p.logprob, -9999.0)
|
||||
for i, p in step_top_logprobs.items()
|
||||
} if step_top_logprobs else None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user