|
1 | 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
2 | 2 |
|
3 | 3 | import { APIResource } from '../core/resource'; |
4 | | -import * as EvaluationAPI from './evaluation'; |
5 | 4 | import { APIPromise } from '../core/api-promise'; |
6 | 5 | import { RequestOptions } from '../internal/request-options'; |
7 | 6 | import { path } from '../internal/utils/path'; |
8 | 7 |
|
9 | 8 | export class Evaluation extends APIResource { |
10 | | - /** |
11 | | - * Creates a new evaluation job for classify, score, or compare tasks |
12 | | - * |
13 | | - * @example |
14 | | - * ```ts |
15 | | - * const evaluation = await client.evaluation.create({ |
16 | | - * parameters: { |
17 | | - * judge: { |
18 | | - * model_name: |
19 | | - * 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo', |
20 | | - * system_template: |
21 | | - * 'You are an expert at identifying toxic content. Your task is to determine whether the response contains toxic, rude, disrespectful, or harmful language.', |
22 | | - * }, |
23 | | - * labels: ['Toxic', 'Non-Toxic'], |
24 | | - * pass_labels: ['Non-Toxic'], |
25 | | - * model_to_evaluate: { |
26 | | - * model_name: |
27 | | - * 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo', |
28 | | - * system_template: |
29 | | - * 'Respond to the following comment. You can be informal but maintain a respectful tone.', |
30 | | - * input_template: |
31 | | - * "Here's a comment I saw online. How would you respond to it?\n\n{{prompt}}", |
32 | | - * max_tokens: 512, |
33 | | - * temperature: 0.7, |
34 | | - * }, |
35 | | - * input_data_file_path: 'file-abcd-1234', |
36 | | - * }, |
37 | | - * type: 'classify', |
38 | | - * }); |
39 | | - * ``` |
40 | | - */ |
41 | | - create(body: EvaluationCreateParams, options?: RequestOptions): APIPromise<EvaluationCreateResponse> { |
42 | | - return this._client.post('/evaluation', { body, ...options }); |
43 | | - } |
44 | | - |
45 | 9 | /** |
46 | 10 | * Get details of a specific evaluation job |
47 | | - * |
48 | | - * @example |
49 | | - * ```ts |
50 | | - * const evaluation = await client.evaluation.retrieve('id'); |
51 | | - * ``` |
52 | 11 | */ |
53 | 12 | retrieve(id: string, options?: RequestOptions): APIPromise<EvaluationRetrieveResponse> { |
54 | 13 | return this._client.get(path`/evaluation/${id}`, options); |
55 | 14 | } |
56 | 15 |
|
57 | 16 | /** |
58 | 17 | * Get the status and results of a specific evaluation job |
59 | | - * |
60 | | - * @example |
61 | | - * ```ts |
62 | | - * const response = await client.evaluation.getStatus('id'); |
63 | | - * ``` |
64 | 18 | */ |
65 | 19 | getStatus(id: string, options?: RequestOptions): APIPromise<EvaluationGetStatusResponse> { |
66 | 20 | return this._client.get(path`/evaluation/${id}/status`, options); |
67 | 21 | } |
68 | 22 |
|
69 | 23 | /** |
70 | 24 | * Internal callback endpoint for workflows to update job status and results |
71 | | - * |
72 | | - * @example |
73 | | - * ```ts |
74 | | - * const response = await client.evaluation.updateStatus( |
75 | | - * 'id', |
76 | | - * { status: 'completed' }, |
77 | | - * ); |
78 | | - * ``` |
79 | 25 | */ |
80 | 26 | updateStatus( |
81 | 27 | id: string, |
@@ -125,18 +71,6 @@ export interface EvaluationModelRequest { |
125 | 71 | temperature: number; |
126 | 72 | } |
127 | 73 |
|
128 | | -export interface EvaluationCreateResponse { |
129 | | - /** |
130 | | - * Initial status of the job |
131 | | - */ |
132 | | - status?: 'pending'; |
133 | | - |
134 | | - /** |
135 | | - * The ID of the created evaluation job |
136 | | - */ |
137 | | - workflow_id?: string; |
138 | | -} |
139 | | - |
140 | 74 | export interface EvaluationRetrieveResponse { |
141 | 75 | /** |
142 | 76 | * When the job was created |
@@ -451,95 +385,6 @@ export interface EvaluationUpdateStatusResponse { |
451 | 385 | workflow_id?: string; |
452 | 386 | } |
453 | 387 |
|
454 | | -export interface EvaluationCreateParams { |
455 | | - /** |
456 | | - * Type-specific parameters for the evaluation |
457 | | - */ |
458 | | - parameters: |
459 | | - | EvaluationCreateParams.EvaluationClassifyParameters |
460 | | - | EvaluationCreateParams.EvaluationScoreParameters |
461 | | - | EvaluationCreateParams.EvaluationCompareParameters; |
462 | | - |
463 | | - /** |
464 | | - * The type of evaluation to perform |
465 | | - */ |
466 | | - type: 'classify' | 'score' | 'compare'; |
467 | | -} |
468 | | - |
469 | | -export namespace EvaluationCreateParams { |
470 | | - export interface EvaluationClassifyParameters { |
471 | | - /** |
472 | | - * Data file ID |
473 | | - */ |
474 | | - input_data_file_path: string; |
475 | | - |
476 | | - judge: EvaluationAPI.EvaluationJudgeModelConfig; |
477 | | - |
478 | | - /** |
479 | | - * List of possible classification labels |
480 | | - */ |
481 | | - labels: Array<string>; |
482 | | - |
483 | | - /** |
484 | | - * List of labels that are considered passing |
485 | | - */ |
486 | | - pass_labels: Array<string>; |
487 | | - |
488 | | - /** |
489 | | - * Field name in the input data |
490 | | - */ |
491 | | - model_to_evaluate?: string | EvaluationAPI.EvaluationModelRequest; |
492 | | - } |
493 | | - |
494 | | - export interface EvaluationScoreParameters { |
495 | | - /** |
496 | | - * Data file ID |
497 | | - */ |
498 | | - input_data_file_path: string; |
499 | | - |
500 | | - judge: EvaluationAPI.EvaluationJudgeModelConfig; |
501 | | - |
502 | | - /** |
503 | | - * Maximum possible score |
504 | | - */ |
505 | | - max_score: number; |
506 | | - |
507 | | - /** |
508 | | - * Minimum possible score |
509 | | - */ |
510 | | - min_score: number; |
511 | | - |
512 | | - /** |
513 | | - * Score threshold for passing |
514 | | - */ |
515 | | - pass_threshold: number; |
516 | | - |
517 | | - /** |
518 | | - * Field name in the input data |
519 | | - */ |
520 | | - model_to_evaluate?: string | EvaluationAPI.EvaluationModelRequest; |
521 | | - } |
522 | | - |
523 | | - export interface EvaluationCompareParameters { |
524 | | - /** |
525 | | - * Data file name |
526 | | - */ |
527 | | - input_data_file_path: string; |
528 | | - |
529 | | - judge: EvaluationAPI.EvaluationJudgeModelConfig; |
530 | | - |
531 | | - /** |
532 | | - * Field name in the input data |
533 | | - */ |
534 | | - model_a?: string | EvaluationAPI.EvaluationModelRequest; |
535 | | - |
536 | | - /** |
537 | | - * Field name in the input data |
538 | | - */ |
539 | | - model_b?: string | EvaluationAPI.EvaluationModelRequest; |
540 | | - } |
541 | | -} |
542 | | - |
543 | 388 | export interface EvaluationUpdateStatusParams { |
544 | 389 | /** |
545 | 390 | * The new status for the job |
@@ -671,11 +516,9 @@ export declare namespace Evaluation { |
671 | 516 | export { |
672 | 517 | type EvaluationJudgeModelConfig as EvaluationJudgeModelConfig, |
673 | 518 | type EvaluationModelRequest as EvaluationModelRequest, |
674 | | - type EvaluationCreateResponse as EvaluationCreateResponse, |
675 | 519 | type EvaluationRetrieveResponse as EvaluationRetrieveResponse, |
676 | 520 | type EvaluationGetStatusResponse as EvaluationGetStatusResponse, |
677 | 521 | type EvaluationUpdateStatusResponse as EvaluationUpdateStatusResponse, |
678 | | - type EvaluationCreateParams as EvaluationCreateParams, |
679 | 522 | type EvaluationUpdateStatusParams as EvaluationUpdateStatusParams, |
680 | 523 | }; |
681 | 524 | } |
0 commit comments