openai 4.86.2 → 4.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +50 -101
- package/core.js +2 -1
- package/core.js.map +1 -1
- package/core.mjs +2 -1
- package/core.mjs.map +1 -1
- package/helpers/zod.d.ts +14 -1
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js +25 -1
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs +23 -1
- package/helpers/zod.mjs.map +1 -1
- package/index.d.mts +14 -3
- package/index.d.ts +14 -3
- package/index.d.ts.map +1 -1
- package/index.js +8 -0
- package/index.js.map +1 -1
- package/index.mjs +8 -0
- package/index.mjs.map +1 -1
- package/lib/ResponsesParser.d.ts +33 -0
- package/lib/ResponsesParser.d.ts.map +1 -0
- package/lib/ResponsesParser.js +171 -0
- package/lib/ResponsesParser.js.map +1 -0
- package/lib/ResponsesParser.mjs +160 -0
- package/lib/ResponsesParser.mjs.map +1 -0
- package/lib/parser.d.ts +7 -0
- package/lib/parser.d.ts.map +1 -1
- package/lib/parser.js +16 -1
- package/lib/parser.js.map +1 -1
- package/lib/parser.mjs +14 -0
- package/lib/parser.mjs.map +1 -1
- package/lib/responses/EventTypes.d.ts +9 -0
- package/lib/responses/EventTypes.d.ts.map +1 -0
- package/lib/responses/EventTypes.js +3 -0
- package/lib/responses/EventTypes.js.map +1 -0
- package/lib/responses/EventTypes.mjs +2 -0
- package/lib/responses/EventTypes.mjs.map +1 -0
- package/lib/responses/ResponseStream.d.ts +34 -0
- package/lib/responses/ResponseStream.d.ts.map +1 -0
- package/lib/responses/ResponseStream.js +238 -0
- package/lib/responses/ResponseStream.js.map +1 -0
- package/lib/responses/ResponseStream.mjs +234 -0
- package/lib/responses/ResponseStream.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/beta/assistants.d.ts +41 -9
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/beta/beta.d.ts +0 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +0 -5
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +0 -5
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +0 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +1 -4
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +0 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +3 -4
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +73 -7
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/chat/chat.d.ts +3 -2
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions/completions.d.ts +200 -64
- package/resources/chat/completions/completions.d.ts.map +1 -1
- package/resources/chat/completions/completions.js +3 -3
- package/resources/chat/completions/completions.js.map +1 -1
- package/resources/chat/completions/completions.mjs +3 -3
- package/resources/chat/completions/completions.mjs.map +1 -1
- package/resources/chat/completions/index.d.ts +1 -1
- package/resources/chat/completions/index.d.ts.map +1 -1
- package/resources/chat/completions/index.js.map +1 -1
- package/resources/chat/completions/index.mjs.map +1 -1
- package/resources/chat/completions/messages.d.ts +1 -1
- package/resources/chat/index.d.ts +2 -2
- package/resources/chat/index.d.ts.map +1 -1
- package/resources/chat/index.js.map +1 -1
- package/resources/chat/index.mjs.map +1 -1
- package/resources/files.d.ts +9 -17
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js.map +1 -1
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/responses/index.d.ts +3 -0
- package/resources/responses/index.d.ts.map +1 -0
- package/resources/responses/index.js +10 -0
- package/resources/responses/index.js.map +1 -0
- package/resources/responses/index.mjs +4 -0
- package/resources/responses/index.mjs.map +1 -0
- package/resources/responses/input-items.d.ts +169 -0
- package/resources/responses/input-items.d.ts.map +1 -0
- package/resources/responses/input-items.js +24 -0
- package/resources/responses/input-items.js.map +1 -0
- package/resources/responses/input-items.mjs +19 -0
- package/resources/responses/input-items.mjs.map +1 -0
- package/resources/responses/responses.d.ts +2230 -0
- package/resources/responses/responses.d.ts.map +1 -0
- package/resources/responses/responses.js +77 -0
- package/resources/responses/responses.js.map +1 -0
- package/resources/responses/responses.mjs +50 -0
- package/resources/responses/responses.mjs.map +1 -0
- package/resources/shared.d.ts +99 -4
- package/resources/shared.d.ts.map +1 -1
- package/resources/uploads/uploads.d.ts +3 -4
- package/resources/uploads/uploads.d.ts.map +1 -1
- package/resources/uploads/uploads.js +3 -4
- package/resources/uploads/uploads.js.map +1 -1
- package/resources/uploads/uploads.mjs +3 -4
- package/resources/uploads/uploads.mjs.map +1 -1
- package/resources/{beta/vector-stores → vector-stores}/file-batches.d.ts +12 -4
- package/resources/vector-stores/file-batches.d.ts.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/file-batches.js +4 -4
- package/resources/vector-stores/file-batches.js.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/file-batches.mjs +4 -4
- package/resources/vector-stores/file-batches.mjs.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/files.d.ts +54 -5
- package/resources/vector-stores/files.d.ts.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/files.js +27 -4
- package/resources/vector-stores/files.js.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/files.mjs +25 -3
- package/resources/vector-stores/files.mjs.map +1 -0
- package/resources/vector-stores/index.d.ts +4 -0
- package/resources/vector-stores/index.d.ts.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/index.js +3 -1
- package/resources/vector-stores/index.js.map +1 -0
- package/resources/vector-stores/index.mjs +5 -0
- package/resources/vector-stores/index.mjs.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/vector-stores.d.ts +90 -7
- package/resources/vector-stores/vector-stores.d.ts.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/vector-stores.js +24 -4
- package/resources/vector-stores/vector-stores.js.map +1 -0
- package/resources/{beta/vector-stores → vector-stores}/vector-stores.mjs +23 -4
- package/resources/vector-stores/vector-stores.mjs.map +1 -0
- package/src/core.ts +2 -2
- package/src/helpers/zod.ts +46 -0
- package/src/index.ts +54 -4
- package/src/lib/ResponsesParser.ts +262 -0
- package/src/lib/parser.ts +28 -0
- package/src/lib/responses/EventTypes.ts +76 -0
- package/src/lib/responses/ResponseStream.ts +298 -0
- package/src/resources/beta/assistants.ts +46 -9
- package/src/resources/beta/beta.ts +0 -37
- package/src/resources/beta/index.ts +0 -16
- package/src/resources/beta/threads/runs/runs.ts +3 -4
- package/src/resources/beta/threads/threads.ts +83 -7
- package/src/resources/chat/chat.ts +3 -43
- package/src/resources/chat/completions/completions.ts +224 -66
- package/src/resources/chat/completions/index.ts +0 -1
- package/src/resources/chat/completions/messages.ts +1 -1
- package/src/resources/chat/index.ts +1 -2
- package/src/resources/files.ts +9 -17
- package/src/resources/index.ts +20 -0
- package/src/resources/responses/index.ts +9 -0
- package/src/resources/responses/input-items.ts +276 -0
- package/src/resources/responses/responses.ts +2761 -0
- package/src/resources/shared.ts +152 -4
- package/src/resources/uploads/uploads.ts +3 -4
- package/src/resources/{beta/vector-stores → vector-stores}/file-batches.ts +16 -7
- package/src/resources/{beta/vector-stores → vector-stores}/files.ts +85 -4
- package/src/resources/{beta/vector-stores → vector-stores}/index.ts +6 -0
- package/src/resources/{beta/vector-stores → vector-stores}/vector-stores.ts +125 -5
- package/src/streaming.ts +1 -1
- package/src/version.ts +1 -1
- package/streaming.js +1 -1
- package/streaming.js.map +1 -1
- package/streaming.mjs +1 -1
- package/streaming.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/beta/vector-stores/file-batches.d.ts.map +0 -1
- package/resources/beta/vector-stores/file-batches.js.map +0 -1
- package/resources/beta/vector-stores/file-batches.mjs.map +0 -1
- package/resources/beta/vector-stores/files.d.ts.map +0 -1
- package/resources/beta/vector-stores/files.js.map +0 -1
- package/resources/beta/vector-stores/files.mjs.map +0 -1
- package/resources/beta/vector-stores/index.d.ts +0 -4
- package/resources/beta/vector-stores/index.d.ts.map +0 -1
- package/resources/beta/vector-stores/index.js.map +0 -1
- package/resources/beta/vector-stores/index.mjs +0 -5
- package/resources/beta/vector-stores/index.mjs.map +0 -1
- package/resources/beta/vector-stores/vector-stores.d.ts.map +0 -1
- package/resources/beta/vector-stores/vector-stores.js.map +0 -1
- package/resources/beta/vector-stores/vector-stores.mjs.map +0 -1
package/src/resources/shared.ts
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
export type ChatModel =
|
|
4
|
+
| 'o3-mini'
|
|
5
|
+
| 'o3-mini-2025-01-31'
|
|
6
|
+
| 'o1'
|
|
7
|
+
| 'o1-2024-12-17'
|
|
8
|
+
| 'o1-preview'
|
|
9
|
+
| 'o1-preview-2024-09-12'
|
|
10
|
+
| 'o1-mini'
|
|
11
|
+
| 'o1-mini-2024-09-12'
|
|
12
|
+
| 'computer-use-preview'
|
|
13
|
+
| 'computer-use-preview-2025-02-04'
|
|
14
|
+
| 'computer-use-preview-2025-03-11'
|
|
15
|
+
| 'gpt-4.5-preview'
|
|
16
|
+
| 'gpt-4.5-preview-2025-02-27'
|
|
17
|
+
| 'gpt-4o'
|
|
18
|
+
| 'gpt-4o-2024-11-20'
|
|
19
|
+
| 'gpt-4o-2024-08-06'
|
|
20
|
+
| 'gpt-4o-2024-05-13'
|
|
21
|
+
| 'gpt-4o-audio-preview'
|
|
22
|
+
| 'gpt-4o-audio-preview-2024-10-01'
|
|
23
|
+
| 'gpt-4o-audio-preview-2024-12-17'
|
|
24
|
+
| 'gpt-4o-mini-audio-preview'
|
|
25
|
+
| 'gpt-4o-mini-audio-preview-2024-12-17'
|
|
26
|
+
| 'chatgpt-4o-latest'
|
|
27
|
+
| 'gpt-4o-mini'
|
|
28
|
+
| 'gpt-4o-mini-2024-07-18'
|
|
29
|
+
| 'gpt-4-turbo'
|
|
30
|
+
| 'gpt-4-turbo-2024-04-09'
|
|
31
|
+
| 'gpt-4-0125-preview'
|
|
32
|
+
| 'gpt-4-turbo-preview'
|
|
33
|
+
| 'gpt-4-1106-preview'
|
|
34
|
+
| 'gpt-4-vision-preview'
|
|
35
|
+
| 'gpt-4'
|
|
36
|
+
| 'gpt-4-0314'
|
|
37
|
+
| 'gpt-4-0613'
|
|
38
|
+
| 'gpt-4-32k'
|
|
39
|
+
| 'gpt-4-32k-0314'
|
|
40
|
+
| 'gpt-4-32k-0613'
|
|
41
|
+
| 'gpt-3.5-turbo'
|
|
42
|
+
| 'gpt-3.5-turbo-16k'
|
|
43
|
+
| 'gpt-3.5-turbo-0301'
|
|
44
|
+
| 'gpt-3.5-turbo-0613'
|
|
45
|
+
| 'gpt-3.5-turbo-1106'
|
|
46
|
+
| 'gpt-3.5-turbo-0125'
|
|
47
|
+
| 'gpt-3.5-turbo-16k-0613';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A filter used to compare a specified attribute key to a given value using a
|
|
51
|
+
* defined comparison operation.
|
|
52
|
+
*/
|
|
53
|
+
export interface ComparisonFilter {
|
|
54
|
+
/**
|
|
55
|
+
* The key to compare against the value.
|
|
56
|
+
*/
|
|
57
|
+
key: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.
|
|
61
|
+
*
|
|
62
|
+
* - `eq`: equals
|
|
63
|
+
* - `ne`: not equal
|
|
64
|
+
* - `gt`: greater than
|
|
65
|
+
* - `gte`: greater than or equal
|
|
66
|
+
* - `lt`: less than
|
|
67
|
+
* - `lte`: less than or equal
|
|
68
|
+
*/
|
|
69
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The value to compare against the attribute key; supports string, number, or
|
|
73
|
+
* boolean types.
|
|
74
|
+
*/
|
|
75
|
+
value: string | number | boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Combine multiple filters using `and` or `or`.
|
|
80
|
+
*/
|
|
81
|
+
export interface CompoundFilter {
|
|
82
|
+
/**
|
|
83
|
+
* Array of filters to combine. Items can be `ComparisonFilter` or
|
|
84
|
+
* `CompoundFilter`.
|
|
85
|
+
*/
|
|
86
|
+
filters: Array<ComparisonFilter | unknown>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Type of operation: `and` or `or`.
|
|
90
|
+
*/
|
|
91
|
+
type: 'and' | 'or';
|
|
92
|
+
}
|
|
93
|
+
|
|
3
94
|
export interface ErrorObject {
|
|
4
95
|
code: string | null;
|
|
5
96
|
|
|
@@ -65,23 +156,76 @@ export type FunctionParameters = Record<string, unknown>;
|
|
|
65
156
|
*/
|
|
66
157
|
export type Metadata = Record<string, string>;
|
|
67
158
|
|
|
159
|
+
/**
|
|
160
|
+
* **o-series models only**
|
|
161
|
+
*
|
|
162
|
+
* Configuration options for
|
|
163
|
+
* [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
164
|
+
*/
|
|
165
|
+
export interface Reasoning {
|
|
166
|
+
/**
|
|
167
|
+
* **o-series models only**
|
|
168
|
+
*
|
|
169
|
+
* Constrains effort on reasoning for
|
|
170
|
+
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
171
|
+
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
|
|
172
|
+
* result in faster responses and fewer tokens used on reasoning in a response.
|
|
173
|
+
*/
|
|
174
|
+
effort: ReasoningEffort | null;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* **o-series models only**
|
|
178
|
+
*
|
|
179
|
+
* A summary of the reasoning performed by the model. This can be useful for
|
|
180
|
+
* debugging and understanding the model's reasoning process. One of `concise` or
|
|
181
|
+
* `detailed`.
|
|
182
|
+
*/
|
|
183
|
+
generate_summary?: 'concise' | 'detailed' | null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* **o-series models only**
|
|
188
|
+
*
|
|
189
|
+
* Constrains effort on reasoning for
|
|
190
|
+
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
191
|
+
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
|
|
192
|
+
* result in faster responses and fewer tokens used on reasoning in a response.
|
|
193
|
+
*/
|
|
194
|
+
export type ReasoningEffort = 'low' | 'medium' | 'high' | null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* JSON object response format. An older method of generating JSON responses. Using
|
|
198
|
+
* `json_schema` is recommended for models that support it. Note that the model
|
|
199
|
+
* will not generate JSON without a system or user message instructing it to do so.
|
|
200
|
+
*/
|
|
68
201
|
export interface ResponseFormatJSONObject {
|
|
69
202
|
/**
|
|
70
|
-
* The type of response format being defined
|
|
203
|
+
* The type of response format being defined. Always `json_object`.
|
|
71
204
|
*/
|
|
72
205
|
type: 'json_object';
|
|
73
206
|
}
|
|
74
207
|
|
|
208
|
+
/**
|
|
209
|
+
* JSON Schema response format. Used to generate structured JSON responses. Learn
|
|
210
|
+
* more about
|
|
211
|
+
* [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
|
|
212
|
+
*/
|
|
75
213
|
export interface ResponseFormatJSONSchema {
|
|
214
|
+
/**
|
|
215
|
+
* Structured Outputs configuration options, including a JSON Schema.
|
|
216
|
+
*/
|
|
76
217
|
json_schema: ResponseFormatJSONSchema.JSONSchema;
|
|
77
218
|
|
|
78
219
|
/**
|
|
79
|
-
* The type of response format being defined
|
|
220
|
+
* The type of response format being defined. Always `json_schema`.
|
|
80
221
|
*/
|
|
81
222
|
type: 'json_schema';
|
|
82
223
|
}
|
|
83
224
|
|
|
84
225
|
export namespace ResponseFormatJSONSchema {
|
|
226
|
+
/**
|
|
227
|
+
* Structured Outputs configuration options, including a JSON Schema.
|
|
228
|
+
*/
|
|
85
229
|
export interface JSONSchema {
|
|
86
230
|
/**
|
|
87
231
|
* The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
|
|
@@ -96,7 +240,8 @@ export namespace ResponseFormatJSONSchema {
|
|
|
96
240
|
description?: string;
|
|
97
241
|
|
|
98
242
|
/**
|
|
99
|
-
* The schema for the response format, described as a JSON Schema object.
|
|
243
|
+
* The schema for the response format, described as a JSON Schema object. Learn how
|
|
244
|
+
* to build JSON schemas [here](https://json-schema.org/).
|
|
100
245
|
*/
|
|
101
246
|
schema?: Record<string, unknown>;
|
|
102
247
|
|
|
@@ -111,9 +256,12 @@ export namespace ResponseFormatJSONSchema {
|
|
|
111
256
|
}
|
|
112
257
|
}
|
|
113
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Default response format. Used to generate text responses.
|
|
261
|
+
*/
|
|
114
262
|
export interface ResponseFormatText {
|
|
115
263
|
/**
|
|
116
|
-
* The type of response format being defined
|
|
264
|
+
* The type of response format being defined. Always `text`.
|
|
117
265
|
*/
|
|
118
266
|
type: 'text';
|
|
119
267
|
}
|
|
@@ -22,10 +22,9 @@ export class Uploads extends APIResource {
|
|
|
22
22
|
* contains all the parts you uploaded. This File is usable in the rest of our
|
|
23
23
|
* platform as a regular File object.
|
|
24
24
|
*
|
|
25
|
-
* For certain `purpose`
|
|
26
|
-
* to documentation for the
|
|
27
|
-
*
|
|
28
|
-
* - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search#supported-files)
|
|
25
|
+
* For certain `purpose` values, the correct `mime_type` must be specified. Please
|
|
26
|
+
* refer to documentation for the
|
|
27
|
+
* [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
|
|
29
28
|
*
|
|
30
29
|
* For guidance on the proper filename extensions for each purpose, please follow
|
|
31
30
|
* the documentation on
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import { isRequestOptions } from '
|
|
5
|
-
import { sleep } from '
|
|
6
|
-
import { Uploadable } from '
|
|
7
|
-
import { allSettledWithThrow } from '
|
|
8
|
-
import * as Core from '
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import { isRequestOptions } from '../../core';
|
|
5
|
+
import { sleep } from '../../core';
|
|
6
|
+
import { Uploadable } from '../../core';
|
|
7
|
+
import { allSettledWithThrow } from '../../lib/Util';
|
|
8
|
+
import * as Core from '../../core';
|
|
9
9
|
import * as FilesAPI from './files';
|
|
10
10
|
import { VectorStoreFilesPage } from './files';
|
|
11
11
|
import * as VectorStoresAPI from './vector-stores';
|
|
12
|
-
import { type CursorPageParams } from '
|
|
12
|
+
import { type CursorPageParams } from '../../pagination';
|
|
13
13
|
|
|
14
14
|
export class FileBatches extends APIResource {
|
|
15
15
|
/**
|
|
@@ -265,6 +265,15 @@ export interface FileBatchCreateParams {
|
|
|
265
265
|
*/
|
|
266
266
|
file_ids: Array<string>;
|
|
267
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
270
|
+
* for storing additional information about the object in a structured format, and
|
|
271
|
+
* querying for objects via API or the dashboard. Keys are strings with a maximum
|
|
272
|
+
* length of 64 characters. Values are strings with a maximum length of 512
|
|
273
|
+
* characters, booleans, or numbers.
|
|
274
|
+
*/
|
|
275
|
+
attributes?: Record<string, string | number | boolean> | null;
|
|
276
|
+
|
|
268
277
|
/**
|
|
269
278
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
270
279
|
* strategy. Only applicable if `file_ids` is non-empty.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import { sleep, Uploadable, isRequestOptions } from '
|
|
5
|
-
import * as Core from '
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import { sleep, Uploadable, isRequestOptions } from '../../core';
|
|
5
|
+
import * as Core from '../../core';
|
|
6
6
|
import * as VectorStoresAPI from './vector-stores';
|
|
7
|
-
import { CursorPage, type CursorPageParams } from '
|
|
7
|
+
import { CursorPage, type CursorPageParams, Page } from '../../pagination';
|
|
8
8
|
|
|
9
9
|
export class Files extends APIResource {
|
|
10
10
|
/**
|
|
@@ -38,6 +38,22 @@ export class Files extends APIResource {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Update attributes on a vector store file.
|
|
43
|
+
*/
|
|
44
|
+
update(
|
|
45
|
+
vectorStoreId: string,
|
|
46
|
+
fileId: string,
|
|
47
|
+
body: FileUpdateParams,
|
|
48
|
+
options?: Core.RequestOptions,
|
|
49
|
+
): Core.APIPromise<VectorStoreFile> {
|
|
50
|
+
return this._client.post(`/vector_stores/${vectorStoreId}/files/${fileId}`, {
|
|
51
|
+
body,
|
|
52
|
+
...options,
|
|
53
|
+
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
/**
|
|
42
58
|
* Returns a list of vector store files.
|
|
43
59
|
*/
|
|
@@ -167,10 +183,30 @@ export class Files extends APIResource {
|
|
|
167
183
|
const fileInfo = await this.upload(vectorStoreId, file, options);
|
|
168
184
|
return await this.poll(vectorStoreId, fileInfo.id, options);
|
|
169
185
|
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Retrieve the parsed contents of a vector store file.
|
|
189
|
+
*/
|
|
190
|
+
content(
|
|
191
|
+
vectorStoreId: string,
|
|
192
|
+
fileId: string,
|
|
193
|
+
options?: Core.RequestOptions,
|
|
194
|
+
): Core.PagePromise<FileContentResponsesPage, FileContentResponse> {
|
|
195
|
+
return this._client.getAPIList(
|
|
196
|
+
`/vector_stores/${vectorStoreId}/files/${fileId}/content`,
|
|
197
|
+
FileContentResponsesPage,
|
|
198
|
+
{ ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } },
|
|
199
|
+
);
|
|
200
|
+
}
|
|
170
201
|
}
|
|
171
202
|
|
|
172
203
|
export class VectorStoreFilesPage extends CursorPage<VectorStoreFile> {}
|
|
173
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
207
|
+
*/
|
|
208
|
+
export class FileContentResponsesPage extends Page<FileContentResponse> {}
|
|
209
|
+
|
|
174
210
|
/**
|
|
175
211
|
* A list of files attached to a vector store.
|
|
176
212
|
*/
|
|
@@ -217,6 +253,15 @@ export interface VectorStoreFile {
|
|
|
217
253
|
*/
|
|
218
254
|
vector_store_id: string;
|
|
219
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
258
|
+
* for storing additional information about the object in a structured format, and
|
|
259
|
+
* querying for objects via API or the dashboard. Keys are strings with a maximum
|
|
260
|
+
* length of 64 characters. Values are strings with a maximum length of 512
|
|
261
|
+
* characters, booleans, or numbers.
|
|
262
|
+
*/
|
|
263
|
+
attributes?: Record<string, string | number | boolean> | null;
|
|
264
|
+
|
|
220
265
|
/**
|
|
221
266
|
* The strategy used to chunk the file.
|
|
222
267
|
*/
|
|
@@ -249,6 +294,18 @@ export interface VectorStoreFileDeleted {
|
|
|
249
294
|
object: 'vector_store.file.deleted';
|
|
250
295
|
}
|
|
251
296
|
|
|
297
|
+
export interface FileContentResponse {
|
|
298
|
+
/**
|
|
299
|
+
* The text content
|
|
300
|
+
*/
|
|
301
|
+
text?: string;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* The content type (currently only `"text"`)
|
|
305
|
+
*/
|
|
306
|
+
type?: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
252
309
|
export interface FileCreateParams {
|
|
253
310
|
/**
|
|
254
311
|
* A [File](https://platform.openai.com/docs/api-reference/files) ID that the
|
|
@@ -257,6 +314,15 @@ export interface FileCreateParams {
|
|
|
257
314
|
*/
|
|
258
315
|
file_id: string;
|
|
259
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
319
|
+
* for storing additional information about the object in a structured format, and
|
|
320
|
+
* querying for objects via API or the dashboard. Keys are strings with a maximum
|
|
321
|
+
* length of 64 characters. Values are strings with a maximum length of 512
|
|
322
|
+
* characters, booleans, or numbers.
|
|
323
|
+
*/
|
|
324
|
+
attributes?: Record<string, string | number | boolean> | null;
|
|
325
|
+
|
|
260
326
|
/**
|
|
261
327
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
262
328
|
* strategy. Only applicable if `file_ids` is non-empty.
|
|
@@ -264,6 +330,17 @@ export interface FileCreateParams {
|
|
|
264
330
|
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
|
|
265
331
|
}
|
|
266
332
|
|
|
333
|
+
export interface FileUpdateParams {
|
|
334
|
+
/**
|
|
335
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
336
|
+
* for storing additional information about the object in a structured format, and
|
|
337
|
+
* querying for objects via API or the dashboard. Keys are strings with a maximum
|
|
338
|
+
* length of 64 characters. Values are strings with a maximum length of 512
|
|
339
|
+
* characters, booleans, or numbers.
|
|
340
|
+
*/
|
|
341
|
+
attributes: Record<string, string | number | boolean> | null;
|
|
342
|
+
}
|
|
343
|
+
|
|
267
344
|
export interface FileListParams extends CursorPageParams {
|
|
268
345
|
/**
|
|
269
346
|
* A cursor for use in pagination. `before` is an object ID that defines your place
|
|
@@ -286,13 +363,17 @@ export interface FileListParams extends CursorPageParams {
|
|
|
286
363
|
}
|
|
287
364
|
|
|
288
365
|
Files.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
366
|
+
Files.FileContentResponsesPage = FileContentResponsesPage;
|
|
289
367
|
|
|
290
368
|
export declare namespace Files {
|
|
291
369
|
export {
|
|
292
370
|
type VectorStoreFile as VectorStoreFile,
|
|
293
371
|
type VectorStoreFileDeleted as VectorStoreFileDeleted,
|
|
372
|
+
type FileContentResponse as FileContentResponse,
|
|
294
373
|
VectorStoreFilesPage as VectorStoreFilesPage,
|
|
374
|
+
FileContentResponsesPage as FileContentResponsesPage,
|
|
295
375
|
type FileCreateParams as FileCreateParams,
|
|
376
|
+
type FileUpdateParams as FileUpdateParams,
|
|
296
377
|
type FileListParams as FileListParams,
|
|
297
378
|
};
|
|
298
379
|
}
|
|
@@ -8,14 +8,18 @@ export {
|
|
|
8
8
|
} from './file-batches';
|
|
9
9
|
export {
|
|
10
10
|
VectorStoreFilesPage,
|
|
11
|
+
FileContentResponsesPage,
|
|
11
12
|
Files,
|
|
12
13
|
type VectorStoreFile,
|
|
13
14
|
type VectorStoreFileDeleted,
|
|
15
|
+
type FileContentResponse,
|
|
14
16
|
type FileCreateParams,
|
|
17
|
+
type FileUpdateParams,
|
|
15
18
|
type FileListParams,
|
|
16
19
|
} from './files';
|
|
17
20
|
export {
|
|
18
21
|
VectorStoresPage,
|
|
22
|
+
VectorStoreSearchResponsesPage,
|
|
19
23
|
VectorStores,
|
|
20
24
|
type AutoFileChunkingStrategyParam,
|
|
21
25
|
type FileChunkingStrategy,
|
|
@@ -26,7 +30,9 @@ export {
|
|
|
26
30
|
type StaticFileChunkingStrategyObjectParam,
|
|
27
31
|
type VectorStore,
|
|
28
32
|
type VectorStoreDeleted,
|
|
33
|
+
type VectorStoreSearchResponse,
|
|
29
34
|
type VectorStoreCreateParams,
|
|
30
35
|
type VectorStoreUpdateParams,
|
|
31
36
|
type VectorStoreListParams,
|
|
37
|
+
type VectorStoreSearchParams,
|
|
32
38
|
} from './vector-stores';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import { isRequestOptions } from '
|
|
5
|
-
import * as Core from '
|
|
6
|
-
import * as Shared from '
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import { isRequestOptions } from '../../core';
|
|
5
|
+
import * as Core from '../../core';
|
|
6
|
+
import * as Shared from '../shared';
|
|
7
7
|
import * as FileBatchesAPI from './file-batches';
|
|
8
8
|
import {
|
|
9
9
|
FileBatchCreateParams,
|
|
@@ -13,14 +13,17 @@ import {
|
|
|
13
13
|
} from './file-batches';
|
|
14
14
|
import * as FilesAPI from './files';
|
|
15
15
|
import {
|
|
16
|
+
FileContentResponse,
|
|
17
|
+
FileContentResponsesPage,
|
|
16
18
|
FileCreateParams,
|
|
17
19
|
FileListParams,
|
|
20
|
+
FileUpdateParams,
|
|
18
21
|
Files,
|
|
19
22
|
VectorStoreFile,
|
|
20
23
|
VectorStoreFileDeleted,
|
|
21
24
|
VectorStoreFilesPage,
|
|
22
25
|
} from './files';
|
|
23
|
-
import { CursorPage, type CursorPageParams } from '
|
|
26
|
+
import { CursorPage, type CursorPageParams, Page } from '../../pagination';
|
|
24
27
|
|
|
25
28
|
export class VectorStores extends APIResource {
|
|
26
29
|
files: FilesAPI.Files = new FilesAPI.Files(this._client);
|
|
@@ -93,10 +96,32 @@ export class VectorStores extends APIResource {
|
|
|
93
96
|
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
|
|
94
97
|
});
|
|
95
98
|
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Search a vector store for relevant chunks based on a query and file attributes
|
|
102
|
+
* filter.
|
|
103
|
+
*/
|
|
104
|
+
search(
|
|
105
|
+
vectorStoreId: string,
|
|
106
|
+
body: VectorStoreSearchParams,
|
|
107
|
+
options?: Core.RequestOptions,
|
|
108
|
+
): Core.PagePromise<VectorStoreSearchResponsesPage, VectorStoreSearchResponse> {
|
|
109
|
+
return this._client.getAPIList(`/vector_stores/${vectorStoreId}/search`, VectorStoreSearchResponsesPage, {
|
|
110
|
+
body,
|
|
111
|
+
method: 'post',
|
|
112
|
+
...options,
|
|
113
|
+
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
export class VectorStoresPage extends CursorPage<VectorStore> {}
|
|
99
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
122
|
+
*/
|
|
123
|
+
export class VectorStoreSearchResponsesPage extends Page<VectorStoreSearchResponse> {}
|
|
124
|
+
|
|
100
125
|
/**
|
|
101
126
|
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
102
127
|
* `800` and `chunk_overlap_tokens` of `400`.
|
|
@@ -155,6 +180,9 @@ export interface StaticFileChunkingStrategyObject {
|
|
|
155
180
|
type: 'static';
|
|
156
181
|
}
|
|
157
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Customize your own chunking strategy by setting chunk size and chunk overlap.
|
|
185
|
+
*/
|
|
158
186
|
export interface StaticFileChunkingStrategyObjectParam {
|
|
159
187
|
static: StaticFileChunkingStrategy;
|
|
160
188
|
|
|
@@ -282,6 +310,51 @@ export interface VectorStoreDeleted {
|
|
|
282
310
|
object: 'vector_store.deleted';
|
|
283
311
|
}
|
|
284
312
|
|
|
313
|
+
export interface VectorStoreSearchResponse {
|
|
314
|
+
/**
|
|
315
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
316
|
+
* for storing additional information about the object in a structured format, and
|
|
317
|
+
* querying for objects via API or the dashboard. Keys are strings with a maximum
|
|
318
|
+
* length of 64 characters. Values are strings with a maximum length of 512
|
|
319
|
+
* characters, booleans, or numbers.
|
|
320
|
+
*/
|
|
321
|
+
attributes: Record<string, string | number | boolean> | null;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Content chunks from the file.
|
|
325
|
+
*/
|
|
326
|
+
content: Array<VectorStoreSearchResponse.Content>;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The ID of the vector store file.
|
|
330
|
+
*/
|
|
331
|
+
file_id: string;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The name of the vector store file.
|
|
335
|
+
*/
|
|
336
|
+
filename: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The similarity score for the result.
|
|
340
|
+
*/
|
|
341
|
+
score: number;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export namespace VectorStoreSearchResponse {
|
|
345
|
+
export interface Content {
|
|
346
|
+
/**
|
|
347
|
+
* The text content returned from search.
|
|
348
|
+
*/
|
|
349
|
+
text: string;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* The type of content.
|
|
353
|
+
*/
|
|
354
|
+
type: 'text';
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
285
358
|
export interface VectorStoreCreateParams {
|
|
286
359
|
/**
|
|
287
360
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
@@ -391,9 +464,50 @@ export interface VectorStoreListParams extends CursorPageParams {
|
|
|
391
464
|
order?: 'asc' | 'desc';
|
|
392
465
|
}
|
|
393
466
|
|
|
467
|
+
export interface VectorStoreSearchParams {
|
|
468
|
+
/**
|
|
469
|
+
* A query string for a search
|
|
470
|
+
*/
|
|
471
|
+
query: string | Array<string>;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* A filter to apply based on file attributes.
|
|
475
|
+
*/
|
|
476
|
+
filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* The maximum number of results to return. This number should be between 1 and 50
|
|
480
|
+
* inclusive.
|
|
481
|
+
*/
|
|
482
|
+
max_num_results?: number;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Ranking options for search.
|
|
486
|
+
*/
|
|
487
|
+
ranking_options?: VectorStoreSearchParams.RankingOptions;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Whether to rewrite the natural language query for vector search.
|
|
491
|
+
*/
|
|
492
|
+
rewrite_query?: boolean;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export namespace VectorStoreSearchParams {
|
|
496
|
+
/**
|
|
497
|
+
* Ranking options for search.
|
|
498
|
+
*/
|
|
499
|
+
export interface RankingOptions {
|
|
500
|
+
ranker?: 'auto' | 'default-2024-11-15';
|
|
501
|
+
|
|
502
|
+
score_threshold?: number;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
394
506
|
VectorStores.VectorStoresPage = VectorStoresPage;
|
|
507
|
+
VectorStores.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
|
|
395
508
|
VectorStores.Files = Files;
|
|
396
509
|
VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
510
|
+
VectorStores.FileContentResponsesPage = FileContentResponsesPage;
|
|
397
511
|
VectorStores.FileBatches = FileBatches;
|
|
398
512
|
|
|
399
513
|
export declare namespace VectorStores {
|
|
@@ -407,18 +521,24 @@ export declare namespace VectorStores {
|
|
|
407
521
|
type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam,
|
|
408
522
|
type VectorStore as VectorStore,
|
|
409
523
|
type VectorStoreDeleted as VectorStoreDeleted,
|
|
524
|
+
type VectorStoreSearchResponse as VectorStoreSearchResponse,
|
|
410
525
|
VectorStoresPage as VectorStoresPage,
|
|
526
|
+
VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage,
|
|
411
527
|
type VectorStoreCreateParams as VectorStoreCreateParams,
|
|
412
528
|
type VectorStoreUpdateParams as VectorStoreUpdateParams,
|
|
413
529
|
type VectorStoreListParams as VectorStoreListParams,
|
|
530
|
+
type VectorStoreSearchParams as VectorStoreSearchParams,
|
|
414
531
|
};
|
|
415
532
|
|
|
416
533
|
export {
|
|
417
534
|
Files as Files,
|
|
418
535
|
type VectorStoreFile as VectorStoreFile,
|
|
419
536
|
type VectorStoreFileDeleted as VectorStoreFileDeleted,
|
|
537
|
+
type FileContentResponse as FileContentResponse,
|
|
420
538
|
VectorStoreFilesPage as VectorStoreFilesPage,
|
|
539
|
+
FileContentResponsesPage as FileContentResponsesPage,
|
|
421
540
|
type FileCreateParams as FileCreateParams,
|
|
541
|
+
type FileUpdateParams as FileUpdateParams,
|
|
422
542
|
type FileListParams as FileListParams,
|
|
423
543
|
};
|
|
424
544
|
|
package/src/streaming.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.87.1'; // x-release-please-version
|