Skip to content

Commit c27a669

Browse files
committed
cp dines
1 parent a6f483f commit c27a669

2 files changed

Lines changed: 2 additions & 79 deletions

File tree

src/sdk/scorer.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import type {
66
ScorerRetrieveResponse,
77
ScorerUpdateResponse,
88
ScorerUpdateParams,
9-
ScorerValidateParams,
10-
ScorerValidateResponse,
119
} from '../resources/scenarios/scorers';
1210

1311
/**
@@ -32,8 +30,8 @@ import type {
3230
* bash_script: 'echo "1.0"',
3331
* });
3432
*
35-
* const result = await scorer.validate({ scoring_context: { output: 'test' } });
36-
* console.log(`Score: ${result.scoring_result.score}`);
33+
* const info = await scorer.getInfo();
34+
* console.log(`Scorer type: ${info.type}`);
3735
* ```
3836
*/
3937
export class Scorer {
@@ -177,26 +175,4 @@ export class Scorer {
177175
return this.client.scenarios.scorers.update(this._id, params, options);
178176
}
179177

180-
/**
181-
* Run the scorer against the provided context and return the result.
182-
*
183-
* @example
184-
* ```typescript
185-
* const result = await scorer.validate({
186-
* scoring_context: { output: 'test output', expected: 'test output' }
187-
* });
188-
* console.log(`Validation score: ${result.scoring_result.score}`);
189-
* console.log(`Output: ${result.scoring_result.output}`);
190-
* ```
191-
*
192-
* @param {ScorerValidateParams} params - Validation parameters
193-
* @param {Core.RequestOptions} [options] - Request options
194-
* @returns {Promise<ScorerValidateResponse>} Validation result with score
195-
*/
196-
async validate(
197-
params: ScorerValidateParams,
198-
options?: Core.RequestOptions,
199-
): Promise<ScorerValidateResponse> {
200-
return this.client.scenarios.scorers.validate(this._id, params, options);
201-
}
202178
}

tests/objects/scorer.test.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Scorer } from '../../src/sdk/scorer';
22
import type {
33
ScorerRetrieveResponse,
44
ScorerUpdateResponse,
5-
ScorerValidateResponse,
65
} from '../../src/resources/scenarios/scorers';
76

87
// Mock the Runloop client
@@ -11,7 +10,6 @@ jest.mock('../../src/index');
1110
describe('Scorer', () => {
1211
let mockClient: any;
1312
let mockScorerData: ScorerRetrieveResponse;
14-
let mockValidateResult: ScorerValidateResponse;
1513

1614
beforeEach(() => {
1715
mockClient = {
@@ -20,7 +18,6 @@ describe('Scorer', () => {
2018
create: jest.fn(),
2119
retrieve: jest.fn(),
2220
update: jest.fn(),
23-
validate: jest.fn(),
2421
list: jest.fn(),
2522
},
2623
},
@@ -32,16 +29,6 @@ describe('Scorer', () => {
3229
bash_script: 'echo "1.0"',
3330
};
3431

35-
mockValidateResult = {
36-
name: 'my_custom_scorer',
37-
scoring_context: { output: 'test' },
38-
scoring_result: {
39-
output: '1.0',
40-
score: 1.0,
41-
state: 'complete',
42-
scoring_function_name: 'test-scorer',
43-
},
44-
};
4532
});
4633

4734
describe('fromId', () => {
@@ -188,38 +175,6 @@ describe('Scorer', () => {
188175
});
189176
});
190177

191-
describe('validate', () => {
192-
it('should validate scorer with scoring context', async () => {
193-
mockClient.scenarios.scorers.validate.mockResolvedValue(mockValidateResult);
194-
195-
const scorer = Scorer.fromId(mockClient, 'scs_123');
196-
const result = await scorer.validate({
197-
scoring_context: { output: 'test output', expected: 'expected output' },
198-
});
199-
200-
expect(mockClient.scenarios.scorers.validate).toHaveBeenCalledWith(
201-
'scs_123',
202-
{ scoring_context: { output: 'test output', expected: 'expected output' } },
203-
undefined,
204-
);
205-
expect(result.scoring_result.score).toBe(1.0);
206-
expect(result.scoring_result.output).toBe('1.0');
207-
});
208-
209-
it('should pass options to the API client', async () => {
210-
mockClient.scenarios.scorers.validate.mockResolvedValue(mockValidateResult);
211-
212-
const scorer = Scorer.fromId(mockClient, 'scs_123');
213-
await scorer.validate({ scoring_context: {} }, { timeout: 30000 });
214-
215-
expect(mockClient.scenarios.scorers.validate).toHaveBeenCalledWith(
216-
'scs_123',
217-
{ scoring_context: {} },
218-
{ timeout: 30000 },
219-
);
220-
});
221-
});
222-
223178
describe('error handling', () => {
224179
it('should handle API errors on getInfo', async () => {
225180
const error = new Error('Scorer not found');
@@ -241,13 +196,5 @@ describe('Scorer', () => {
241196
);
242197
});
243198

244-
it('should handle API errors on validate', async () => {
245-
const error = new Error('Validation timeout');
246-
mockClient.scenarios.scorers.validate.mockRejectedValue(error);
247-
248-
const scorer = Scorer.fromId(mockClient, 'scs_123');
249-
250-
await expect(scorer.validate({ scoring_context: {} })).rejects.toThrow('Validation timeout');
251-
});
252199
});
253200
});

0 commit comments

Comments
 (0)