Skip to content

Commit 992a9d8

Browse files
fix(api): Fix evals and code interpreter interfaces
1 parent a65428f commit 992a9d8

File tree

10 files changed

+80
-40
lines changed

10 files changed

+80
-40
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml
3-
openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615
4-
config_hash: e618aa8ff61aea826540916336de65a6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2bcc845d8635bf93ddcf9ee723af4d7928248412a417bee5fc10d863a1e13867.yml
3+
openapi_spec_hash: 865230cb3abeb01bd85de05891af23c4
4+
config_hash: ed1e6b3c5f93d12b80d31167f55c557c

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ Methods:
709709
- <code title="post /responses">client.responses.<a href="./src/resources/responses/responses.ts">create</a>({ ...params }) -> Response</code>
710710
- <code title="get /responses/{response_id}">client.responses.<a href="./src/resources/responses/responses.ts">retrieve</a>(responseID, { ...params }) -> Response</code>
711711
- <code title="delete /responses/{response_id}">client.responses.<a href="./src/resources/responses/responses.ts">delete</a>(responseID) -> void</code>
712-
- <code title="post /responses/{response_id}/cancel">client.responses.<a href="./src/resources/responses/responses.ts">cancel</a>(responseID) -> void</code>
712+
- <code title="post /responses/{response_id}/cancel">client.responses.<a href="./src/resources/responses/responses.ts">cancel</a>(responseID) -> Response</code>
713713

714714
## InputItems
715715

src/resources/audio/transcriptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export namespace TranscriptionTextDeltaEvent {
199199
/**
200200
* The bytes that were used to generate the log probability.
201201
*/
202-
bytes?: Array<unknown>;
202+
bytes?: Array<number>;
203203

204204
/**
205205
* The log probability of the token.
@@ -244,7 +244,7 @@ export namespace TranscriptionTextDoneEvent {
244244
/**
245245
* The bytes that were used to generate the log probability.
246246
*/
247-
bytes?: Array<unknown>;
247+
bytes?: Array<number>;
248248

249249
/**
250250
* The log probability of the token.

src/resources/chat/completions/completions.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ export interface ChatCompletion {
280280
* utilize scale tier credits until they are exhausted.
281281
* - If set to 'auto', and the Project is not Scale tier enabled, the request will
282282
* be processed using the default service tier with a lower uptime SLA and no
283-
* latency guarentee.
283+
* latency guarantee.
284284
* - If set to 'default', the request will be processed using the default service
285-
* tier with a lower uptime SLA and no latency guarentee.
285+
* tier with a lower uptime SLA and no latency guarantee.
286286
* - If set to 'flex', the request will be processed with the Flex Processing
287287
* service tier.
288288
* [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -531,9 +531,9 @@ export interface ChatCompletionChunk {
531531
* utilize scale tier credits until they are exhausted.
532532
* - If set to 'auto', and the Project is not Scale tier enabled, the request will
533533
* be processed using the default service tier with a lower uptime SLA and no
534-
* latency guarentee.
534+
* latency guarantee.
535535
* - If set to 'default', the request will be processed using the default service
536-
* tier with a lower uptime SLA and no latency guarentee.
536+
* tier with a lower uptime SLA and no latency guarantee.
537537
* - If set to 'flex', the request will be processed with the Flex Processing
538538
* service tier.
539539
* [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -1453,9 +1453,9 @@ export interface ChatCompletionCreateParamsBase {
14531453
* utilize scale tier credits until they are exhausted.
14541454
* - If set to 'auto', and the Project is not Scale tier enabled, the request will
14551455
* be processed using the default service tier with a lower uptime SLA and no
1456-
* latency guarentee.
1456+
* latency guarantee.
14571457
* - If set to 'default', the request will be processed using the default service
1458-
* tier with a lower uptime SLA and no latency guarentee.
1458+
* tier with a lower uptime SLA and no latency guarantee.
14591459
* - If set to 'flex', the request will be processed with the Flex Processing
14601460
* service tier.
14611461
* [Learn more](https://platform.openai.com/docs/guides/flex-processing).

src/resources/fine-tuning/alpha/graders.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class Graders extends APIResource {
2020
* type: 'string_check',
2121
* },
2222
* model_sample: 'model_sample',
23-
* reference_answer: 'string',
2423
* });
2524
* ```
2625
*/
@@ -134,14 +133,20 @@ export interface GraderRunParams {
134133
| GraderModelsAPI.MultiGrader;
135134

136135
/**
137-
* The model sample to be evaluated.
136+
* The model sample to be evaluated. This value will be used to populate the
137+
* `sample` namespace. See
138+
* [the guide](https://platform.openai.com/docs/guides/graders) for more details.
139+
* The `output_json` variable will be populated if the model sample is a valid JSON
140+
* string.
138141
*/
139142
model_sample: string;
140143

141144
/**
142-
* The reference answer for the evaluation.
145+
* The dataset item provided to the grader. This will be used to populate the
146+
* `item` namespace. See
147+
* [the guide](https://platform.openai.com/docs/guides/graders) for more details.
143148
*/
144-
reference_answer: string | unknown | Array<unknown> | number;
149+
item?: unknown;
145150
}
146151

147152
export interface GraderValidateParams {

src/resources/fine-tuning/jobs/jobs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export namespace FineTuningJob {
295295
* Number of examples in each batch. A larger batch size means that model
296296
* parameters are updated less frequently, but with lower variance.
297297
*/
298-
batch_size?: unknown | 'auto' | number | null;
298+
batch_size?: 'auto' | number | null;
299299

300300
/**
301301
* Scaling factor for the learning rate. A smaller learning rate may be useful to

src/resources/graders/grader-models.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ export interface MultiGrader {
9292
*/
9393
calculate_output: string;
9494

95-
graders: Record<
96-
string,
97-
StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader
98-
>;
95+
/**
96+
* A StringCheckGrader object that performs a string comparison between input and
97+
* reference using a specified operation.
98+
*/
99+
graders: StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader;
99100

100101
/**
101102
* The name of the grader.

src/resources/images.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export interface ImageEditParams {
193193
* The image(s) to edit. Must be a supported image file or an array of images.
194194
*
195195
* For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
196-
* 25MB. You can provide up to 16 images.
196+
* 50MB. You can provide up to 16 images.
197197
*
198198
* For `dall-e-2`, you can only provide one image, and it should be a square `png`
199199
* file less than 4MB.

src/resources/responses/responses.ts

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,13 @@ export class Responses extends APIResource {
185185
*
186186
* @example
187187
* ```ts
188-
* await client.responses.cancel(
188+
* const response = await client.responses.cancel(
189189
* 'resp_677efb5139a88190b512bc3fef8e535d',
190190
* );
191191
* ```
192192
*/
193-
cancel(responseID: string, options?: RequestOptions): APIPromise<void> {
194-
return this._client.post(path`/responses/${responseID}/cancel`, {
195-
...options,
196-
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
197-
});
193+
cancel(responseID: string, options?: RequestOptions): APIPromise<Response> {
194+
return this._client.post(path`/responses/${responseID}/cancel`, options);
198195
}
199196
}
200197

@@ -488,9 +485,9 @@ export interface Response {
488485
* utilize scale tier credits until they are exhausted.
489486
* - If set to 'auto', and the Project is not Scale tier enabled, the request will
490487
* be processed using the default service tier with a lower uptime SLA and no
491-
* latency guarentee.
488+
* latency guarantee.
492489
* - If set to 'default', the request will be processed using the default service
493-
* tier with a lower uptime SLA and no latency guarentee.
490+
* tier with a lower uptime SLA and no latency guarantee.
494491
* - If set to 'flex', the request will be processed with the Flex Processing
495492
* service tier.
496493
* [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -643,9 +640,9 @@ export interface ResponseCodeInterpreterCallCodeDeltaEvent {
643640
sequence_number: number;
644641

645642
/**
646-
* The type of the event. Always `response.code_interpreter_call.code.delta`.
643+
* The type of the event. Always `response.code_interpreter_call_code.delta`.
647644
*/
648-
type: 'response.code_interpreter_call.code.delta';
645+
type: 'response.code_interpreter_call_code.delta';
649646
}
650647

651648
/**
@@ -668,9 +665,9 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent {
668665
sequence_number: number;
669666

670667
/**
671-
* The type of the event. Always `response.code_interpreter_call.code.done`.
668+
* The type of the event. Always `response.code_interpreter_call_code.done`.
672669
*/
673-
type: 'response.code_interpreter_call.code.done';
670+
type: 'response.code_interpreter_call_code.done';
674671
}
675672

676673
/**
@@ -1875,12 +1872,15 @@ export interface ResponseInProgressEvent {
18751872
* multi-turn conversations when using the Responses API statelessly (like when
18761873
* the `store` parameter is set to `false`, or when an organization is enrolled
18771874
* in the zero data retention program).
1875+
* - `code_interpreter_call.outputs`: Includes the outputs of python code execution
1876+
* in code interpreter tool call items.
18781877
*/
18791878
export type ResponseIncludable =
18801879
| 'file_search_call.results'
18811880
| 'message.input_image.image_url'
18821881
| 'computer_call_output.output.image_url'
1883-
| 'reasoning.encrypted_content';
1882+
| 'reasoning.encrypted_content'
1883+
| 'code_interpreter_call.outputs';
18841884

18851885
/**
18861886
* An event that is emitted when a response finishes as incomplete.
@@ -3296,7 +3296,10 @@ export interface ResponseOutputText {
32963296
* The annotations of the text output.
32973297
*/
32983298
annotations: Array<
3299-
ResponseOutputText.FileCitation | ResponseOutputText.URLCitation | ResponseOutputText.FilePath
3299+
| ResponseOutputText.FileCitation
3300+
| ResponseOutputText.URLCitation
3301+
| ResponseOutputText.ContainerFileCitation
3302+
| ResponseOutputText.FilePath
33003303
>;
33013304

33023305
/**
@@ -3363,6 +3366,36 @@ export namespace ResponseOutputText {
33633366
url: string;
33643367
}
33653368

3369+
/**
3370+
* A citation for a container file used to generate a model response.
3371+
*/
3372+
export interface ContainerFileCitation {
3373+
/**
3374+
* The ID of the container file.
3375+
*/
3376+
container_id: string;
3377+
3378+
/**
3379+
* The index of the last character of the container file citation in the message.
3380+
*/
3381+
end_index: number;
3382+
3383+
/**
3384+
* The ID of the file.
3385+
*/
3386+
file_id: string;
3387+
3388+
/**
3389+
* The index of the first character of the container file citation in the message.
3390+
*/
3391+
start_index: number;
3392+
3393+
/**
3394+
* The type of the container file citation. Always `container_file_citation`.
3395+
*/
3396+
type: 'container_file_citation';
3397+
}
3398+
33663399
/**
33673400
* A path to a file.
33683401
*/
@@ -4573,6 +4606,8 @@ export interface ResponseCreateParamsBase {
45734606
* multi-turn conversations when using the Responses API statelessly (like when
45744607
* the `store` parameter is set to `false`, or when an organization is enrolled
45754608
* in the zero data retention program).
4609+
* - `code_interpreter_call.outputs`: Includes the outputs of python code execution
4610+
* in code interpreter tool call items.
45764611
*/
45774612
include?: Array<ResponseIncludable> | null;
45784613

@@ -4631,9 +4666,9 @@ export interface ResponseCreateParamsBase {
46314666
* utilize scale tier credits until they are exhausted.
46324667
* - If set to 'auto', and the Project is not Scale tier enabled, the request will
46334668
* be processed using the default service tier with a lower uptime SLA and no
4634-
* latency guarentee.
4669+
* latency guarantee.
46354670
* - If set to 'default', the request will be processed using the default service
4636-
* tier with a lower uptime SLA and no latency guarentee.
4671+
* tier with a lower uptime SLA and no latency guarantee.
46374672
* - If set to 'flex', the request will be processed with the Flex Processing
46384673
* service tier.
46394674
* [Learn more](https://platform.openai.com/docs/guides/flex-processing).

tests/api-resources/fine-tuning/alpha/graders.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ describe('resource graders', () => {
1212
const responsePromise = client.fineTuning.alpha.graders.run({
1313
grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' },
1414
model_sample: 'model_sample',
15-
reference_answer: 'string',
1615
});
1716
const rawResponse = await responsePromise.asResponse();
1817
expect(rawResponse).toBeInstanceOf(Response);
@@ -27,7 +26,7 @@ describe('resource graders', () => {
2726
const response = await client.fineTuning.alpha.graders.run({
2827
grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' },
2928
model_sample: 'model_sample',
30-
reference_answer: 'string',
29+
item: {},
3130
});
3231
});
3332

0 commit comments

Comments
 (0)