Skip to content

feat(sdk): added scorers to OO SDK#679

Merged
james-rl merged 8 commits intomainfrom
james/scorers
Dec 20, 2025
Merged

feat(sdk): added scorers to OO SDK#679
james-rl merged 8 commits intomainfrom
james/scorers

Conversation

@james-rl
Copy link
Copy Markdown
Contributor

@james-rl james-rl commented Dec 18, 2025

User description

Description

  • Adds the scorers component to the OO SDK

Motivation

  • Parity with python client

Changes

  • Added scorers and tests

Testing

  • Unit tests added
  • Integration tests added
  • Smoke Tests added/updated
  • Tested locally

Breaking Changes

Checklist

  • PR title follows Conventional Commits format (feat: or feat(scope):)
  • Documentation updated (if needed)
  • Breaking changes documented (if applicable)

CodeAnt-AI Description

Add Scorer object-oriented API and tests to SDK

What Changed

  • The SDK now exposes a top-level scorer operations object (sdk.scorer) for creating, listing, and accessing scorers.
  • Added a Scorer class with fromId/getInfo/update/validate methods to create and manage custom scoring scripts and run validations that return a numeric score and output.
  • New unit and smoke tests verify scorer creation/access, update, validation behavior, error handling, and that the SDK instance includes the scorer property.
  • Scorer is exported from the SDK index so it is available to consumers.

Impact

✅ Create and manage custom scorers from the SDK
✅ Run scorer validations and get numeric scores and outputs directly
✅ Access scorers via sdk.scorer and Scorer instances without calling low-level API

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Dec 18, 2025

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added the size:L This PR changes 100-499 lines, ignoring generated files label Dec 18, 2025
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Dec 18, 2025

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Invalid export syntax
    The added line uses the form export type * from './resources/scenarios/scorers';.
    This pattern is not standard/commonly accepted TypeScript syntax and will likely cause a compile error. Verify that the intended export form is used (either export * from ... or export type { ... } from ...) and correct it.

  • Project-wide export consistency
    The file contains many similar export type * from lines. If that pattern is accidentally invalid, many of these lines (not just the added one) would break the build. Confirm the project's expected barrel export style and keep this change consistent with it.

  • Export form mismatch
    The new export may not match how ./scorer actually exports Scorer (named vs default vs type-only). If Scorer is exported as a default export or is a type-only export (interface/type), this line will cause build / type errors. Confirm the export shape in ./scorer.

  • Type-only vs runtime export
    If Scorer is a TypeScript type or interface (type-only), exporting it without the type modifier will attempt a runtime import and may produce transpilation/runtime problems. Consider using export type { Scorer } from './scorer' for type-only exports.

  • Path / casing sensitivity
    Ensure the './scorer' module exists with exact casing and is exported from the package. On case-sensitive filesystems (Linux, CI), mismatched filename casing will break builds. Verify file presence and export name.

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Dec 18, 2025

CodeAnt AI finished reviewing your PR.

@james-rl james-rl requested review from jrvb-rl and sid-rl December 18, 2025 18:22
@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 89.86% 100%
Lines 80.72% - ℹ️
Branches 45.91% - ℹ️
Statements 79.38% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@james-rl
Copy link
Copy Markdown
Contributor Author

The ant feedback points aren't consistent with the SDK's conventions. I'll see if there's an ignore setting, but this might be something to take up once Alex is back in the office

@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 95.27% 100%
Lines 83.73% - ℹ️
Branches 45.91% - ℹ️
Statements 82.27% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Dec 18, 2025

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 97.98% 100%
Lines 85.17% - ℹ️
Branches 45.91% - ℹ️
Statements 83.65% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

Comment thread src/sdk/scorer.ts
Comment thread src/sdk/scorer.ts
Comment thread src/sdk.ts
Comment thread src/sdk/scorer.ts
Comment thread src/sdk.ts
Comment thread src/sdk.ts
Comment thread tests/smoketests/object-oriented/scorer.test.ts
Comment thread tests/smoketests/object-oriented/scorer.test.ts Outdated
Comment thread tests/smoketests/object-oriented/scorer.test.ts Outdated
Comment thread tests/smoketests/object-oriented/scorer.test.ts
Comment thread tests/objects/scorer.test.ts
Comment thread tests/objects/scorer.test.ts
Copy link
Copy Markdown
Contributor

@jrvb-rl jrvb-rl left a comment

Choose a reason for hiding this comment

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

A couple of minor suggestions, but overall looks good!

Also, IMO feel free to land this while you are working on the disabled smoketest, so you don't have this PR hanging over your head for too long.

Comment thread src/sdk.ts
Comment thread src/sdk/scorer.ts
Comment thread tests/objects/scorer.test.ts
Comment thread tests/smoketests/object-oriented/scorer.test.ts
Comment thread tests/smoketests/object-oriented/scorer.test.ts Outdated
Comment thread tests/objects/scorer.test.ts Outdated
@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 95.97% 100%
Lines 84.16% - ℹ️
Branches 45.91% - ℹ️
Statements 82.69% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Dec 19, 2025

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 94% 100%
Lines 83% - ℹ️
Branches 45.91% - ℹ️
Statements 81.57% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 96% 100%
Lines 84.2% - ℹ️
Branches 45.91% - ℹ️
Statements 82.72% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

Copy link
Copy Markdown
Contributor

@sid-rl sid-rl left a comment

Choose a reason for hiding this comment

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

LGTM!

@james-rl james-rl merged commit ee67c94 into main Dec 20, 2025
9 checks passed
@james-rl james-rl deleted the james/scorers branch December 20, 2025 00:05
@stainless-app stainless-app bot mentioned this pull request Dec 20, 2025
@dines-rl dines-rl mentioned this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants