Skip to content

Commit 6421d69

Browse files
Stainless Botstainless-app[bot]
Stainless Bot
authored andcommitted
refactor: use type imports for type-only imports (#1159)
1 parent 622c80a commit 6421d69

40 files changed

+1307
-884
lines changed

Diff for: src/index.ts

+251-126
Large diffs are not rendered by default.

Diff for: src/lib/AssistantStream.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Text,
77
ImageFile,
88
TextDelta,
9-
Messages,
9+
MessageDelta,
1010
MessageContent,
1111
} from 'openai/resources/beta/threads/messages';
1212
import * as Core from 'openai/core';
@@ -31,7 +31,6 @@ import {
3131
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from 'openai/resources/beta/threads/runs/steps';
3232
import { ThreadCreateAndRunParamsBase, Threads } from 'openai/resources/beta/threads/threads';
3333
import { BaseEvents, EventStream } from './EventStream';
34-
import MessageDelta = Messages.MessageDelta;
3534

3635
export interface AssistantStreamEvents extends BaseEvents {
3736
run: (run: Run) => void;

Diff for: src/resources/audio/audio.ts

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

33
import { APIResource } from '../../resource';
4-
import * as AudioAPI from './audio';
54
import * as SpeechAPI from './speech';
5+
import { Speech, SpeechCreateParams, SpeechModel } from './speech';
66
import * as TranscriptionsAPI from './transcriptions';
7+
import {
8+
Transcription,
9+
TranscriptionCreateParams,
10+
TranscriptionCreateResponse,
11+
TranscriptionSegment,
12+
TranscriptionVerbose,
13+
TranscriptionWord,
14+
Transcriptions,
15+
} from './transcriptions';
716
import * as TranslationsAPI from './translations';
17+
import {
18+
Translation,
19+
TranslationCreateParams,
20+
TranslationCreateResponse,
21+
TranslationVerbose,
22+
Translations,
23+
} from './translations';
824

925
export class Audio extends APIResource {
1026
transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this._client);
@@ -20,30 +36,30 @@ export type AudioModel = 'whisper-1';
2036
*/
2137
export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
2238

23-
export namespace Audio {
24-
export import AudioModel = AudioAPI.AudioModel;
25-
export import AudioResponseFormat = AudioAPI.AudioResponseFormat;
26-
export import Transcriptions = TranscriptionsAPI.Transcriptions;
27-
export import Transcription = TranscriptionsAPI.Transcription;
28-
export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment;
29-
export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose;
30-
export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord;
31-
export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
32-
export type TranscriptionCreateParams<
33-
ResponseFormat extends AudioAPI.AudioResponseFormat | undefined =
34-
| AudioAPI.AudioResponseFormat
35-
| undefined,
36-
> = TranscriptionsAPI.TranscriptionCreateParams<ResponseFormat>;
37-
export import Translations = TranslationsAPI.Translations;
38-
export import Translation = TranslationsAPI.Translation;
39-
export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
40-
export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
41-
export type TranslationCreateParams<
42-
ResponseFormat extends AudioAPI.AudioResponseFormat | undefined =
43-
| AudioAPI.AudioResponseFormat
44-
| undefined,
45-
> = TranslationsAPI.TranslationCreateParams<ResponseFormat>;
46-
export import Speech = SpeechAPI.Speech;
47-
export import SpeechModel = SpeechAPI.SpeechModel;
48-
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
39+
Audio.Transcriptions = Transcriptions;
40+
Audio.Translations = Translations;
41+
Audio.Speech = Speech;
42+
43+
export declare namespace Audio {
44+
export { type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat };
45+
46+
export {
47+
Transcriptions as Transcriptions,
48+
type Transcription as Transcription,
49+
type TranscriptionSegment as TranscriptionSegment,
50+
type TranscriptionVerbose as TranscriptionVerbose,
51+
type TranscriptionWord as TranscriptionWord,
52+
type TranscriptionCreateResponse as TranscriptionCreateResponse,
53+
type TranscriptionCreateParams as TranscriptionCreateParams,
54+
};
55+
56+
export {
57+
Translations as Translations,
58+
type Translation as Translation,
59+
type TranslationVerbose as TranslationVerbose,
60+
type TranslationCreateResponse as TranslationCreateResponse,
61+
type TranslationCreateParams as TranslationCreateParams,
62+
};
63+
64+
export { Speech as Speech, type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
4965
}

Diff for: src/resources/audio/index.ts

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

3-
export { AudioModel, AudioResponseFormat, Audio } from './audio';
4-
export { SpeechModel, SpeechCreateParams, Speech } from './speech';
3+
export { Audio, type AudioModel, type AudioResponseFormat } from './audio';
4+
export { Speech, type SpeechModel, type SpeechCreateParams } from './speech';
55
export {
6-
Transcription,
7-
TranscriptionSegment,
8-
TranscriptionVerbose,
9-
TranscriptionWord,
10-
TranscriptionCreateResponse,
11-
TranscriptionCreateParams,
126
Transcriptions,
7+
type Transcription,
8+
type TranscriptionSegment,
9+
type TranscriptionVerbose,
10+
type TranscriptionWord,
11+
type TranscriptionCreateResponse,
12+
type TranscriptionCreateParams,
1313
} from './transcriptions';
1414
export {
15-
Translation,
16-
TranslationVerbose,
17-
TranslationCreateResponse,
18-
TranslationCreateParams,
1915
Translations,
16+
type Translation,
17+
type TranslationVerbose,
18+
type TranslationCreateResponse,
19+
type TranslationCreateParams,
2020
} from './translations';

Diff for: src/resources/audio/speech.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as SpeechAPI from './speech';
65
import { type Response } from '../../_shims/index';
76

87
export class Speech extends APIResource {
@@ -49,7 +48,6 @@ export interface SpeechCreateParams {
4948
speed?: number;
5049
}
5150

52-
export namespace Speech {
53-
export import SpeechModel = SpeechAPI.SpeechModel;
54-
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
51+
export declare namespace Speech {
52+
export { type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
5553
}

Diff for: src/resources/audio/transcriptions.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as TranscriptionsAPI from './transcriptions';
65
import * as AudioAPI from './audio';
76

87
export class Transcriptions extends APIResource {
@@ -205,15 +204,13 @@ export interface TranscriptionCreateParams<
205204
timestamp_granularities?: Array<'word' | 'segment'>;
206205
}
207206

208-
export namespace Transcriptions {
209-
export import Transcription = TranscriptionsAPI.Transcription;
210-
export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment;
211-
export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose;
212-
export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord;
213-
export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
214-
export type TranscriptionCreateParams<
215-
ResponseFormat extends AudioAPI.AudioResponseFormat | undefined =
216-
| AudioAPI.AudioResponseFormat
217-
| undefined,
218-
> = TranscriptionsAPI.TranscriptionCreateParams<ResponseFormat>;
207+
export declare namespace Transcriptions {
208+
export {
209+
type Transcription as Transcription,
210+
type TranscriptionSegment as TranscriptionSegment,
211+
type TranscriptionVerbose as TranscriptionVerbose,
212+
type TranscriptionWord as TranscriptionWord,
213+
type TranscriptionCreateResponse as TranscriptionCreateResponse,
214+
type TranscriptionCreateParams as TranscriptionCreateParams,
215+
};
219216
}

Diff for: src/resources/audio/translations.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as TranslationsAPI from './translations';
65
import * as AudioAPI from './audio';
76
import * as TranscriptionsAPI from './transcriptions';
87

@@ -98,13 +97,11 @@ export interface TranslationCreateParams<
9897
temperature?: number;
9998
}
10099

101-
export namespace Translations {
102-
export import Translation = TranslationsAPI.Translation;
103-
export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
104-
export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
105-
export type TranslationCreateParams<
106-
ResponseFormat extends AudioAPI.AudioResponseFormat | undefined =
107-
| AudioAPI.AudioResponseFormat
108-
| undefined,
109-
> = TranslationsAPI.TranslationCreateParams<ResponseFormat>;
100+
export declare namespace Translations {
101+
export {
102+
type Translation as Translation,
103+
type TranslationVerbose as TranslationVerbose,
104+
type TranslationCreateResponse as TranslationCreateResponse,
105+
type TranslationCreateParams as TranslationCreateParams,
106+
};
110107
}

Diff for: src/resources/batches.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,15 @@ export interface BatchCreateParams {
244244

245245
export interface BatchListParams extends CursorPageParams {}
246246

247-
export namespace Batches {
248-
export import Batch = BatchesAPI.Batch;
249-
export import BatchError = BatchesAPI.BatchError;
250-
export import BatchRequestCounts = BatchesAPI.BatchRequestCounts;
251-
export import BatchesPage = BatchesAPI.BatchesPage;
252-
export import BatchCreateParams = BatchesAPI.BatchCreateParams;
253-
export import BatchListParams = BatchesAPI.BatchListParams;
247+
Batches.BatchesPage = BatchesPage;
248+
249+
export declare namespace Batches {
250+
export {
251+
type Batch as Batch,
252+
type BatchError as BatchError,
253+
type BatchRequestCounts as BatchRequestCounts,
254+
BatchesPage as BatchesPage,
255+
type BatchCreateParams as BatchCreateParams,
256+
type BatchListParams as BatchListParams,
257+
};
254258
}

Diff for: src/resources/beta/assistants.ts

+20-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { APIResource } from '../../resource';
44
import { isRequestOptions } from '../../core';
55
import * as Core from '../../core';
6-
import * as AssistantsAPI from './assistants';
76
import * as Shared from '../shared';
87
import * as ChatAPI from '../chat/chat';
98
import * as MessagesAPI from './threads/messages';
@@ -1396,20 +1395,24 @@ export interface AssistantListParams extends CursorPageParams {
13961395
order?: 'asc' | 'desc';
13971396
}
13981397

1399-
export namespace Assistants {
1400-
export import Assistant = AssistantsAPI.Assistant;
1401-
export import AssistantDeleted = AssistantsAPI.AssistantDeleted;
1402-
export import AssistantStreamEvent = AssistantsAPI.AssistantStreamEvent;
1403-
export import AssistantTool = AssistantsAPI.AssistantTool;
1404-
export import CodeInterpreterTool = AssistantsAPI.CodeInterpreterTool;
1405-
export import FileSearchTool = AssistantsAPI.FileSearchTool;
1406-
export import FunctionTool = AssistantsAPI.FunctionTool;
1407-
export import MessageStreamEvent = AssistantsAPI.MessageStreamEvent;
1408-
export import RunStepStreamEvent = AssistantsAPI.RunStepStreamEvent;
1409-
export import RunStreamEvent = AssistantsAPI.RunStreamEvent;
1410-
export import ThreadStreamEvent = AssistantsAPI.ThreadStreamEvent;
1411-
export import AssistantsPage = AssistantsAPI.AssistantsPage;
1412-
export import AssistantCreateParams = AssistantsAPI.AssistantCreateParams;
1413-
export import AssistantUpdateParams = AssistantsAPI.AssistantUpdateParams;
1414-
export import AssistantListParams = AssistantsAPI.AssistantListParams;
1398+
Assistants.AssistantsPage = AssistantsPage;
1399+
1400+
export declare namespace Assistants {
1401+
export {
1402+
type Assistant as Assistant,
1403+
type AssistantDeleted as AssistantDeleted,
1404+
type AssistantStreamEvent as AssistantStreamEvent,
1405+
type AssistantTool as AssistantTool,
1406+
type CodeInterpreterTool as CodeInterpreterTool,
1407+
type FileSearchTool as FileSearchTool,
1408+
type FunctionTool as FunctionTool,
1409+
type MessageStreamEvent as MessageStreamEvent,
1410+
type RunStepStreamEvent as RunStepStreamEvent,
1411+
type RunStreamEvent as RunStreamEvent,
1412+
type ThreadStreamEvent as ThreadStreamEvent,
1413+
AssistantsPage as AssistantsPage,
1414+
type AssistantCreateParams as AssistantCreateParams,
1415+
type AssistantUpdateParams as AssistantUpdateParams,
1416+
type AssistantListParams as AssistantListParams,
1417+
};
14151418
}

0 commit comments

Comments
 (0)