Skip to content

Commit 78c9377

Browse files
author
Stainless Bot
committed
chore(internal): minor reformatting (#911)
1 parent e4c8100 commit 78c9377

23 files changed

+49
-48
lines changed

src/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from './core';
43
import * as Errors from './error';
5-
import { type Agent, type RequestInit } from './_shims/index';
64
import * as Uploads from './uploads';
5+
import { type Agent, type RequestInit } from './_shims/index';
6+
import * as Core from './core';
77
import * as Pagination from './pagination';
88
import * as API from './resources/index';
99

@@ -86,7 +86,9 @@ export interface ClientOptions {
8686
dangerouslyAllowBrowser?: boolean;
8787
}
8888

89-
/** API Client for interfacing with the OpenAI API. */
89+
/**
90+
* API Client for interfacing with the OpenAI API.
91+
*/
9092
export class OpenAI extends Core.APIClient {
9193
apiKey: string;
9294
organization: string | null;
@@ -143,6 +145,7 @@ export class OpenAI extends Core.APIClient {
143145
maxRetries: options.maxRetries,
144146
fetch: options.fetch,
145147
});
148+
146149
this._options = options;
147150

148151
this.apiKey = apiKey;

src/resources/audio/speech.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../core';
43
import { APIResource } from '../../resource';
4+
import * as Core from '../../core';
55
import * as SpeechAPI from './speech';
66
import { type Response } from '../../_shims/index';
77

src/resources/audio/transcriptions.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../core';
43
import { APIResource } from '../../resource';
4+
import * as Core from '../../core';
55
import * as TranscriptionsAPI from './transcriptions';
6-
import { type Uploadable, multipartFormRequestOptions } from '../../core';
76

87
export class Transcriptions extends APIResource {
98
/**
109
* Transcribes audio into the input language.
1110
*/
1211
create(body: TranscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise<Transcription> {
13-
return this._client.post('/audio/transcriptions', multipartFormRequestOptions({ body, ...options }));
12+
return this._client.post('/audio/transcriptions', Core.multipartFormRequestOptions({ body, ...options }));
1413
}
1514
}
1615

@@ -30,7 +29,7 @@ export interface TranscriptionCreateParams {
3029
* The audio file object (not file name) to transcribe, in one of these formats:
3130
* flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
3231
*/
33-
file: Uploadable;
32+
file: Core.Uploadable;
3433

3534
/**
3635
* ID of the model to use. Only `whisper-1` (which is powered by our open source

src/resources/audio/translations.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../core';
43
import { APIResource } from '../../resource';
4+
import * as Core from '../../core';
55
import * as TranslationsAPI from './translations';
6-
import { type Uploadable, multipartFormRequestOptions } from '../../core';
76

87
export class Translations extends APIResource {
98
/**
109
* Translates audio into English.
1110
*/
1211
create(body: TranslationCreateParams, options?: Core.RequestOptions): Core.APIPromise<Translation> {
13-
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options }));
12+
return this._client.post('/audio/translations', Core.multipartFormRequestOptions({ body, ...options }));
1413
}
1514
}
1615

@@ -23,7 +22,7 @@ export interface TranslationCreateParams {
2322
* The audio file object (not file name) translate, in one of these formats: flac,
2423
* mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
2524
*/
26-
file: Uploadable;
25+
file: Core.Uploadable;
2726

2827
/**
2928
* ID of the model to use. Only `whisper-1` (which is powered by our open source

src/resources/batches.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
54
import { isRequestOptions } from '../core';
5+
import * as Core from '../core';
66
import * as BatchesAPI from './batches';
77
import { CursorPage, type CursorPageParams } from '../pagination';
88

src/resources/beta/assistants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../core';
43
import { APIResource } from '../../resource';
54
import { isRequestOptions } from '../../core';
5+
import * as Core from '../../core';
66
import * as AssistantsAPI from './assistants';
77
import * as Shared from '../shared';
88
import * as MessagesAPI from './threads/messages';

src/resources/beta/threads/messages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
54
import { isRequestOptions } from '../../../core';
5+
import * as Core from '../../../core';
66
import * as MessagesAPI from './messages';
77
import * as AssistantsAPI from '../assistants';
88
import { CursorPage, type CursorPageParams } from '../../../pagination';

src/resources/beta/threads/runs/runs.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../../core';
4-
import { APIPromise } from '../../../../core';
53
import { APIResource } from '../../../../resource';
64
import { isRequestOptions } from '../../../../core';
5+
import { APIPromise } from '../../../../core';
6+
import * as Core from '../../../../core';
77
import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream';
88
import { sleep } from '../../../../core';
99
import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream';

src/resources/beta/threads/runs/steps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../../core';
43
import { APIResource } from '../../../../resource';
54
import { isRequestOptions } from '../../../../core';
5+
import * as Core from '../../../../core';
66
import * as StepsAPI from './steps';
77
import { CursorPage, type CursorPageParams } from '../../../../pagination';
88

src/resources/beta/threads/threads.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
4-
import { APIPromise } from '../../../core';
53
import { APIResource } from '../../../resource';
64
import { isRequestOptions } from '../../../core';
75
import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream';
6+
import { APIPromise } from '../../../core';
7+
import * as Core from '../../../core';
88
import * as ThreadsAPI from './threads';
99
import * as AssistantsAPI from '../assistants';
1010
import * as MessagesAPI from './messages';

src/resources/beta/vector-stores/file-batches.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
54
import { isRequestOptions } from '../../../core';
65
import { sleep } from '../../../core';
76
import { Uploadable } from '../../../core';
87
import { allSettledWithThrow } from '../../../lib/Util';
8+
import * as Core from '../../../core';
99
import * as FileBatchesAPI from './file-batches';
1010
import * as FilesAPI from './files';
1111
import { VectorStoreFilesPage } from './files';

src/resources/beta/vector-stores/files.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
5-
import { isRequestOptions } from '../../../core';
6-
import { sleep, Uploadable } from '../../../core';
4+
import { sleep, Uploadable, isRequestOptions } from '../../../core';
5+
import * as Core from '../../../core';
76
import * as FilesAPI from './files';
87
import { CursorPage, type CursorPageParams } from '../../../pagination';
98

src/resources/beta/vector-stores/vector-stores.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
54
import { isRequestOptions } from '../../../core';
5+
import * as Core from '../../../core';
66
import * as VectorStoresAPI from './vector-stores';
77
import * as FileBatchesAPI from './file-batches';
88
import * as FilesAPI from './files';

src/resources/chat/completions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../core';
4-
import { APIPromise } from '../../core';
53
import { APIResource } from '../../resource';
4+
import { APIPromise } from '../../core';
5+
import * as Core from '../../core';
66
import * as ChatCompletionsAPI from './completions';
77
import * as CompletionsAPI from '../completions';
88
import * as Shared from '../shared';

src/resources/completions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
4-
import { APIPromise } from '../core';
53
import { APIResource } from '../resource';
4+
import { APIPromise } from '../core';
5+
import * as Core from '../core';
66
import * as CompletionsAPI from './completions';
77
import * as ChatCompletionsAPI from './chat/completions';
88
import { Stream } from '../streaming';

src/resources/embeddings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
4+
import * as Core from '../core';
55
import * as EmbeddingsAPI from './embeddings';
66

77
export class Embeddings extends APIResource {

src/resources/files.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
54
import { isRequestOptions } from '../core';
65
import { sleep } from '../core';
76
import { APIConnectionTimeoutError } from '../error';
7+
import * as Core from '../core';
88
import * as FilesAPI from './files';
9-
import { type Uploadable, multipartFormRequestOptions } from '../core';
109
import { Page } from '../pagination';
1110
import { type Response } from '../_shims/index';
1211

@@ -35,7 +34,7 @@ export class Files extends APIResource {
3534
* storage limits.
3635
*/
3736
create(body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise<FileObject> {
38-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }));
37+
return this._client.post('/files', Core.multipartFormRequestOptions({ body, ...options }));
3938
}
4039

4140
/**
@@ -188,7 +187,7 @@ export interface FileCreateParams {
188187
/**
189188
* The File object (not file name) to be uploaded.
190189
*/
191-
file: Uploadable;
190+
file: Core.Uploadable;
192191

193192
/**
194193
* The intended purpose of the uploaded file.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
54
import { isRequestOptions } from '../../../core';
5+
import * as Core from '../../../core';
66
import * as CheckpointsAPI from './checkpoints';
77
import { CursorPage, type CursorPageParams } from '../../../pagination';
88

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../../../core';
43
import { APIResource } from '../../../resource';
54
import { isRequestOptions } from '../../../core';
5+
import * as Core from '../../../core';
66
import * as JobsAPI from './jobs';
77
import * as CheckpointsAPI from './checkpoints';
88
import { CursorPage, type CursorPageParams } from '../../../pagination';

src/resources/images.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
4+
import * as Core from '../core';
55
import * as ImagesAPI from './images';
6-
import { type Uploadable, multipartFormRequestOptions } from '../core';
76

87
export class Images extends APIResource {
98
/**
@@ -13,14 +12,14 @@ export class Images extends APIResource {
1312
body: ImageCreateVariationParams,
1413
options?: Core.RequestOptions,
1514
): Core.APIPromise<ImagesResponse> {
16-
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }));
15+
return this._client.post('/images/variations', Core.multipartFormRequestOptions({ body, ...options }));
1716
}
1817

1918
/**
2019
* Creates an edited or extended image given an original image and a prompt.
2120
*/
2221
edit(body: ImageEditParams, options?: Core.RequestOptions): Core.APIPromise<ImagesResponse> {
23-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options }));
22+
return this._client.post('/images/edits', Core.multipartFormRequestOptions({ body, ...options }));
2423
}
2524

2625
/**
@@ -64,7 +63,7 @@ export interface ImageCreateVariationParams {
6463
* The image to use as the basis for the variation(s). Must be a valid PNG file,
6564
* less than 4MB, and square.
6665
*/
67-
image: Uploadable;
66+
image: Core.Uploadable;
6867

6968
/**
7069
* The model to use for image generation. Only `dall-e-2` is supported at this
@@ -104,7 +103,7 @@ export interface ImageEditParams {
104103
* The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask
105104
* is not provided, image must have transparency, which will be used as the mask.
106105
*/
107-
image: Uploadable;
106+
image: Core.Uploadable;
108107

109108
/**
110109
* A text description of the desired image(s). The maximum length is 1000
@@ -117,7 +116,7 @@ export interface ImageEditParams {
117116
* indicate where `image` should be edited. Must be a valid PNG file, less than
118117
* 4MB, and have the same dimensions as `image`.
119118
*/
120-
mask?: Uploadable;
119+
mask?: Core.Uploadable;
121120

122121
/**
123122
* The model to use for image generation. Only `dall-e-2` is supported at this

src/resources/models.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
4+
import * as Core from '../core';
55
import * as ModelsAPI from './models';
66
import { Page } from '../pagination';
77

src/resources/moderations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import * as Core from '../core';
43
import { APIResource } from '../resource';
4+
import * as Core from '../core';
55
import * as ModerationsAPI from './moderations';
66

77
export class Moderations extends APIResource {

tests/stringifyQuery.test.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { APIClient } from 'openai/core';
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
const { stringifyQuery } = APIClient.prototype as any;
3+
import { OpenAI } from 'openai';
44

5-
describe('APIClient.stringifyQuery', () => {
5+
const { stringifyQuery } = OpenAI.prototype as any;
6+
7+
describe(stringifyQuery, () => {
68
for (const [input, expected] of [
79
[{ a: '1', b: 2, c: true }, 'a=1&b=2&c=true'],
810
[{ a: null, b: false, c: undefined }, 'a=&b=false'],
@@ -18,6 +20,7 @@ describe('APIClient.stringifyQuery', () => {
1820
expect(stringifyQuery(input)).toEqual(expected);
1921
});
2022
}
23+
2124
for (const value of [[], {}, new Date()]) {
2225
it(`${JSON.stringify(value)} -> <error>`, () => {
2326
expect(() => stringifyQuery({ value })).toThrow(`Cannot stringify type ${typeof value}`);

0 commit comments

Comments
 (0)