openai 7.6.0 → 7.8.0
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 +30 -0
- package/README.md +15 -30
- package/auth/index.d.mts +1 -1
- package/auth/index.d.mts.map +1 -1
- package/auth/index.d.ts +1 -1
- package/auth/index.d.ts.map +1 -1
- package/auth/index.js.map +1 -1
- package/auth/index.mjs.map +1 -1
- package/auth/types.d.mts +9 -4
- package/auth/types.d.mts.map +1 -1
- package/auth/types.d.ts +9 -4
- package/auth/types.d.ts.map +1 -1
- package/auth/workload-identity-auth.d.mts +1 -1
- package/auth/workload-identity-auth.d.mts.map +1 -1
- package/auth/workload-identity-auth.d.ts +1 -1
- package/auth/workload-identity-auth.d.ts.map +1 -1
- package/auth/workload-identity-auth.js +23 -6
- package/auth/workload-identity-auth.js.map +1 -1
- package/auth/workload-identity-auth.mjs +23 -6
- package/auth/workload-identity-auth.mjs.map +1 -1
- package/auth/x509-transport.d.mts +36 -1
- package/auth/x509-transport.d.mts.map +1 -1
- package/auth/x509-transport.d.ts +36 -1
- package/auth/x509-transport.d.ts.map +1 -1
- package/auth/x509-transport.js +223 -0
- package/auth/x509-transport.js.map +1 -1
- package/auth/x509-transport.mjs +222 -1
- package/auth/x509-transport.mjs.map +1 -1
- package/azure.d.mts +3 -1
- package/azure.d.mts.map +1 -1
- package/azure.d.ts +3 -1
- package/azure.d.ts.map +1 -1
- package/azure.js.map +1 -1
- package/azure.mjs.map +1 -1
- package/bedrock.d.mts +3 -1
- package/bedrock.d.mts.map +1 -1
- package/bedrock.d.ts +3 -1
- package/bedrock.d.ts.map +1 -1
- package/bedrock.js.map +1 -1
- package/bedrock.mjs.map +1 -1
- package/beta/realtime/ws.d.mts.map +1 -1
- package/beta/realtime/ws.d.ts.map +1 -1
- package/beta/realtime/ws.js +2 -0
- package/beta/realtime/ws.js.map +1 -1
- package/beta/realtime/ws.mjs +2 -0
- package/beta/realtime/ws.mjs.map +1 -1
- package/client.d.mts +3 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -1
- package/client.d.ts.map +1 -1
- package/client.js +30 -37
- package/client.js.map +1 -1
- package/client.mjs +31 -38
- package/client.mjs.map +1 -1
- package/core/EventEmitter.d.mts.map +1 -1
- package/core/EventEmitter.d.ts.map +1 -1
- package/core/EventEmitter.js +14 -1
- package/core/EventEmitter.js.map +1 -1
- package/core/EventEmitter.mjs +14 -1
- package/core/EventEmitter.mjs.map +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +158 -7
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +158 -7
- package/core/streaming.mjs.map +1 -1
- package/internal/auth/x509-api-origin.d.mts +5 -0
- package/internal/auth/x509-api-origin.d.mts.map +1 -0
- package/internal/auth/x509-api-origin.d.ts +5 -0
- package/internal/auth/x509-api-origin.d.ts.map +1 -0
- package/internal/auth/x509-api-origin.js +28 -0
- package/internal/auth/x509-api-origin.js.map +1 -0
- package/internal/auth/x509-api-origin.mjs +24 -0
- package/internal/auth/x509-api-origin.mjs.map +1 -0
- package/internal/auth/x509-credential-options.d.mts +13 -0
- package/internal/auth/x509-credential-options.d.mts.map +1 -0
- package/internal/auth/x509-credential-options.d.ts +13 -0
- package/internal/auth/x509-credential-options.d.ts.map +1 -0
- package/internal/auth/x509-credential-options.js +122 -0
- package/internal/auth/x509-credential-options.js.map +1 -0
- package/internal/auth/x509-credential-options.mjs +118 -0
- package/internal/auth/x509-credential-options.mjs.map +1 -0
- package/internal/auth/x509-token-exchange.mjs +1 -1
- package/internal/auth/x509-transport-capability.d.mts +12 -5
- package/internal/auth/x509-transport-capability.d.mts.map +1 -1
- package/internal/auth/x509-transport-capability.d.ts +12 -5
- package/internal/auth/x509-transport-capability.d.ts.map +1 -1
- package/internal/auth/x509-transport-capability.js +5 -4
- package/internal/auth/x509-transport-capability.js.map +1 -1
- package/internal/auth/x509-transport-capability.mjs +6 -5
- package/internal/auth/x509-transport-capability.mjs.map +1 -1
- package/internal/auth/x509-transport-registry.d.mts +8 -0
- package/internal/auth/x509-transport-registry.d.mts.map +1 -1
- package/internal/auth/x509-transport-registry.d.ts +8 -0
- package/internal/auth/x509-transport-registry.d.ts.map +1 -1
- package/internal/auth/x509-transport-registry.js.map +1 -1
- package/internal/auth/x509-transport-registry.mjs +1 -1
- package/internal/auth/x509-transport-registry.mjs.map +1 -1
- package/internal/auth/x509-transport-state-browser.d.mts +4 -0
- package/internal/auth/x509-transport-state-browser.d.mts.map +1 -1
- package/internal/auth/x509-transport-state-browser.d.ts +4 -0
- package/internal/auth/x509-transport-state-browser.d.ts.map +1 -1
- package/internal/auth/x509-transport-state-browser.js +6 -1
- package/internal/auth/x509-transport-state-browser.js.map +1 -1
- package/internal/auth/x509-transport-state-browser.mjs +5 -0
- package/internal/auth/x509-transport-state-browser.mjs.map +1 -1
- package/internal/auth/x509-transport-state.cjs +6 -1
- package/internal/auth/x509-transport-state.cjs.map +1 -1
- package/internal/auth/x509-transport-state.d.cts +4 -0
- package/internal/auth/x509-transport-state.d.cts.map +1 -1
- package/internal/auth/x509-transport-state.js +36 -0
- package/internal/auth/x509-transport-state.mjs +19 -0
- package/internal/auth/x509-workload-identity-auth.d.mts +2 -4
- package/internal/auth/x509-workload-identity-auth.d.mts.map +1 -1
- package/internal/auth/x509-workload-identity-auth.d.ts +2 -4
- package/internal/auth/x509-workload-identity-auth.d.ts.map +1 -1
- package/internal/auth/x509-workload-identity-auth.js +43 -34
- package/internal/auth/x509-workload-identity-auth.js.map +1 -1
- package/internal/auth/x509-workload-identity-auth.mjs +40 -30
- package/internal/auth/x509-workload-identity-auth.mjs.map +1 -1
- package/internal/uploads.js +4 -2
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +4 -2
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/log.d.mts +6 -0
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +6 -0
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +72 -11
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +69 -11
- package/internal/utils/log.mjs.map +1 -1
- package/lib/EventEmitter.d.mts.map +1 -1
- package/lib/EventEmitter.d.ts.map +1 -1
- package/lib/EventEmitter.js +14 -1
- package/lib/EventEmitter.js.map +1 -1
- package/lib/EventEmitter.mjs +14 -1
- package/lib/EventEmitter.mjs.map +1 -1
- package/package.json +5 -5
- package/realtime/ws.d.mts.map +1 -1
- package/realtime/ws.d.ts.map +1 -1
- package/realtime/ws.js +2 -0
- package/realtime/ws.js.map +1 -1
- package/realtime/ws.mjs +2 -0
- package/realtime/ws.mjs.map +1 -1
- package/resources/admin/organization/audit-logs.d.mts +2 -2
- package/resources/admin/organization/audit-logs.d.mts.map +1 -1
- package/resources/admin/organization/audit-logs.d.ts +2 -2
- package/resources/admin/organization/audit-logs.d.ts.map +1 -1
- package/resources/beta/responses/responses.d.mts +12 -8
- package/resources/beta/responses/responses.d.mts.map +1 -1
- package/resources/beta/responses/responses.d.ts +12 -8
- package/resources/beta/responses/responses.d.ts.map +1 -1
- package/resources/beta/responses/responses.js.map +1 -1
- package/resources/beta/responses/responses.mjs.map +1 -1
- package/resources/beta/responses/ws.d.mts.map +1 -1
- package/resources/beta/responses/ws.d.ts.map +1 -1
- package/resources/beta/responses/ws.js +2 -0
- package/resources/beta/responses/ws.js.map +1 -1
- package/resources/beta/responses/ws.mjs +2 -0
- package/resources/beta/responses/ws.mjs.map +1 -1
- package/resources/completions.d.mts +4 -0
- package/resources/completions.d.mts.map +1 -1
- package/resources/completions.d.ts +4 -0
- package/resources/completions.d.ts.map +1 -1
- package/resources/responses/responses.d.mts +12 -8
- package/resources/responses/responses.d.mts.map +1 -1
- package/resources/responses/responses.d.ts +12 -8
- package/resources/responses/responses.d.ts.map +1 -1
- package/resources/responses/responses.js.map +1 -1
- package/resources/responses/responses.mjs.map +1 -1
- package/resources/responses/ws.d.mts.map +1 -1
- package/resources/responses/ws.d.ts.map +1 -1
- package/resources/responses/ws.js +2 -0
- package/resources/responses/ws.js.map +1 -1
- package/resources/responses/ws.mjs +2 -0
- package/resources/responses/ws.mjs.map +1 -1
- package/src/_vendor/partial-json-parser/LICENSE +21 -0
- package/src/_vendor/partial-json-parser/README.md +11 -1
- package/src/auth/index.ts +1 -0
- package/src/auth/types.ts +10 -4
- package/src/auth/workload-identity-auth.ts +30 -6
- package/src/auth/x509-transport.ts +311 -2
- package/src/azure.ts +4 -1
- package/src/bedrock.ts +4 -1
- package/src/beta/realtime/ws.ts +2 -0
- package/src/client.ts +39 -34
- package/src/core/EventEmitter.ts +13 -1
- package/src/core/streaming.ts +155 -10
- package/src/internal/auth/x509-api-origin.ts +27 -0
- package/src/internal/auth/x509-credential-options.ts +146 -0
- package/src/internal/auth/x509-transport-capability.ts +12 -5
- package/src/internal/auth/x509-transport-registry.ts +9 -0
- package/src/internal/auth/x509-transport-state-browser.ts +7 -0
- package/src/internal/auth/x509-transport-state.cts +7 -0
- package/src/internal/auth/x509-workload-identity-auth.ts +42 -33
- package/src/internal/uploads.ts +4 -2
- package/src/internal/utils/log.ts +76 -11
- package/src/lib/EventEmitter.ts +13 -1
- package/src/realtime/ws.ts +2 -0
- package/src/resources/admin/organization/audit-logs.ts +4 -0
- package/src/resources/beta/responses/responses.ts +15 -10
- package/src/resources/beta/responses/ws.ts +3 -0
- package/src/resources/completions.ts +5 -0
- package/src/resources/responses/responses.ts +15 -10
- package/src/resources/responses/ws.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -82,6 +82,62 @@ export function loggerFor(client: OpenAI): Logger {
|
|
|
82
82
|
return levelLogger;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
const sensitiveQueryNames = new Set([
|
|
86
|
+
'apikey',
|
|
87
|
+
'accesstoken',
|
|
88
|
+
'refreshtoken',
|
|
89
|
+
'sessiontoken',
|
|
90
|
+
'sessionid',
|
|
91
|
+
'idtoken',
|
|
92
|
+
'authtoken',
|
|
93
|
+
'authorization',
|
|
94
|
+
'token',
|
|
95
|
+
'password',
|
|
96
|
+
'clientsecret',
|
|
97
|
+
'xamzsecuritytoken',
|
|
98
|
+
'xamzsignature',
|
|
99
|
+
'xamzcredential',
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
/** Recognizes credential-bearing query names across ordinary and provider authentication. */
|
|
103
|
+
export function isSensitiveQueryParameter(name: string): boolean {
|
|
104
|
+
const normalized = name.toLowerCase().replace(/[-_]/gu, '');
|
|
105
|
+
return sensitiveQueryNames.has(normalized) || sensitiveQueryNames.has(normalized.replace(/^x/u, ''));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const sensitiveHeaderNames = new Set([
|
|
109
|
+
'authorization',
|
|
110
|
+
'proxy-authorization',
|
|
111
|
+
'api-key',
|
|
112
|
+
'x-api-key',
|
|
113
|
+
'x-amz-security-token',
|
|
114
|
+
'cookie',
|
|
115
|
+
'set-cookie',
|
|
116
|
+
'x-session-token',
|
|
117
|
+
'x-session-id',
|
|
118
|
+
'x-auth-token',
|
|
119
|
+
'x-id-token',
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
/** Recognizes credential-bearing request headers across provider and workload authentication. */
|
|
123
|
+
export function isSensitiveHeader(name: string): boolean {
|
|
124
|
+
return sensitiveHeaderNames.has(name.toLowerCase().replace(/_/gu, '-')) || isSensitiveQueryParameter(name);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Removes credential-valued query parameters before a request URL reaches any logger. */
|
|
128
|
+
export function redactURL(value: string): string {
|
|
129
|
+
const url = new URL(value);
|
|
130
|
+
url.username = '';
|
|
131
|
+
url.password = '';
|
|
132
|
+
url.hash = '';
|
|
133
|
+
for (const name of url.searchParams.keys()) {
|
|
134
|
+
if (isSensitiveQueryParameter(name)) {
|
|
135
|
+
url.searchParams.set(name, '***');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return url.href;
|
|
139
|
+
}
|
|
140
|
+
|
|
85
141
|
export const formatRequestDetails = (details: {
|
|
86
142
|
options?: RequestOptions | undefined;
|
|
87
143
|
headers?: Headers | Record<string, string> | undefined;
|
|
@@ -97,21 +153,30 @@ export const formatRequestDetails = (details: {
|
|
|
97
153
|
if (details.options) {
|
|
98
154
|
details.options = { ...details.options };
|
|
99
155
|
delete details.options['headers']; // redundant + leaks internals
|
|
156
|
+
if (details.options.path) {
|
|
157
|
+
const path = details.options.path;
|
|
158
|
+
const redacted = new URL(redactURL(new URL(path, 'https://redacted.invalid').href));
|
|
159
|
+
details.options.path =
|
|
160
|
+
redacted.origin === 'https://redacted.invalid'
|
|
161
|
+
? `${path.startsWith('/') ? '/' : ''}${redacted.pathname.slice(1)}${redacted.search}`
|
|
162
|
+
: redacted.href;
|
|
163
|
+
}
|
|
164
|
+
if (details.options.query) {
|
|
165
|
+
details.options.query = Object.fromEntries(
|
|
166
|
+
Object.entries(details.options.query).map(([name, value]) => [
|
|
167
|
+
name,
|
|
168
|
+
isSensitiveQueryParameter(name) ? '***' : value,
|
|
169
|
+
]),
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (details.url) {
|
|
174
|
+
details.url = redactURL(details.url);
|
|
100
175
|
}
|
|
101
176
|
if (details.headers) {
|
|
102
177
|
details.headers = Object.fromEntries(
|
|
103
178
|
(details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(
|
|
104
|
-
([name, value]) => [
|
|
105
|
-
name,
|
|
106
|
-
name.toLowerCase() === 'authorization' ||
|
|
107
|
-
name.toLowerCase() === 'api-key' ||
|
|
108
|
-
name.toLowerCase() === 'x-api-key' ||
|
|
109
|
-
name.toLowerCase() === 'x-amz-security-token' ||
|
|
110
|
-
name.toLowerCase() === 'cookie' ||
|
|
111
|
-
name.toLowerCase() === 'set-cookie'
|
|
112
|
-
? '***'
|
|
113
|
-
: value,
|
|
114
|
-
],
|
|
179
|
+
([name, value]) => [name, isSensitiveHeader(name) ? '***' : value],
|
|
115
180
|
),
|
|
116
181
|
);
|
|
117
182
|
}
|
package/src/lib/EventEmitter.ts
CHANGED
|
@@ -184,11 +184,20 @@ export class EventEmitter<EventTypes extends Record<string, (...args: any) => an
|
|
|
184
184
|
}
|
|
185
185
|
return !listener.once && !listener.removed;
|
|
186
186
|
}) as any;
|
|
187
|
+
let listenerThrew = false;
|
|
188
|
+
let firstListenerError: unknown;
|
|
187
189
|
this.#listenerDispatchDepth += 1;
|
|
188
190
|
try {
|
|
189
191
|
for (const registration of listeners as any) {
|
|
190
192
|
if (!registration.removed) {
|
|
191
|
-
|
|
193
|
+
try {
|
|
194
|
+
registration.listener(...(args as any));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (!listenerThrew) {
|
|
197
|
+
listenerThrew = true;
|
|
198
|
+
firstListenerError = error;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
192
201
|
}
|
|
193
202
|
}
|
|
194
203
|
} finally {
|
|
@@ -197,6 +206,9 @@ export class EventEmitter<EventTypes extends Record<string, (...args: any) => an
|
|
|
197
206
|
this.#cleanupEmittedListeners();
|
|
198
207
|
}
|
|
199
208
|
}
|
|
209
|
+
if (listenerThrew) {
|
|
210
|
+
throw firstListenerError;
|
|
211
|
+
}
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
|
package/src/realtime/ws.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { assertBedrockWebSocketOrigin } from '../internal/bedrock';
|
|
|
3
3
|
import { protectWebSocketOptionsFromCredentialRedirects } from '../internal/ws';
|
|
4
4
|
import type { AzureOpenAI } from '../index';
|
|
5
5
|
import { OpenAI } from '../index';
|
|
6
|
+
import { VERSION } from '../version';
|
|
6
7
|
import type { RealtimeClientEvent } from '../resources/realtime/realtime';
|
|
7
8
|
import {
|
|
8
9
|
OpenAIRealtimeEmitter,
|
|
@@ -62,6 +63,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
62
63
|
this.url = buildRealtimeURL(client, props);
|
|
63
64
|
assertBedrockWebSocketOrigin(client, this.url);
|
|
64
65
|
const headers = {
|
|
66
|
+
'User-Agent': `${client.constructor.name}/JS ${VERSION}`,
|
|
65
67
|
...props.options?.headers,
|
|
66
68
|
...(isAzure(client) && !props.__resolvedApiKey ? {} : { Authorization: `Bearer ${client.apiKey}` }),
|
|
67
69
|
};
|
|
@@ -130,6 +130,8 @@ export interface AuditLogListResponse {
|
|
|
130
130
|
| 'tenant.admin_api_key.updated'
|
|
131
131
|
| 'tenant.admin_api_key.deleted'
|
|
132
132
|
| 'tenant.project_api_key.created'
|
|
133
|
+
| 'tenant.trusted_access.business_verification.started'
|
|
134
|
+
| 'tenant.trusted_access.application.submitted'
|
|
133
135
|
| 'tenant.chatgpt_access_token.revoked'
|
|
134
136
|
| 'tenant.migration.completed'
|
|
135
137
|
| 'tenant.sso.migrated'
|
|
@@ -1936,6 +1938,8 @@ export interface AuditLogListParams extends ConversationCursorPageParams {
|
|
|
1936
1938
|
| 'tenant.admin_api_key.updated'
|
|
1937
1939
|
| 'tenant.admin_api_key.deleted'
|
|
1938
1940
|
| 'tenant.project_api_key.created'
|
|
1941
|
+
| 'tenant.trusted_access.business_verification.started'
|
|
1942
|
+
| 'tenant.trusted_access.application.submitted'
|
|
1939
1943
|
| 'tenant.chatgpt_access_token.revoked'
|
|
1940
1944
|
| 'tenant.migration.completed'
|
|
1941
1945
|
| 'tenant.sso.migrated'
|
|
@@ -4064,11 +4064,6 @@ export interface BetaResponseFunctionToolCallOutputItem {
|
|
|
4064
4064
|
*/
|
|
4065
4065
|
id: string;
|
|
4066
4066
|
|
|
4067
|
-
/**
|
|
4068
|
-
* The unique ID of the function tool call generated by the model.
|
|
4069
|
-
*/
|
|
4070
|
-
call_id: string;
|
|
4071
|
-
|
|
4072
4067
|
/**
|
|
4073
4068
|
* The output from the function call generated by your code. Can be a string or an
|
|
4074
4069
|
* list of output content.
|
|
@@ -4091,6 +4086,11 @@ export interface BetaResponseFunctionToolCallOutputItem {
|
|
|
4091
4086
|
*/
|
|
4092
4087
|
agent?: BetaResponseFunctionToolCallOutputItem.Agent | null;
|
|
4093
4088
|
|
|
4089
|
+
/**
|
|
4090
|
+
* The unique ID of the function tool call generated by the model.
|
|
4091
|
+
*/
|
|
4092
|
+
call_id?: string;
|
|
4093
|
+
|
|
4094
4094
|
/**
|
|
4095
4095
|
* The execution context that produced this tool call.
|
|
4096
4096
|
*/
|
|
@@ -5106,11 +5106,6 @@ export namespace BetaResponseInputItem {
|
|
|
5106
5106
|
* The output of a function tool call.
|
|
5107
5107
|
*/
|
|
5108
5108
|
export interface FunctionCallOutput {
|
|
5109
|
-
/**
|
|
5110
|
-
* The unique ID of the function tool call generated by the model.
|
|
5111
|
-
*/
|
|
5112
|
-
call_id: string;
|
|
5113
|
-
|
|
5114
5109
|
/**
|
|
5115
5110
|
* Text, image, or file output of the function tool call.
|
|
5116
5111
|
*/
|
|
@@ -5132,6 +5127,11 @@ export namespace BetaResponseInputItem {
|
|
|
5132
5127
|
*/
|
|
5133
5128
|
agent?: FunctionCallOutput.Agent | null;
|
|
5134
5129
|
|
|
5130
|
+
/**
|
|
5131
|
+
* The unique ID of the function tool call generated by the model.
|
|
5132
|
+
*/
|
|
5133
|
+
call_id?: string | null;
|
|
5134
|
+
|
|
5135
5135
|
/**
|
|
5136
5136
|
* The execution context that produced this tool call.
|
|
5137
5137
|
*/
|
|
@@ -10525,6 +10525,11 @@ export interface BetaResponseUsage {
|
|
|
10525
10525
|
* The total number of tokens used.
|
|
10526
10526
|
*/
|
|
10527
10527
|
total_tokens: number;
|
|
10528
|
+
|
|
10529
|
+
/**
|
|
10530
|
+
* Compute units for the request. Currently null when available.
|
|
10531
|
+
*/
|
|
10532
|
+
compute_units?: number | null;
|
|
10528
10533
|
}
|
|
10529
10534
|
|
|
10530
10535
|
export namespace BetaResponseUsage {
|
|
@@ -4,6 +4,7 @@ import * as WS from 'ws';
|
|
|
4
4
|
import { NodeWebSocket } from '../../../internal/ws-adapter-node';
|
|
5
5
|
import { ResponsesWSBase, type ResponsesWSBaseOptions } from './ws-base';
|
|
6
6
|
import { OpenAI } from '../../../client';
|
|
7
|
+
import { VERSION } from '../../../version';
|
|
7
8
|
|
|
8
9
|
export type { ResponsesWSReconnectOptions } from './ws-base';
|
|
9
10
|
|
|
@@ -29,6 +30,8 @@ export class ResponsesWS extends ResponsesWSBase<NodeWebSocket> {
|
|
|
29
30
|
const ws = new WS.WebSocket(url, {
|
|
30
31
|
...this._wsOptions,
|
|
31
32
|
headers: {
|
|
33
|
+
'User-Agent': `${this._client.constructor.name}/JS ${VERSION}`,
|
|
34
|
+
|
|
32
35
|
...authHeaders,
|
|
33
36
|
...this._wsOptions?.headers,
|
|
34
37
|
},
|
|
@@ -140,6 +140,11 @@ export interface CompletionUsage {
|
|
|
140
140
|
*/
|
|
141
141
|
completion_tokens_details?: CompletionUsage.CompletionTokensDetails;
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Compute units for the request. Currently null when available.
|
|
145
|
+
*/
|
|
146
|
+
compute_units?: number | null;
|
|
147
|
+
|
|
143
148
|
/**
|
|
144
149
|
* Breakdown of tokens used in the prompt.
|
|
145
150
|
*/
|
|
@@ -3475,11 +3475,6 @@ export interface ResponseFunctionToolCallOutputItem {
|
|
|
3475
3475
|
*/
|
|
3476
3476
|
id: string;
|
|
3477
3477
|
|
|
3478
|
-
/**
|
|
3479
|
-
* The unique ID of the function tool call generated by the model.
|
|
3480
|
-
*/
|
|
3481
|
-
call_id: string;
|
|
3482
|
-
|
|
3483
3478
|
/**
|
|
3484
3479
|
* The output from the function call generated by your code. Can be a string or an
|
|
3485
3480
|
* list of output content.
|
|
@@ -3497,6 +3492,11 @@ export interface ResponseFunctionToolCallOutputItem {
|
|
|
3497
3492
|
*/
|
|
3498
3493
|
type: 'function_call_output';
|
|
3499
3494
|
|
|
3495
|
+
/**
|
|
3496
|
+
* The unique ID of the function tool call generated by the model.
|
|
3497
|
+
*/
|
|
3498
|
+
call_id?: string;
|
|
3499
|
+
|
|
3500
3500
|
/**
|
|
3501
3501
|
* The execution context that produced this tool call.
|
|
3502
3502
|
*/
|
|
@@ -4246,11 +4246,6 @@ export namespace ResponseInputItem {
|
|
|
4246
4246
|
* The output of a function tool call.
|
|
4247
4247
|
*/
|
|
4248
4248
|
export interface FunctionCallOutput {
|
|
4249
|
-
/**
|
|
4250
|
-
* The unique ID of the function tool call generated by the model.
|
|
4251
|
-
*/
|
|
4252
|
-
call_id: string;
|
|
4253
|
-
|
|
4254
4249
|
/**
|
|
4255
4250
|
* Text, image, or file output of the function tool call.
|
|
4256
4251
|
*/
|
|
@@ -4267,6 +4262,11 @@ export namespace ResponseInputItem {
|
|
|
4267
4262
|
*/
|
|
4268
4263
|
id?: string | null;
|
|
4269
4264
|
|
|
4265
|
+
/**
|
|
4266
|
+
* The unique ID of the function tool call generated by the model.
|
|
4267
|
+
*/
|
|
4268
|
+
call_id?: string | null;
|
|
4269
|
+
|
|
4270
4270
|
/**
|
|
4271
4271
|
* The execution context that produced this tool call.
|
|
4272
4272
|
*/
|
|
@@ -7699,6 +7699,11 @@ export interface ResponseUsage {
|
|
|
7699
7699
|
* The total number of tokens used.
|
|
7700
7700
|
*/
|
|
7701
7701
|
total_tokens: number;
|
|
7702
|
+
|
|
7703
|
+
/**
|
|
7704
|
+
* Compute units for the request. Currently null when available.
|
|
7705
|
+
*/
|
|
7706
|
+
compute_units?: number | null;
|
|
7702
7707
|
}
|
|
7703
7708
|
|
|
7704
7709
|
export namespace ResponseUsage {
|
|
@@ -4,6 +4,7 @@ import * as WS from 'ws';
|
|
|
4
4
|
import { NodeWebSocket } from '../../internal/ws-adapter-node';
|
|
5
5
|
import { ResponsesWSBase, type ResponsesWSBaseOptions } from './ws-base';
|
|
6
6
|
import { OpenAI } from '../../client';
|
|
7
|
+
import { VERSION } from '../../version';
|
|
7
8
|
|
|
8
9
|
export type { ResponsesWSReconnectOptions } from './ws-base';
|
|
9
10
|
|
|
@@ -29,6 +30,8 @@ export class ResponsesWS extends ResponsesWSBase<NodeWebSocket> {
|
|
|
29
30
|
const ws = new WS.WebSocket(url, {
|
|
30
31
|
...this._wsOptions,
|
|
31
32
|
headers: {
|
|
33
|
+
'User-Agent': `${this._client.constructor.name}/JS ${VERSION}`,
|
|
34
|
+
|
|
32
35
|
...authHeaders,
|
|
33
36
|
...this._wsOptions?.headers,
|
|
34
37
|
},
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Version of the installed OpenAI SDK package. */
|
|
2
|
-
export const VERSION = '7.
|
|
2
|
+
export const VERSION = '7.8.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
package/version.d.ts
CHANGED
package/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
/** Version of the installed OpenAI SDK package. */
|
|
5
|
-
exports.VERSION = '7.
|
|
5
|
+
exports.VERSION = '7.8.0'; // x-release-please-version
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/version.mjs
CHANGED