Skip to content

Commit 7865910

Browse files
refactor(types): replace Record with mapped types
1 parent ab73eaf commit 7865910

File tree

12 files changed

+50
-50
lines changed

12 files changed

+50
-50
lines changed

src/resources/chat/completions/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ export interface ChatCompletionCreateParamsBase {
13311331
* increase likelihood of selection; values like -100 or 100 should result in a ban
13321332
* or exclusive selection of the relevant token.
13331333
*/
1334-
logit_bias?: Record<string, number> | null;
1334+
logit_bias?: { [key: string]: number } | null;
13351335

13361336
/**
13371337
* Whether to return log probabilities of the output tokens or not. If true,

src/resources/completions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export namespace CompletionChoice {
103103

104104
tokens?: Array<string>;
105105

106-
top_logprobs?: Array<Record<string, number>>;
106+
top_logprobs?: Array<{ [key: string]: number }>;
107107
}
108108
}
109109

@@ -246,7 +246,7 @@ export interface CompletionCreateParamsBase {
246246
* As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token
247247
* from being generated.
248248
*/
249-
logit_bias?: Record<string, number> | null;
249+
logit_bias?: { [key: string]: number } | null;
250250

251251
/**
252252
* Include the log probabilities on the `logprobs` most likely output tokens, as

src/resources/evals/evals.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export interface EvalCustomDataSourceConfig {
8989
* The json schema for the run data source items. Learn how to build JSON schemas
9090
* [here](https://json-schema.org/).
9191
*/
92-
schema: Record<string, unknown>;
92+
schema: { [key: string]: unknown };
9393

9494
/**
9595
* The type of data source. Always `custom`.
@@ -105,7 +105,7 @@ export interface EvalStoredCompletionsDataSourceConfig {
105105
* The json schema for the run data source items. Learn how to build JSON schemas
106106
* [here](https://json-schema.org/).
107107
*/
108-
schema: Record<string, unknown>;
108+
schema: { [key: string]: unknown };
109109

110110
/**
111111
* The type of data source. Always `stored_completions`.
@@ -195,7 +195,7 @@ export namespace EvalCreateResponse {
195195
* The json schema for the run data source items. Learn how to build JSON schemas
196196
* [here](https://json-schema.org/).
197197
*/
198-
schema: Record<string, unknown>;
198+
schema: { [key: string]: unknown };
199199

200200
/**
201201
* The type of data source. Always `logs`.
@@ -316,7 +316,7 @@ export namespace EvalRetrieveResponse {
316316
* The json schema for the run data source items. Learn how to build JSON schemas
317317
* [here](https://json-schema.org/).
318318
*/
319-
schema: Record<string, unknown>;
319+
schema: { [key: string]: unknown };
320320

321321
/**
322322
* The type of data source. Always `logs`.
@@ -437,7 +437,7 @@ export namespace EvalUpdateResponse {
437437
* The json schema for the run data source items. Learn how to build JSON schemas
438438
* [here](https://json-schema.org/).
439439
*/
440-
schema: Record<string, unknown>;
440+
schema: { [key: string]: unknown };
441441

442442
/**
443443
* The type of data source. Always `logs`.
@@ -558,7 +558,7 @@ export namespace EvalListResponse {
558558
* The json schema for the run data source items. Learn how to build JSON schemas
559559
* [here](https://json-schema.org/).
560560
*/
561-
schema: Record<string, unknown>;
561+
schema: { [key: string]: unknown };
562562

563563
/**
564564
* The type of data source. Always `logs`.
@@ -665,7 +665,7 @@ export namespace EvalCreateParams {
665665
/**
666666
* The json schema for each row in the data source.
667667
*/
668-
item_schema: Record<string, unknown>;
668+
item_schema: { [key: string]: unknown };
669669

670670
/**
671671
* The type of data source. Always `custom`.
@@ -692,7 +692,7 @@ export namespace EvalCreateParams {
692692
/**
693693
* Metadata filters for the logs data source.
694694
*/
695-
metadata?: Record<string, unknown>;
695+
metadata?: { [key: string]: unknown };
696696
}
697697

698698
/**
@@ -707,7 +707,7 @@ export namespace EvalCreateParams {
707707
/**
708708
* Metadata filters for the stored completions data source.
709709
*/
710-
metadata?: Record<string, unknown>;
710+
metadata?: { [key: string]: unknown };
711711
}
712712

713713
/**

src/resources/evals/runs/output-items.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface OutputItemRetrieveResponse {
5656
/**
5757
* Details of the input data source item.
5858
*/
59-
datasource_item: Record<string, unknown>;
59+
datasource_item: { [key: string]: unknown };
6060

6161
/**
6262
* The identifier for the data source item.
@@ -76,7 +76,7 @@ export interface OutputItemRetrieveResponse {
7676
/**
7777
* A list of results from the evaluation run.
7878
*/
79-
results: Array<Record<string, unknown>>;
79+
results: Array<{ [key: string]: unknown }>;
8080

8181
/**
8282
* The identifier of the evaluation run associated with this output item.
@@ -222,7 +222,7 @@ export interface OutputItemListResponse {
222222
/**
223223
* Details of the input data source item.
224224
*/
225-
datasource_item: Record<string, unknown>;
225+
datasource_item: { [key: string]: unknown };
226226

227227
/**
228228
* The identifier for the data source item.
@@ -242,7 +242,7 @@ export interface OutputItemListResponse {
242242
/**
243243
* A list of results from the evaluation run.
244244
*/
245-
results: Array<Record<string, unknown>>;
245+
results: Array<{ [key: string]: unknown }>;
246246

247247
/**
248248
* The identifier of the evaluation run associated with this output item.

src/resources/evals/runs/runs.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ export namespace CreateEvalCompletionsRunDataSource {
125125

126126
export namespace FileContent {
127127
export interface Content {
128-
item: Record<string, unknown>;
128+
item: { [key: string]: unknown };
129129

130-
sample?: Record<string, unknown>;
130+
sample?: { [key: string]: unknown };
131131
}
132132
}
133133

@@ -330,9 +330,9 @@ export namespace CreateEvalJSONLRunDataSource {
330330

331331
export namespace FileContent {
332332
export interface Content {
333-
item: Record<string, unknown>;
333+
item: { [key: string]: unknown };
334334

335-
sample?: Record<string, unknown>;
335+
sample?: { [key: string]: unknown };
336336
}
337337
}
338338

@@ -493,9 +493,9 @@ export namespace RunCreateResponse {
493493

494494
export namespace FileContent {
495495
export interface Content {
496-
item: Record<string, unknown>;
496+
item: { [key: string]: unknown };
497497

498-
sample?: Record<string, unknown>;
498+
sample?: { [key: string]: unknown };
499499
}
500500
}
501501

@@ -940,9 +940,9 @@ export namespace RunRetrieveResponse {
940940

941941
export namespace FileContent {
942942
export interface Content {
943-
item: Record<string, unknown>;
943+
item: { [key: string]: unknown };
944944

945-
sample?: Record<string, unknown>;
945+
sample?: { [key: string]: unknown };
946946
}
947947
}
948948

@@ -1384,9 +1384,9 @@ export namespace RunListResponse {
13841384

13851385
export namespace FileContent {
13861386
export interface Content {
1387-
item: Record<string, unknown>;
1387+
item: { [key: string]: unknown };
13881388

1389-
sample?: Record<string, unknown>;
1389+
sample?: { [key: string]: unknown };
13901390
}
13911391
}
13921392

@@ -1839,9 +1839,9 @@ export namespace RunCancelResponse {
18391839

18401840
export namespace FileContent {
18411841
export interface Content {
1842-
item: Record<string, unknown>;
1842+
item: { [key: string]: unknown };
18431843

1844-
sample?: Record<string, unknown>;
1844+
sample?: { [key: string]: unknown };
18451845
}
18461846
}
18471847

@@ -2233,9 +2233,9 @@ export namespace RunCreateParams {
22332233

22342234
export namespace FileContent {
22352235
export interface Content {
2236-
item: Record<string, unknown>;
2236+
item: { [key: string]: unknown };
22372237

2238-
sample?: Record<string, unknown>;
2238+
sample?: { [key: string]: unknown };
22392239
}
22402240
}
22412241

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export class Graders extends APIResource {
5252
export interface GraderRunResponse {
5353
metadata: GraderRunResponse.Metadata;
5454

55-
model_grader_token_usage_per_model: Record<string, unknown>;
55+
model_grader_token_usage_per_model: { [key: string]: unknown };
5656

5757
reward: number;
5858

59-
sub_rewards: Record<string, unknown>;
59+
sub_rewards: { [key: string]: unknown };
6060
}
6161

6262
export namespace GraderRunResponse {
@@ -69,7 +69,7 @@ export namespace GraderRunResponse {
6969

7070
sampled_model_name: string | null;
7171

72-
scores: Record<string, unknown>;
72+
scores: { [key: string]: unknown };
7373

7474
token_usage: number | null;
7575

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ export interface JobListParams extends CursorPageParams {
624624
* Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
625625
* Alternatively, set `metadata=null` to indicate no metadata.
626626
*/
627-
metadata?: Record<string, string> | null;
627+
metadata?: { [key: string]: string } | null;
628628
}
629629

630630
export interface JobListEventsParams extends CursorPageParams {}

src/resources/responses/responses.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export interface FunctionTool {
312312
/**
313313
* A JSON schema object describing the parameters of the function.
314314
*/
315-
parameters: Record<string, unknown> | null;
315+
parameters: { [key: string]: unknown } | null;
316316

317317
/**
318318
* Whether to enforce strict parameter validation. Default `true`.
@@ -1491,7 +1491,7 @@ export namespace ResponseFileSearchToolCall {
14911491
* length of 64 characters. Values are strings with a maximum length of 512
14921492
* characters, booleans, or numbers.
14931493
*/
1494-
attributes?: Record<string, string | number | boolean> | null;
1494+
attributes?: { [key: string]: string | number | boolean } | null;
14951495

14961496
/**
14971497
* The unique ID of the file.
@@ -1551,7 +1551,7 @@ export interface ResponseFormatTextJSONSchemaConfig {
15511551
* The schema for the response format, described as a JSON Schema object. Learn how
15521552
* to build JSON schemas [here](https://json-schema.org/).
15531553
*/
1554-
schema: Record<string, unknown>;
1554+
schema: { [key: string]: unknown };
15551555

15561556
/**
15571557
* The type of response format being defined. Always `json_schema`.
@@ -2209,7 +2209,7 @@ export namespace ResponseInputItem {
22092209
/**
22102210
* Environment variables to set for the command.
22112211
*/
2212-
env: Record<string, string>;
2212+
env: { [key: string]: string };
22132213

22142214
/**
22152215
* The type of the local shell action. Always `exec`.
@@ -2571,7 +2571,7 @@ export namespace ResponseItem {
25712571
/**
25722572
* Environment variables to set for the command.
25732573
*/
2574-
env: Record<string, string>;
2574+
env: { [key: string]: string };
25752575

25762576
/**
25772577
* The type of the local shell action. Always `exec`.
@@ -3046,7 +3046,7 @@ export namespace ResponseOutputItem {
30463046
/**
30473047
* Environment variables to set for the command.
30483048
*/
3049-
env: Record<string, string>;
3049+
env: { [key: string]: string };
30503050

30513051
/**
30523052
* The type of the local shell action. Always `exec`.
@@ -3514,7 +3514,7 @@ export interface ResponsePrompt {
35143514
* substitution values can either be strings, or other Response input types like
35153515
* images or files.
35163516
*/
3517-
variables?: Record<string, string | ResponseInputText | ResponseInputImage | ResponseInputFile> | null;
3517+
variables?: { [key: string]: string | ResponseInputText | ResponseInputImage | ResponseInputFile } | null;
35183518

35193519
/**
35203520
* Optional version of the prompt template.
@@ -4309,7 +4309,7 @@ export namespace Tool {
43094309
* Optional HTTP headers to send to the MCP server. Use for authentication or other
43104310
* purposes.
43114311
*/
4312-
headers?: Record<string, string> | null;
4312+
headers?: { [key: string]: string } | null;
43134313

43144314
/**
43154315
* Specify which of the MCP server's tools require approval.

src/resources/shared.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export interface FunctionDefinition {
165165
*
166166
* Omitting `parameters` defines a function with an empty parameter list.
167167
*/
168-
export type FunctionParameters = Record<string, unknown>;
168+
export type FunctionParameters = { [key: string]: unknown };
169169

170170
/**
171171
* Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -175,7 +175,7 @@ export type FunctionParameters = Record<string, unknown>;
175175
* Keys are strings with a maximum length of 64 characters. Values are strings with
176176
* a maximum length of 512 characters.
177177
*/
178-
export type Metadata = Record<string, string>;
178+
export type Metadata = { [key: string]: string };
179179

180180
/**
181181
* **o-series models only**
@@ -271,7 +271,7 @@ export namespace ResponseFormatJSONSchema {
271271
* The schema for the response format, described as a JSON Schema object. Learn how
272272
* to build JSON schemas [here](https://json-schema.org/).
273273
*/
274-
schema?: Record<string, unknown>;
274+
schema?: { [key: string]: unknown };
275275

276276
/**
277277
* Whether to enable strict schema adherence when generating the output. If set to

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export interface FileBatchCreateParams {
269269
* length of 64 characters. Values are strings with a maximum length of 512
270270
* characters, booleans, or numbers.
271271
*/
272-
attributes?: Record<string, string | number | boolean> | null;
272+
attributes?: { [key: string]: string | number | boolean } | null;
273273

274274
/**
275275
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`

0 commit comments

Comments
 (0)