Skip to content

Conversation

@ibolmo
Copy link
Collaborator

@ibolmo ibolmo commented Dec 29, 2025

No description provided.

justcodebruh and others added 2 commits December 18, 2025 15:20
## Summary

Fixes a bug in `Score.as_dict()` where the `name` field was missing when
serializing, causing "Object of type Score is not JSON serializable"
errors when returning Score objects from Python scorers.

## Problem

The API expects Score objects to have `name`, `score`, and `metadata`
fields, but `as_dict()` was only returning `score` and `metadata`. This
caused the following error when using online scorers:

```
Cannot log [{"name":"...","score":1,"metadata":{...}},...] as a score
Object of type Score is not JSON serializable
```

## Solution

Updated `Score.as_dict()` to include the `name` field:

```python
def as_dict(self):
    return {
        "name": self.name,        # ← ADDED
        "score": self.score,
        "metadata": self.metadata,
    }
```

## Changes

- Updated `py/autoevals/score.py`: Fixed `Score.as_dict()` method

This matches the fix in braintrust-sdk (PR
braintrustdata/braintrust-sdk#1103) and ensures Score objects serialize
correctly with all required fields.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alex Jean-Baptiste Jr <alex.jean-baptiste@braintrustdata.com>
@ibolmo ibolmo self-assigned this Dec 29, 2025
@github-actions
Copy link

github-actions bot commented Dec 29, 2025

Braintrust eval report

Autoevals (fix-ci-1767046362)

Score Average Improvements Regressions
NumericDiff 74.5% (+0pp) - -
Time_to_first_token 1.46tok (-0.04tok) 71 🟢 47 🔴
Llm_calls 1.55 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 279.25tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 18.38tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 297.62tok (+0tok) - -
Estimated_cost 0$ (+0$) - -
Duration 1.49s (-0.02s) 126 🟢 93 🔴
Llm_duration 3.04s (-0.04s) 76 🟢 41 🔴

package_dir={"": "py"},
include_package_data=True,
packages=setuptools.find_packages(where="py"),
python_requires=">=3.8.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically #154 will be the official deprecation of 3.8 and 3.9.

@ibolmo ibolmo changed the base branch from main to pnpm-10 December 29, 2025 22:13
@ibolmo ibolmo merged commit 605cbf8 into pnpm-10 Dec 29, 2025
7 checks passed
@ibolmo ibolmo deleted the fix-ci branch December 29, 2025 22:14
@github-actions
Copy link

github-actions bot commented Dec 29, 2025

Braintrust eval report

Autoevals (pnpm-10-1767046473)

Score Average Improvements Regressions
NumericDiff 74.5% (+0pp) - -
Time_to_first_token 1.48tok (+0.05tok) 36 🟢 83 🔴
Llm_calls 1.55 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 279.25tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 18.38tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 297.62tok (+0tok) - -
Estimated_cost 0$ (+0$) - -
Duration 1.47s (+0.02s) 87 🟢 131 🔴
Llm_duration 3.05s (+0.12s) 28 🟢 91 🔴

ibolmo added a commit that referenced this pull request Dec 29, 2025
Co-authored-by: Alex Jean-Baptiste <50563547+justcodebruh@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alex Jean-Baptiste Jr <alex.jean-baptiste@braintrustdata.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants