Skip to content

Commit 50756ef

Browse files
authored
Save reasoning_content from litellm as details (#929)
1 parent d950a1e commit 50756ef

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/lighteval/models/endpoints/litellm_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,14 @@ def greedy_until(
294294

295295
for response, context in zip(responses, contexts):
296296
result: list[str] = [choice.message.content for choice in response.choices]
297+
reasonings: list[str | None] = [
298+
getattr(choice.message, "reasoning_content", None) for choice in response.choices
299+
]
297300

298301
cur_response = ModelResponse(
299302
# In empty responses, the model should return an empty string instead of None
300303
text=result if result[0] else [""],
304+
reasonings=reasonings,
301305
input=context,
302306
)
303307
results.append(cur_response)

src/lighteval/models/model_output.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class ModelResponse:
127127
text: list[str] = field(default_factory=list) # The text of the response
128128
output_tokens: list[list[int]] = field(default_factory=list) # Model generations
129129
text_post_processed: list[str] | None = None # The text of the response postprocessed
130+
reasonings: list[str | None] = field(default_factory=list) # The reasoning content of the response
130131

131132
# Model logprob outputs
132133
logprobs: list[float] = field(default_factory=list) # Log probabilities of the response

0 commit comments

Comments
 (0)