Skip to content

Commit 0a06324

Browse files
feat(api): add /v1/responses and built-in tools (#1367)
[platform.openai.com/docs/changelog](http://platform.openai.com/docs/changelog)
1 parent d4adb66 commit 0a06324

30 files changed

+4167
-280
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 74
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b524aed1c2c5c928aa4e2c546f5dbb364e7b4d5027daf05e42e210b05a97c3c6.yml
1+
configured_endpoints: 81
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-be834d63e326a82494e819085137f5eb15866f3fc787db1f3afe7168d419e18a.yml

api.md

+149-50
Large diffs are not rendered by default.

src/index.ts

+52-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,32 @@ import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'
6767
import { Beta } from './resources/beta/beta';
6868
import { Chat } from './resources/chat/chat';
6969
import { FineTuning } from './resources/fine-tuning/fine-tuning';
70+
import { Responses } from './resources/responses/responses';
7071
import {
7172
Upload,
7273
UploadCompleteParams,
7374
UploadCreateParams,
7475
Uploads as UploadsAPIUploads,
7576
} from './resources/uploads/uploads';
77+
import {
78+
AutoFileChunkingStrategyParam,
79+
FileChunkingStrategy,
80+
FileChunkingStrategyParam,
81+
OtherFileChunkingStrategyObject,
82+
StaticFileChunkingStrategy,
83+
StaticFileChunkingStrategyObject,
84+
StaticFileChunkingStrategyObjectParam,
85+
VectorStore,
86+
VectorStoreCreateParams,
87+
VectorStoreDeleted,
88+
VectorStoreListParams,
89+
VectorStoreSearchParams,
90+
VectorStoreSearchResponse,
91+
VectorStoreSearchResponsesPage,
92+
VectorStoreUpdateParams,
93+
VectorStores,
94+
VectorStoresPage,
95+
} from './resources/vector-stores/vector-stores';
7696
import {
7797
ChatCompletion,
7898
ChatCompletionAssistantMessageParam,
@@ -98,7 +118,6 @@ import {
98118
ChatCompletionModality,
99119
ChatCompletionNamedToolChoice,
100120
ChatCompletionPredictionContent,
101-
ChatCompletionReasoningEffort,
102121
ChatCompletionRole,
103122
ChatCompletionStoreMessage,
104123
ChatCompletionStreamOptions,
@@ -267,9 +286,11 @@ export class OpenAI extends Core.APIClient {
267286
moderations: API.Moderations = new API.Moderations(this);
268287
models: API.Models = new API.Models(this);
269288
fineTuning: API.FineTuning = new API.FineTuning(this);
289+
vectorStores: API.VectorStores = new API.VectorStores(this);
270290
beta: API.Beta = new API.Beta(this);
271291
batches: API.Batches = new API.Batches(this);
272292
uploads: API.Uploads = new API.Uploads(this);
293+
responses: API.Responses = new API.Responses(this);
273294

274295
protected override defaultQuery(): Core.DefaultQuery | undefined {
275296
return this._options.defaultQuery;
@@ -325,10 +346,14 @@ OpenAI.Moderations = Moderations;
325346
OpenAI.Models = Models;
326347
OpenAI.ModelsPage = ModelsPage;
327348
OpenAI.FineTuning = FineTuning;
349+
OpenAI.VectorStores = VectorStores;
350+
OpenAI.VectorStoresPage = VectorStoresPage;
351+
OpenAI.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
328352
OpenAI.Beta = Beta;
329353
OpenAI.Batches = Batches;
330354
OpenAI.BatchesPage = BatchesPage;
331355
OpenAI.Uploads = UploadsAPIUploads;
356+
OpenAI.Responses = Responses;
332357
export declare namespace OpenAI {
333358
export type RequestOptions = Core.RequestOptions;
334359

@@ -370,7 +395,6 @@ export declare namespace OpenAI {
370395
type ChatCompletionModality as ChatCompletionModality,
371396
type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice,
372397
type ChatCompletionPredictionContent as ChatCompletionPredictionContent,
373-
type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
374398
type ChatCompletionRole as ChatCompletionRole,
375399
type ChatCompletionStoreMessage as ChatCompletionStoreMessage,
376400
type ChatCompletionStreamOptions as ChatCompletionStreamOptions,
@@ -439,6 +463,26 @@ export declare namespace OpenAI {
439463

440464
export { FineTuning as FineTuning };
441465

466+
export {
467+
VectorStores as VectorStores,
468+
type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam,
469+
type FileChunkingStrategy as FileChunkingStrategy,
470+
type FileChunkingStrategyParam as FileChunkingStrategyParam,
471+
type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject,
472+
type StaticFileChunkingStrategy as StaticFileChunkingStrategy,
473+
type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject,
474+
type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam,
475+
type VectorStore as VectorStore,
476+
type VectorStoreDeleted as VectorStoreDeleted,
477+
type VectorStoreSearchResponse as VectorStoreSearchResponse,
478+
VectorStoresPage as VectorStoresPage,
479+
VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage,
480+
type VectorStoreCreateParams as VectorStoreCreateParams,
481+
type VectorStoreUpdateParams as VectorStoreUpdateParams,
482+
type VectorStoreListParams as VectorStoreListParams,
483+
type VectorStoreSearchParams as VectorStoreSearchParams,
484+
};
485+
442486
export { Beta as Beta };
443487

444488
export {
@@ -458,11 +502,17 @@ export declare namespace OpenAI {
458502
type UploadCompleteParams as UploadCompleteParams,
459503
};
460504

505+
export { Responses as Responses };
506+
461507
export type ChatModel = API.ChatModel;
508+
export type ComparisonFilter = API.ComparisonFilter;
509+
export type CompoundFilter = API.CompoundFilter;
462510
export type ErrorObject = API.ErrorObject;
463511
export type FunctionDefinition = API.FunctionDefinition;
464512
export type FunctionParameters = API.FunctionParameters;
465513
export type Metadata = API.Metadata;
514+
export type Reasoning = API.Reasoning;
515+
export type ReasoningEffort = API.ReasoningEffort;
466516
export type ResponseFormatJSONObject = API.ResponseFormatJSONObject;
467517
export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema;
468518
export type ResponseFormatText = API.ResponseFormatText;

src/resources/beta/assistants.ts

+45-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as Core from '../../core';
66
import * as Shared from '../shared';
77
import * as MessagesAPI from './threads/messages';
88
import * as ThreadsAPI from './threads/threads';
9-
import * as VectorStoresAPI from './vector-stores/vector-stores';
109
import * as RunsAPI from './threads/runs/runs';
1110
import * as StepsAPI from './threads/runs/steps';
1211
import { CursorPage, type CursorPageParams } from '../../pagination';
@@ -1133,14 +1132,14 @@ export interface AssistantCreateParams {
11331132
name?: string | null;
11341133

11351134
/**
1136-
* **o1 and o3-mini models only**
1135+
* **o-series models only**
11371136
*
11381137
* Constrains effort on reasoning for
11391138
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
11401139
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
11411140
* result in faster responses and fewer tokens used on reasoning in a response.
11421141
*/
1143-
reasoning_effort?: 'low' | 'medium' | 'high' | null;
1142+
reasoning_effort?: Shared.ReasoningEffort | null;
11441143

11451144
/**
11461145
* Specifies the format that the model must output. Compatible with
@@ -1243,9 +1242,9 @@ export namespace AssistantCreateParams {
12431242
export interface VectorStore {
12441243
/**
12451244
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
1246-
* strategy. Only applicable if `file_ids` is non-empty.
1245+
* strategy.
12471246
*/
1248-
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
1247+
chunking_strategy?: VectorStore.Auto | VectorStore.Static;
12491248

12501249
/**
12511250
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
@@ -1264,6 +1263,45 @@ export namespace AssistantCreateParams {
12641263
*/
12651264
metadata?: Shared.Metadata | null;
12661265
}
1266+
1267+
export namespace VectorStore {
1268+
/**
1269+
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
1270+
* `800` and `chunk_overlap_tokens` of `400`.
1271+
*/
1272+
export interface Auto {
1273+
/**
1274+
* Always `auto`.
1275+
*/
1276+
type: 'auto';
1277+
}
1278+
1279+
export interface Static {
1280+
static: Static.Static;
1281+
1282+
/**
1283+
* Always `static`.
1284+
*/
1285+
type: 'static';
1286+
}
1287+
1288+
export namespace Static {
1289+
export interface Static {
1290+
/**
1291+
* The number of tokens that overlap between chunks. The default value is `400`.
1292+
*
1293+
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1294+
*/
1295+
chunk_overlap_tokens: number;
1296+
1297+
/**
1298+
* The maximum number of tokens in each chunk. The default value is `800`. The
1299+
* minimum value is `100` and the maximum value is `4096`.
1300+
*/
1301+
max_chunk_size_tokens: number;
1302+
}
1303+
}
1304+
}
12671305
}
12681306
}
12691307
}
@@ -1336,14 +1374,14 @@ export interface AssistantUpdateParams {
13361374
name?: string | null;
13371375

13381376
/**
1339-
* **o1 and o3-mini models only**
1377+
* **o-series models only**
13401378
*
13411379
* Constrains effort on reasoning for
13421380
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
13431381
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
13441382
* result in faster responses and fewer tokens used on reasoning in a response.
13451383
*/
1346-
reasoning_effort?: 'low' | 'medium' | 'high' | null;
1384+
reasoning_effort?: Shared.ReasoningEffort | null;
13471385

13481386
/**
13491387
* Specifies the format that the model must output. Compatible with

src/resources/beta/beta.ts

-37
Original file line numberDiff line numberDiff line change
@@ -37,58 +37,21 @@ import {
3737
ThreadUpdateParams,
3838
Threads,
3939
} from './threads/threads';
40-
import * as VectorStoresAPI from './vector-stores/vector-stores';
41-
import {
42-
AutoFileChunkingStrategyParam,
43-
FileChunkingStrategy,
44-
FileChunkingStrategyParam,
45-
OtherFileChunkingStrategyObject,
46-
StaticFileChunkingStrategy,
47-
StaticFileChunkingStrategyObject,
48-
StaticFileChunkingStrategyObjectParam,
49-
VectorStore,
50-
VectorStoreCreateParams,
51-
VectorStoreDeleted,
52-
VectorStoreListParams,
53-
VectorStoreUpdateParams,
54-
VectorStores,
55-
VectorStoresPage,
56-
} from './vector-stores/vector-stores';
5740

5841
export class Beta extends APIResource {
5942
realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client);
60-
vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client);
6143
assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client);
6244
threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client);
6345
}
6446

6547
Beta.Realtime = Realtime;
66-
Beta.VectorStores = VectorStores;
67-
Beta.VectorStoresPage = VectorStoresPage;
6848
Beta.Assistants = Assistants;
6949
Beta.AssistantsPage = AssistantsPage;
7050
Beta.Threads = Threads;
7151

7252
export declare namespace Beta {
7353
export { Realtime as Realtime };
7454

75-
export {
76-
VectorStores as VectorStores,
77-
type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam,
78-
type FileChunkingStrategy as FileChunkingStrategy,
79-
type FileChunkingStrategyParam as FileChunkingStrategyParam,
80-
type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject,
81-
type StaticFileChunkingStrategy as StaticFileChunkingStrategy,
82-
type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject,
83-
type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam,
84-
type VectorStore as VectorStore,
85-
type VectorStoreDeleted as VectorStoreDeleted,
86-
VectorStoresPage as VectorStoresPage,
87-
type VectorStoreCreateParams as VectorStoreCreateParams,
88-
type VectorStoreUpdateParams as VectorStoreUpdateParams,
89-
type VectorStoreListParams as VectorStoreListParams,
90-
};
91-
9255
export {
9356
Assistants as Assistants,
9457
type Assistant as Assistant,

src/resources/beta/index.ts

-16
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,3 @@ export {
3434
type ThreadCreateAndRunParamsNonStreaming,
3535
type ThreadCreateAndRunParamsStreaming,
3636
} from './threads/index';
37-
export {
38-
VectorStoresPage,
39-
VectorStores,
40-
type AutoFileChunkingStrategyParam,
41-
type FileChunkingStrategy,
42-
type FileChunkingStrategyParam,
43-
type OtherFileChunkingStrategyObject,
44-
type StaticFileChunkingStrategy,
45-
type StaticFileChunkingStrategyObject,
46-
type StaticFileChunkingStrategyObjectParam,
47-
type VectorStore,
48-
type VectorStoreDeleted,
49-
type VectorStoreCreateParams,
50-
type VectorStoreUpdateParams,
51-
type VectorStoreListParams,
52-
} from './vector-stores/index';

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,14 @@ export interface RunCreateParamsBase {
605605
parallel_tool_calls?: boolean;
606606

607607
/**
608-
* Body param: **o1 and o3-mini models only**
608+
* Body param: **o-series models only**
609609
*
610610
* Constrains effort on reasoning for
611611
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
612612
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
613613
* result in faster responses and fewer tokens used on reasoning in a response.
614614
*/
615-
reasoning_effort?: 'low' | 'medium' | 'high' | null;
615+
reasoning_effort?: Shared.ReasoningEffort | null;
616616

617617
/**
618618
* Body param: Specifies the format that the model must output. Compatible with

0 commit comments

Comments
 (0)