@discomedia/utils 1.0.70 → 1.0.71
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/dist/index-frontend.cjs +2290 -188
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +2289 -189
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +2290 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2289 -189
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +2281 -194
- package/dist/test.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm-config.d.ts +18 -3
- package/dist/types/llm-config.d.ts.map +1 -1
- package/dist/types/llm-images.d.ts.map +1 -1
- package/dist/types/types/llm-types.d.ts +12 -3
- package/dist/types/types/llm-types.d.ts.map +1 -1
- package/dist/types-frontend/index.d.ts +1 -1
- package/dist/types-frontend/index.d.ts.map +1 -1
- package/dist/types-frontend/llm-config.d.ts +18 -3
- package/dist/types-frontend/llm-config.d.ts.map +1 -1
- package/dist/types-frontend/llm-images.d.ts.map +1 -1
- package/dist/types-frontend/types/llm-types.d.ts +12 -3
- package/dist/types-frontend/types/llm-types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/test.js
CHANGED
|
@@ -683,7 +683,7 @@ const safeJSON = (text) => {
|
|
|
683
683
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
684
684
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
685
685
|
|
|
686
|
-
const VERSION = '6.
|
|
686
|
+
const VERSION = '6.37.0'; // x-release-please-version
|
|
687
687
|
|
|
688
688
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
689
689
|
const isRunningInBrowser = () => {
|
|
@@ -1503,6 +1503,8 @@ const formatRequestDetails = (details) => {
|
|
|
1503
1503
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
1504
1504
|
name,
|
|
1505
1505
|
(name.toLowerCase() === 'authorization' ||
|
|
1506
|
+
name.toLowerCase() === 'api-key' ||
|
|
1507
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
1506
1508
|
name.toLowerCase() === 'cookie' ||
|
|
1507
1509
|
name.toLowerCase() === 'set-cookie') ?
|
|
1508
1510
|
'***'
|
|
@@ -2063,6 +2065,36 @@ class ConversationCursorPage extends AbstractPage {
|
|
|
2063
2065
|
};
|
|
2064
2066
|
}
|
|
2065
2067
|
}
|
|
2068
|
+
class NextCursorPage extends AbstractPage {
|
|
2069
|
+
constructor(client, response, body, options) {
|
|
2070
|
+
super(client, response, body, options);
|
|
2071
|
+
this.data = body.data || [];
|
|
2072
|
+
this.has_more = body.has_more || false;
|
|
2073
|
+
this.next = body.next || null;
|
|
2074
|
+
}
|
|
2075
|
+
getPaginatedItems() {
|
|
2076
|
+
return this.data ?? [];
|
|
2077
|
+
}
|
|
2078
|
+
hasNextPage() {
|
|
2079
|
+
if (this.has_more === false) {
|
|
2080
|
+
return false;
|
|
2081
|
+
}
|
|
2082
|
+
return super.hasNextPage();
|
|
2083
|
+
}
|
|
2084
|
+
nextPageRequestOptions() {
|
|
2085
|
+
const cursor = this.next;
|
|
2086
|
+
if (!cursor) {
|
|
2087
|
+
return null;
|
|
2088
|
+
}
|
|
2089
|
+
return {
|
|
2090
|
+
...this.options,
|
|
2091
|
+
query: {
|
|
2092
|
+
...maybeObj(this.options.query),
|
|
2093
|
+
after: cursor,
|
|
2094
|
+
},
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2066
2098
|
|
|
2067
2099
|
const SUBJECT_TOKEN_TYPES = {
|
|
2068
2100
|
jwt: 'urn:ietf:params:oauth:token-type:jwt',
|
|
@@ -2465,7 +2497,7 @@ let Messages$1 = class Messages extends APIResource {
|
|
|
2465
2497
|
* ```
|
|
2466
2498
|
*/
|
|
2467
2499
|
list(completionID, query = {}, options) {
|
|
2468
|
-
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options });
|
|
2500
|
+
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
2469
2501
|
}
|
|
2470
2502
|
};
|
|
2471
2503
|
|
|
@@ -3811,123 +3843,1775 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
3811
3843
|
runner._run(() => runner._fromReadableStream(stream));
|
|
3812
3844
|
return runner;
|
|
3813
3845
|
}
|
|
3814
|
-
static runTools(client, params, options) {
|
|
3815
|
-
const runner = new ChatCompletionStreamingRunner(
|
|
3816
|
-
// @ts-expect-error TODO these types are incompatible
|
|
3817
|
-
params);
|
|
3818
|
-
const opts = {
|
|
3846
|
+
static runTools(client, params, options) {
|
|
3847
|
+
const runner = new ChatCompletionStreamingRunner(
|
|
3848
|
+
// @ts-expect-error TODO these types are incompatible
|
|
3849
|
+
params);
|
|
3850
|
+
const opts = {
|
|
3851
|
+
...options,
|
|
3852
|
+
headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runTools' },
|
|
3853
|
+
};
|
|
3854
|
+
runner._run(() => runner._runTools(client, params, opts));
|
|
3855
|
+
return runner;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3860
|
+
/**
|
|
3861
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
3862
|
+
*/
|
|
3863
|
+
let Completions$1 = class Completions extends APIResource {
|
|
3864
|
+
constructor() {
|
|
3865
|
+
super(...arguments);
|
|
3866
|
+
this.messages = new Messages$1(this._client);
|
|
3867
|
+
}
|
|
3868
|
+
create(body, options) {
|
|
3869
|
+
return this._client.post('/chat/completions', {
|
|
3870
|
+
body,
|
|
3871
|
+
...options,
|
|
3872
|
+
stream: body.stream ?? false,
|
|
3873
|
+
__security: { bearerAuth: true },
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
/**
|
|
3877
|
+
* Get a stored chat completion. Only Chat Completions that have been created with
|
|
3878
|
+
* the `store` parameter set to `true` will be returned.
|
|
3879
|
+
*
|
|
3880
|
+
* @example
|
|
3881
|
+
* ```ts
|
|
3882
|
+
* const chatCompletion =
|
|
3883
|
+
* await client.chat.completions.retrieve('completion_id');
|
|
3884
|
+
* ```
|
|
3885
|
+
*/
|
|
3886
|
+
retrieve(completionID, options) {
|
|
3887
|
+
return this._client.get(path `/chat/completions/${completionID}`, {
|
|
3888
|
+
...options,
|
|
3889
|
+
__security: { bearerAuth: true },
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
/**
|
|
3893
|
+
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
3894
|
+
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
3895
|
+
* supported modification is to update the `metadata` field.
|
|
3896
|
+
*
|
|
3897
|
+
* @example
|
|
3898
|
+
* ```ts
|
|
3899
|
+
* const chatCompletion = await client.chat.completions.update(
|
|
3900
|
+
* 'completion_id',
|
|
3901
|
+
* { metadata: { foo: 'string' } },
|
|
3902
|
+
* );
|
|
3903
|
+
* ```
|
|
3904
|
+
*/
|
|
3905
|
+
update(completionID, body, options) {
|
|
3906
|
+
return this._client.post(path `/chat/completions/${completionID}`, {
|
|
3907
|
+
body,
|
|
3908
|
+
...options,
|
|
3909
|
+
__security: { bearerAuth: true },
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3912
|
+
/**
|
|
3913
|
+
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
3914
|
+
* the `store` parameter set to `true` will be returned.
|
|
3915
|
+
*
|
|
3916
|
+
* @example
|
|
3917
|
+
* ```ts
|
|
3918
|
+
* // Automatically fetches more pages as needed.
|
|
3919
|
+
* for await (const chatCompletion of client.chat.completions.list()) {
|
|
3920
|
+
* // ...
|
|
3921
|
+
* }
|
|
3922
|
+
* ```
|
|
3923
|
+
*/
|
|
3924
|
+
list(query = {}, options) {
|
|
3925
|
+
return this._client.getAPIList('/chat/completions', (CursorPage), {
|
|
3926
|
+
query,
|
|
3927
|
+
...options,
|
|
3928
|
+
__security: { bearerAuth: true },
|
|
3929
|
+
});
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* Delete a stored chat completion. Only Chat Completions that have been created
|
|
3933
|
+
* with the `store` parameter set to `true` can be deleted.
|
|
3934
|
+
*
|
|
3935
|
+
* @example
|
|
3936
|
+
* ```ts
|
|
3937
|
+
* const chatCompletionDeleted =
|
|
3938
|
+
* await client.chat.completions.delete('completion_id');
|
|
3939
|
+
* ```
|
|
3940
|
+
*/
|
|
3941
|
+
delete(completionID, options) {
|
|
3942
|
+
return this._client.delete(path `/chat/completions/${completionID}`, {
|
|
3943
|
+
...options,
|
|
3944
|
+
__security: { bearerAuth: true },
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
parse(body, options) {
|
|
3948
|
+
validateInputTools(body.tools);
|
|
3949
|
+
return this._client.chat.completions
|
|
3950
|
+
.create(body, {
|
|
3951
|
+
...options,
|
|
3952
|
+
headers: {
|
|
3953
|
+
...options?.headers,
|
|
3954
|
+
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
3955
|
+
},
|
|
3956
|
+
})
|
|
3957
|
+
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
3958
|
+
}
|
|
3959
|
+
runTools(body, options) {
|
|
3960
|
+
if (body.stream) {
|
|
3961
|
+
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
3962
|
+
}
|
|
3963
|
+
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* Creates a chat completion stream
|
|
3967
|
+
*/
|
|
3968
|
+
stream(body, options) {
|
|
3969
|
+
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
3970
|
+
}
|
|
3971
|
+
};
|
|
3972
|
+
Completions$1.Messages = Messages$1;
|
|
3973
|
+
|
|
3974
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3975
|
+
class Chat extends APIResource {
|
|
3976
|
+
constructor() {
|
|
3977
|
+
super(...arguments);
|
|
3978
|
+
this.completions = new Completions$1(this._client);
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
Chat.Completions = Completions$1;
|
|
3982
|
+
|
|
3983
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3984
|
+
class AdminAPIKeys extends APIResource {
|
|
3985
|
+
/**
|
|
3986
|
+
* Create an organization admin API key
|
|
3987
|
+
*
|
|
3988
|
+
* @example
|
|
3989
|
+
* ```ts
|
|
3990
|
+
* const adminAPIKey =
|
|
3991
|
+
* await client.admin.organization.adminAPIKeys.create({
|
|
3992
|
+
* name: 'New Admin Key',
|
|
3993
|
+
* });
|
|
3994
|
+
* ```
|
|
3995
|
+
*/
|
|
3996
|
+
create(body, options) {
|
|
3997
|
+
return this._client.post('/organization/admin_api_keys', {
|
|
3998
|
+
body,
|
|
3999
|
+
...options,
|
|
4000
|
+
__security: { adminAPIKeyAuth: true },
|
|
4001
|
+
});
|
|
4002
|
+
}
|
|
4003
|
+
/**
|
|
4004
|
+
* Retrieve a single organization API key
|
|
4005
|
+
*
|
|
4006
|
+
* @example
|
|
4007
|
+
* ```ts
|
|
4008
|
+
* const adminAPIKey =
|
|
4009
|
+
* await client.admin.organization.adminAPIKeys.retrieve(
|
|
4010
|
+
* 'key_id',
|
|
4011
|
+
* );
|
|
4012
|
+
* ```
|
|
4013
|
+
*/
|
|
4014
|
+
retrieve(keyID, options) {
|
|
4015
|
+
return this._client.get(path `/organization/admin_api_keys/${keyID}`, {
|
|
4016
|
+
...options,
|
|
4017
|
+
__security: { adminAPIKeyAuth: true },
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
/**
|
|
4021
|
+
* List organization API keys
|
|
4022
|
+
*
|
|
4023
|
+
* @example
|
|
4024
|
+
* ```ts
|
|
4025
|
+
* // Automatically fetches more pages as needed.
|
|
4026
|
+
* for await (const adminAPIKey of client.admin.organization.adminAPIKeys.list()) {
|
|
4027
|
+
* // ...
|
|
4028
|
+
* }
|
|
4029
|
+
* ```
|
|
4030
|
+
*/
|
|
4031
|
+
list(query = {}, options) {
|
|
4032
|
+
return this._client.getAPIList('/organization/admin_api_keys', (CursorPage), {
|
|
4033
|
+
query,
|
|
4034
|
+
...options,
|
|
4035
|
+
__security: { adminAPIKeyAuth: true },
|
|
4036
|
+
});
|
|
4037
|
+
}
|
|
4038
|
+
/**
|
|
4039
|
+
* Delete an organization admin API key
|
|
4040
|
+
*
|
|
4041
|
+
* @example
|
|
4042
|
+
* ```ts
|
|
4043
|
+
* const adminAPIKey =
|
|
4044
|
+
* await client.admin.organization.adminAPIKeys.delete(
|
|
4045
|
+
* 'key_id',
|
|
4046
|
+
* );
|
|
4047
|
+
* ```
|
|
4048
|
+
*/
|
|
4049
|
+
delete(keyID, options) {
|
|
4050
|
+
return this._client.delete(path `/organization/admin_api_keys/${keyID}`, {
|
|
4051
|
+
...options,
|
|
4052
|
+
__security: { adminAPIKeyAuth: true },
|
|
4053
|
+
});
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4057
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4058
|
+
/**
|
|
4059
|
+
* List user actions and configuration changes within this organization.
|
|
4060
|
+
*/
|
|
4061
|
+
class AuditLogs extends APIResource {
|
|
4062
|
+
/**
|
|
4063
|
+
* List user actions and configuration changes within this organization.
|
|
4064
|
+
*
|
|
4065
|
+
* @example
|
|
4066
|
+
* ```ts
|
|
4067
|
+
* // Automatically fetches more pages as needed.
|
|
4068
|
+
* for await (const auditLogListResponse of client.admin.organization.auditLogs.list()) {
|
|
4069
|
+
* // ...
|
|
4070
|
+
* }
|
|
4071
|
+
* ```
|
|
4072
|
+
*/
|
|
4073
|
+
list(query = {}, options) {
|
|
4074
|
+
return this._client.getAPIList('/organization/audit_logs', (ConversationCursorPage), {
|
|
4075
|
+
query,
|
|
4076
|
+
...options,
|
|
4077
|
+
__security: { adminAPIKeyAuth: true },
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
|
|
4082
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4083
|
+
let Certificates$1 = class Certificates extends APIResource {
|
|
4084
|
+
/**
|
|
4085
|
+
* Upload a certificate to the organization. This does **not** automatically
|
|
4086
|
+
* activate the certificate.
|
|
4087
|
+
*
|
|
4088
|
+
* Organizations can upload up to 50 certificates.
|
|
4089
|
+
*
|
|
4090
|
+
* @example
|
|
4091
|
+
* ```ts
|
|
4092
|
+
* const certificate =
|
|
4093
|
+
* await client.admin.organization.certificates.create({
|
|
4094
|
+
* certificate: 'certificate',
|
|
4095
|
+
* });
|
|
4096
|
+
* ```
|
|
4097
|
+
*/
|
|
4098
|
+
create(body, options) {
|
|
4099
|
+
return this._client.post('/organization/certificates', {
|
|
4100
|
+
body,
|
|
4101
|
+
...options,
|
|
4102
|
+
__security: { adminAPIKeyAuth: true },
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4105
|
+
/**
|
|
4106
|
+
* Get a certificate that has been uploaded to the organization.
|
|
4107
|
+
*
|
|
4108
|
+
* You can get a certificate regardless of whether it is active or not.
|
|
4109
|
+
*
|
|
4110
|
+
* @example
|
|
4111
|
+
* ```ts
|
|
4112
|
+
* const certificate =
|
|
4113
|
+
* await client.admin.organization.certificates.retrieve(
|
|
4114
|
+
* 'certificate_id',
|
|
4115
|
+
* );
|
|
4116
|
+
* ```
|
|
4117
|
+
*/
|
|
4118
|
+
retrieve(certificateID, query = {}, options) {
|
|
4119
|
+
return this._client.get(path `/organization/certificates/${certificateID}`, {
|
|
4120
|
+
query,
|
|
4121
|
+
...options,
|
|
4122
|
+
__security: { adminAPIKeyAuth: true },
|
|
4123
|
+
});
|
|
4124
|
+
}
|
|
4125
|
+
/**
|
|
4126
|
+
* Modify a certificate. Note that only the name can be modified.
|
|
4127
|
+
*
|
|
4128
|
+
* @example
|
|
4129
|
+
* ```ts
|
|
4130
|
+
* const certificate =
|
|
4131
|
+
* await client.admin.organization.certificates.update(
|
|
4132
|
+
* 'certificate_id',
|
|
4133
|
+
* );
|
|
4134
|
+
* ```
|
|
4135
|
+
*/
|
|
4136
|
+
update(certificateID, body, options) {
|
|
4137
|
+
return this._client.post(path `/organization/certificates/${certificateID}`, {
|
|
4138
|
+
body,
|
|
4139
|
+
...options,
|
|
4140
|
+
__security: { adminAPIKeyAuth: true },
|
|
4141
|
+
});
|
|
4142
|
+
}
|
|
4143
|
+
/**
|
|
4144
|
+
* List uploaded certificates for this organization.
|
|
4145
|
+
*
|
|
4146
|
+
* @example
|
|
4147
|
+
* ```ts
|
|
4148
|
+
* // Automatically fetches more pages as needed.
|
|
4149
|
+
* for await (const certificateListResponse of client.admin.organization.certificates.list()) {
|
|
4150
|
+
* // ...
|
|
4151
|
+
* }
|
|
4152
|
+
* ```
|
|
4153
|
+
*/
|
|
4154
|
+
list(query = {}, options) {
|
|
4155
|
+
return this._client.getAPIList('/organization/certificates', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4156
|
+
}
|
|
4157
|
+
/**
|
|
4158
|
+
* Delete a certificate from the organization.
|
|
4159
|
+
*
|
|
4160
|
+
* The certificate must be inactive for the organization and all projects.
|
|
4161
|
+
*
|
|
4162
|
+
* @example
|
|
4163
|
+
* ```ts
|
|
4164
|
+
* const certificate =
|
|
4165
|
+
* await client.admin.organization.certificates.delete(
|
|
4166
|
+
* 'certificate_id',
|
|
4167
|
+
* );
|
|
4168
|
+
* ```
|
|
4169
|
+
*/
|
|
4170
|
+
delete(certificateID, options) {
|
|
4171
|
+
return this._client.delete(path `/organization/certificates/${certificateID}`, {
|
|
4172
|
+
...options,
|
|
4173
|
+
__security: { adminAPIKeyAuth: true },
|
|
4174
|
+
});
|
|
4175
|
+
}
|
|
4176
|
+
/**
|
|
4177
|
+
* Activate certificates at the organization level.
|
|
4178
|
+
*
|
|
4179
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
4180
|
+
*
|
|
4181
|
+
* @example
|
|
4182
|
+
* ```ts
|
|
4183
|
+
* // Automatically fetches more pages as needed.
|
|
4184
|
+
* for await (const certificateActivateResponse of client.admin.organization.certificates.activate(
|
|
4185
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4186
|
+
* )) {
|
|
4187
|
+
* // ...
|
|
4188
|
+
* }
|
|
4189
|
+
* ```
|
|
4190
|
+
*/
|
|
4191
|
+
activate(body, options) {
|
|
4192
|
+
return this._client.getAPIList('/organization/certificates/activate', (Page), {
|
|
4193
|
+
body,
|
|
4194
|
+
method: 'post',
|
|
4195
|
+
...options,
|
|
4196
|
+
__security: { adminAPIKeyAuth: true },
|
|
4197
|
+
});
|
|
4198
|
+
}
|
|
4199
|
+
/**
|
|
4200
|
+
* Deactivate certificates at the organization level.
|
|
4201
|
+
*
|
|
4202
|
+
* You can atomically and idempotently deactivate up to 10 certificates at a time.
|
|
4203
|
+
*
|
|
4204
|
+
* @example
|
|
4205
|
+
* ```ts
|
|
4206
|
+
* // Automatically fetches more pages as needed.
|
|
4207
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.certificates.deactivate(
|
|
4208
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4209
|
+
* )) {
|
|
4210
|
+
* // ...
|
|
4211
|
+
* }
|
|
4212
|
+
* ```
|
|
4213
|
+
*/
|
|
4214
|
+
deactivate(body, options) {
|
|
4215
|
+
return this._client.getAPIList('/organization/certificates/deactivate', (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
4216
|
+
}
|
|
4217
|
+
};
|
|
4218
|
+
|
|
4219
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4220
|
+
class Invites extends APIResource {
|
|
4221
|
+
/**
|
|
4222
|
+
* Create an invite for a user to the organization. The invite must be accepted by
|
|
4223
|
+
* the user before they have access to the organization.
|
|
4224
|
+
*
|
|
4225
|
+
* @example
|
|
4226
|
+
* ```ts
|
|
4227
|
+
* const invite =
|
|
4228
|
+
* await client.admin.organization.invites.create({
|
|
4229
|
+
* email: 'email',
|
|
4230
|
+
* role: 'reader',
|
|
4231
|
+
* });
|
|
4232
|
+
* ```
|
|
4233
|
+
*/
|
|
4234
|
+
create(body, options) {
|
|
4235
|
+
return this._client.post('/organization/invites', {
|
|
4236
|
+
body,
|
|
4237
|
+
...options,
|
|
4238
|
+
__security: { adminAPIKeyAuth: true },
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
/**
|
|
4242
|
+
* Retrieves an invite.
|
|
4243
|
+
*
|
|
4244
|
+
* @example
|
|
4245
|
+
* ```ts
|
|
4246
|
+
* const invite =
|
|
4247
|
+
* await client.admin.organization.invites.retrieve(
|
|
4248
|
+
* 'invite_id',
|
|
4249
|
+
* );
|
|
4250
|
+
* ```
|
|
4251
|
+
*/
|
|
4252
|
+
retrieve(inviteID, options) {
|
|
4253
|
+
return this._client.get(path `/organization/invites/${inviteID}`, {
|
|
4254
|
+
...options,
|
|
4255
|
+
__security: { adminAPIKeyAuth: true },
|
|
4256
|
+
});
|
|
4257
|
+
}
|
|
4258
|
+
/**
|
|
4259
|
+
* Returns a list of invites in the organization.
|
|
4260
|
+
*
|
|
4261
|
+
* @example
|
|
4262
|
+
* ```ts
|
|
4263
|
+
* // Automatically fetches more pages as needed.
|
|
4264
|
+
* for await (const invite of client.admin.organization.invites.list()) {
|
|
4265
|
+
* // ...
|
|
4266
|
+
* }
|
|
4267
|
+
* ```
|
|
4268
|
+
*/
|
|
4269
|
+
list(query = {}, options) {
|
|
4270
|
+
return this._client.getAPIList('/organization/invites', (ConversationCursorPage), {
|
|
4271
|
+
query,
|
|
4272
|
+
...options,
|
|
4273
|
+
__security: { adminAPIKeyAuth: true },
|
|
4274
|
+
});
|
|
4275
|
+
}
|
|
4276
|
+
/**
|
|
4277
|
+
* Delete an invite. If the invite has already been accepted, it cannot be deleted.
|
|
4278
|
+
*
|
|
4279
|
+
* @example
|
|
4280
|
+
* ```ts
|
|
4281
|
+
* const invite =
|
|
4282
|
+
* await client.admin.organization.invites.delete(
|
|
4283
|
+
* 'invite_id',
|
|
4284
|
+
* );
|
|
4285
|
+
* ```
|
|
4286
|
+
*/
|
|
4287
|
+
delete(inviteID, options) {
|
|
4288
|
+
return this._client.delete(path `/organization/invites/${inviteID}`, {
|
|
4289
|
+
...options,
|
|
4290
|
+
__security: { adminAPIKeyAuth: true },
|
|
4291
|
+
});
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4295
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4296
|
+
let Roles$5 = class Roles extends APIResource {
|
|
4297
|
+
/**
|
|
4298
|
+
* Creates a custom role for the organization.
|
|
4299
|
+
*
|
|
4300
|
+
* @example
|
|
4301
|
+
* ```ts
|
|
4302
|
+
* const role = await client.admin.organization.roles.create({
|
|
4303
|
+
* permissions: ['string'],
|
|
4304
|
+
* role_name: 'role_name',
|
|
4305
|
+
* });
|
|
4306
|
+
* ```
|
|
4307
|
+
*/
|
|
4308
|
+
create(body, options) {
|
|
4309
|
+
return this._client.post('/organization/roles', {
|
|
4310
|
+
body,
|
|
4311
|
+
...options,
|
|
4312
|
+
__security: { adminAPIKeyAuth: true },
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
/**
|
|
4316
|
+
* Updates an existing organization role.
|
|
4317
|
+
*
|
|
4318
|
+
* @example
|
|
4319
|
+
* ```ts
|
|
4320
|
+
* const role = await client.admin.organization.roles.update(
|
|
4321
|
+
* 'role_id',
|
|
4322
|
+
* );
|
|
4323
|
+
* ```
|
|
4324
|
+
*/
|
|
4325
|
+
update(roleID, body, options) {
|
|
4326
|
+
return this._client.post(path `/organization/roles/${roleID}`, {
|
|
4327
|
+
body,
|
|
4328
|
+
...options,
|
|
4329
|
+
__security: { adminAPIKeyAuth: true },
|
|
4330
|
+
});
|
|
4331
|
+
}
|
|
4332
|
+
/**
|
|
4333
|
+
* Lists the roles configured for the organization.
|
|
4334
|
+
*
|
|
4335
|
+
* @example
|
|
4336
|
+
* ```ts
|
|
4337
|
+
* // Automatically fetches more pages as needed.
|
|
4338
|
+
* for await (const role of client.admin.organization.roles.list()) {
|
|
4339
|
+
* // ...
|
|
4340
|
+
* }
|
|
4341
|
+
* ```
|
|
4342
|
+
*/
|
|
4343
|
+
list(query = {}, options) {
|
|
4344
|
+
return this._client.getAPIList('/organization/roles', (NextCursorPage), {
|
|
4345
|
+
query,
|
|
4346
|
+
...options,
|
|
4347
|
+
__security: { adminAPIKeyAuth: true },
|
|
4348
|
+
});
|
|
4349
|
+
}
|
|
4350
|
+
/**
|
|
4351
|
+
* Deletes a custom role from the organization.
|
|
4352
|
+
*
|
|
4353
|
+
* @example
|
|
4354
|
+
* ```ts
|
|
4355
|
+
* const role = await client.admin.organization.roles.delete(
|
|
4356
|
+
* 'role_id',
|
|
4357
|
+
* );
|
|
4358
|
+
* ```
|
|
4359
|
+
*/
|
|
4360
|
+
delete(roleID, options) {
|
|
4361
|
+
return this._client.delete(path `/organization/roles/${roleID}`, {
|
|
4362
|
+
...options,
|
|
4363
|
+
__security: { adminAPIKeyAuth: true },
|
|
4364
|
+
});
|
|
4365
|
+
}
|
|
4366
|
+
};
|
|
4367
|
+
|
|
4368
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4369
|
+
class Usage extends APIResource {
|
|
4370
|
+
/**
|
|
4371
|
+
* Get audio speeches usage details for the organization.
|
|
4372
|
+
*
|
|
4373
|
+
* @example
|
|
4374
|
+
* ```ts
|
|
4375
|
+
* const response =
|
|
4376
|
+
* await client.admin.organization.usage.audioSpeeches({
|
|
4377
|
+
* start_time: 0,
|
|
4378
|
+
* });
|
|
4379
|
+
* ```
|
|
4380
|
+
*/
|
|
4381
|
+
audioSpeeches(query, options) {
|
|
4382
|
+
return this._client.get('/organization/usage/audio_speeches', {
|
|
4383
|
+
query,
|
|
4384
|
+
...options,
|
|
4385
|
+
__security: { adminAPIKeyAuth: true },
|
|
4386
|
+
});
|
|
4387
|
+
}
|
|
4388
|
+
/**
|
|
4389
|
+
* Get audio transcriptions usage details for the organization.
|
|
4390
|
+
*
|
|
4391
|
+
* @example
|
|
4392
|
+
* ```ts
|
|
4393
|
+
* const response =
|
|
4394
|
+
* await client.admin.organization.usage.audioTranscriptions(
|
|
4395
|
+
* { start_time: 0 },
|
|
4396
|
+
* );
|
|
4397
|
+
* ```
|
|
4398
|
+
*/
|
|
4399
|
+
audioTranscriptions(query, options) {
|
|
4400
|
+
return this._client.get('/organization/usage/audio_transcriptions', {
|
|
4401
|
+
query,
|
|
4402
|
+
...options,
|
|
4403
|
+
__security: { adminAPIKeyAuth: true },
|
|
4404
|
+
});
|
|
4405
|
+
}
|
|
4406
|
+
/**
|
|
4407
|
+
* Get code interpreter sessions usage details for the organization.
|
|
4408
|
+
*
|
|
4409
|
+
* @example
|
|
4410
|
+
* ```ts
|
|
4411
|
+
* const response =
|
|
4412
|
+
* await client.admin.organization.usage.codeInterpreterSessions(
|
|
4413
|
+
* { start_time: 0 },
|
|
4414
|
+
* );
|
|
4415
|
+
* ```
|
|
4416
|
+
*/
|
|
4417
|
+
codeInterpreterSessions(query, options) {
|
|
4418
|
+
return this._client.get('/organization/usage/code_interpreter_sessions', {
|
|
4419
|
+
query,
|
|
4420
|
+
...options,
|
|
4421
|
+
__security: { adminAPIKeyAuth: true },
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* Get completions usage details for the organization.
|
|
4426
|
+
*
|
|
4427
|
+
* @example
|
|
4428
|
+
* ```ts
|
|
4429
|
+
* const response =
|
|
4430
|
+
* await client.admin.organization.usage.completions({
|
|
4431
|
+
* start_time: 0,
|
|
4432
|
+
* });
|
|
4433
|
+
* ```
|
|
4434
|
+
*/
|
|
4435
|
+
completions(query, options) {
|
|
4436
|
+
return this._client.get('/organization/usage/completions', {
|
|
4437
|
+
query,
|
|
4438
|
+
...options,
|
|
4439
|
+
__security: { adminAPIKeyAuth: true },
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Get costs details for the organization.
|
|
4444
|
+
*
|
|
4445
|
+
* @example
|
|
4446
|
+
* ```ts
|
|
4447
|
+
* const response =
|
|
4448
|
+
* await client.admin.organization.usage.costs({
|
|
4449
|
+
* start_time: 0,
|
|
4450
|
+
* });
|
|
4451
|
+
* ```
|
|
4452
|
+
*/
|
|
4453
|
+
costs(query, options) {
|
|
4454
|
+
return this._client.get('/organization/costs', {
|
|
4455
|
+
query,
|
|
4456
|
+
...options,
|
|
4457
|
+
__security: { adminAPIKeyAuth: true },
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4460
|
+
/**
|
|
4461
|
+
* Get embeddings usage details for the organization.
|
|
4462
|
+
*
|
|
4463
|
+
* @example
|
|
4464
|
+
* ```ts
|
|
4465
|
+
* const response =
|
|
4466
|
+
* await client.admin.organization.usage.embeddings({
|
|
4467
|
+
* start_time: 0,
|
|
4468
|
+
* });
|
|
4469
|
+
* ```
|
|
4470
|
+
*/
|
|
4471
|
+
embeddings(query, options) {
|
|
4472
|
+
return this._client.get('/organization/usage/embeddings', {
|
|
4473
|
+
query,
|
|
4474
|
+
...options,
|
|
4475
|
+
__security: { adminAPIKeyAuth: true },
|
|
4476
|
+
});
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Get images usage details for the organization.
|
|
4480
|
+
*
|
|
4481
|
+
* @example
|
|
4482
|
+
* ```ts
|
|
4483
|
+
* const response =
|
|
4484
|
+
* await client.admin.organization.usage.images({
|
|
4485
|
+
* start_time: 0,
|
|
4486
|
+
* });
|
|
4487
|
+
* ```
|
|
4488
|
+
*/
|
|
4489
|
+
images(query, options) {
|
|
4490
|
+
return this._client.get('/organization/usage/images', {
|
|
4491
|
+
query,
|
|
4492
|
+
...options,
|
|
4493
|
+
__security: { adminAPIKeyAuth: true },
|
|
4494
|
+
});
|
|
4495
|
+
}
|
|
4496
|
+
/**
|
|
4497
|
+
* Get moderations usage details for the organization.
|
|
4498
|
+
*
|
|
4499
|
+
* @example
|
|
4500
|
+
* ```ts
|
|
4501
|
+
* const response =
|
|
4502
|
+
* await client.admin.organization.usage.moderations({
|
|
4503
|
+
* start_time: 0,
|
|
4504
|
+
* });
|
|
4505
|
+
* ```
|
|
4506
|
+
*/
|
|
4507
|
+
moderations(query, options) {
|
|
4508
|
+
return this._client.get('/organization/usage/moderations', {
|
|
4509
|
+
query,
|
|
4510
|
+
...options,
|
|
4511
|
+
__security: { adminAPIKeyAuth: true },
|
|
4512
|
+
});
|
|
4513
|
+
}
|
|
4514
|
+
/**
|
|
4515
|
+
* Get vector stores usage details for the organization.
|
|
4516
|
+
*
|
|
4517
|
+
* @example
|
|
4518
|
+
* ```ts
|
|
4519
|
+
* const response =
|
|
4520
|
+
* await client.admin.organization.usage.vectorStores({
|
|
4521
|
+
* start_time: 0,
|
|
4522
|
+
* });
|
|
4523
|
+
* ```
|
|
4524
|
+
*/
|
|
4525
|
+
vectorStores(query, options) {
|
|
4526
|
+
return this._client.get('/organization/usage/vector_stores', {
|
|
4527
|
+
query,
|
|
4528
|
+
...options,
|
|
4529
|
+
__security: { adminAPIKeyAuth: true },
|
|
4530
|
+
});
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4535
|
+
let Roles$4 = class Roles extends APIResource {
|
|
4536
|
+
/**
|
|
4537
|
+
* Assigns an organization role to a group within the organization.
|
|
4538
|
+
*
|
|
4539
|
+
* @example
|
|
4540
|
+
* ```ts
|
|
4541
|
+
* const role =
|
|
4542
|
+
* await client.admin.organization.groups.roles.create(
|
|
4543
|
+
* 'group_id',
|
|
4544
|
+
* { role_id: 'role_id' },
|
|
4545
|
+
* );
|
|
4546
|
+
* ```
|
|
4547
|
+
*/
|
|
4548
|
+
create(groupID, body, options) {
|
|
4549
|
+
return this._client.post(path `/organization/groups/${groupID}/roles`, {
|
|
4550
|
+
body,
|
|
4551
|
+
...options,
|
|
4552
|
+
__security: { adminAPIKeyAuth: true },
|
|
4553
|
+
});
|
|
4554
|
+
}
|
|
4555
|
+
/**
|
|
4556
|
+
* Lists the organization roles assigned to a group within the organization.
|
|
4557
|
+
*
|
|
4558
|
+
* @example
|
|
4559
|
+
* ```ts
|
|
4560
|
+
* // Automatically fetches more pages as needed.
|
|
4561
|
+
* for await (const roleListResponse of client.admin.organization.groups.roles.list(
|
|
4562
|
+
* 'group_id',
|
|
4563
|
+
* )) {
|
|
4564
|
+
* // ...
|
|
4565
|
+
* }
|
|
4566
|
+
* ```
|
|
4567
|
+
*/
|
|
4568
|
+
list(groupID, query = {}, options) {
|
|
4569
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4570
|
+
}
|
|
4571
|
+
/**
|
|
4572
|
+
* Unassigns an organization role from a group within the organization.
|
|
4573
|
+
*
|
|
4574
|
+
* @example
|
|
4575
|
+
* ```ts
|
|
4576
|
+
* const role =
|
|
4577
|
+
* await client.admin.organization.groups.roles.delete(
|
|
4578
|
+
* 'role_id',
|
|
4579
|
+
* { group_id: 'group_id' },
|
|
4580
|
+
* );
|
|
4581
|
+
* ```
|
|
4582
|
+
*/
|
|
4583
|
+
delete(roleID, params, options) {
|
|
4584
|
+
const { group_id } = params;
|
|
4585
|
+
return this._client.delete(path `/organization/groups/${group_id}/roles/${roleID}`, {
|
|
4586
|
+
...options,
|
|
4587
|
+
__security: { adminAPIKeyAuth: true },
|
|
4588
|
+
});
|
|
4589
|
+
}
|
|
4590
|
+
};
|
|
4591
|
+
|
|
4592
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4593
|
+
let Users$2 = class Users extends APIResource {
|
|
4594
|
+
/**
|
|
4595
|
+
* Adds a user to a group.
|
|
4596
|
+
*
|
|
4597
|
+
* @example
|
|
4598
|
+
* ```ts
|
|
4599
|
+
* const user =
|
|
4600
|
+
* await client.admin.organization.groups.users.create(
|
|
4601
|
+
* 'group_id',
|
|
4602
|
+
* { user_id: 'user_id' },
|
|
4603
|
+
* );
|
|
4604
|
+
* ```
|
|
4605
|
+
*/
|
|
4606
|
+
create(groupID, body, options) {
|
|
4607
|
+
return this._client.post(path `/organization/groups/${groupID}/users`, {
|
|
4608
|
+
body,
|
|
4609
|
+
...options,
|
|
4610
|
+
__security: { adminAPIKeyAuth: true },
|
|
4611
|
+
});
|
|
4612
|
+
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Lists the users assigned to a group.
|
|
4615
|
+
*
|
|
4616
|
+
* @example
|
|
4617
|
+
* ```ts
|
|
4618
|
+
* // Automatically fetches more pages as needed.
|
|
4619
|
+
* for await (const organizationGroupUser of client.admin.organization.groups.users.list(
|
|
4620
|
+
* 'group_id',
|
|
4621
|
+
* )) {
|
|
4622
|
+
* // ...
|
|
4623
|
+
* }
|
|
4624
|
+
* ```
|
|
4625
|
+
*/
|
|
4626
|
+
list(groupID, query = {}, options) {
|
|
4627
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/users`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4628
|
+
}
|
|
4629
|
+
/**
|
|
4630
|
+
* Removes a user from a group.
|
|
4631
|
+
*
|
|
4632
|
+
* @example
|
|
4633
|
+
* ```ts
|
|
4634
|
+
* const user =
|
|
4635
|
+
* await client.admin.organization.groups.users.delete(
|
|
4636
|
+
* 'user_id',
|
|
4637
|
+
* { group_id: 'group_id' },
|
|
4638
|
+
* );
|
|
4639
|
+
* ```
|
|
4640
|
+
*/
|
|
4641
|
+
delete(userID, params, options) {
|
|
4642
|
+
const { group_id } = params;
|
|
4643
|
+
return this._client.delete(path `/organization/groups/${group_id}/users/${userID}`, {
|
|
4644
|
+
...options,
|
|
4645
|
+
__security: { adminAPIKeyAuth: true },
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
};
|
|
4649
|
+
|
|
4650
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4651
|
+
let Groups$1 = class Groups extends APIResource {
|
|
4652
|
+
constructor() {
|
|
4653
|
+
super(...arguments);
|
|
4654
|
+
this.users = new Users$2(this._client);
|
|
4655
|
+
this.roles = new Roles$4(this._client);
|
|
4656
|
+
}
|
|
4657
|
+
/**
|
|
4658
|
+
* Creates a new group in the organization.
|
|
4659
|
+
*
|
|
4660
|
+
* @example
|
|
4661
|
+
* ```ts
|
|
4662
|
+
* const group = await client.admin.organization.groups.create(
|
|
4663
|
+
* { name: 'x' },
|
|
4664
|
+
* );
|
|
4665
|
+
* ```
|
|
4666
|
+
*/
|
|
4667
|
+
create(body, options) {
|
|
4668
|
+
return this._client.post('/organization/groups', {
|
|
4669
|
+
body,
|
|
4670
|
+
...options,
|
|
4671
|
+
__security: { adminAPIKeyAuth: true },
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
/**
|
|
4675
|
+
* Updates a group's information.
|
|
4676
|
+
*
|
|
4677
|
+
* @example
|
|
4678
|
+
* ```ts
|
|
4679
|
+
* const group = await client.admin.organization.groups.update(
|
|
4680
|
+
* 'group_id',
|
|
4681
|
+
* { name: 'x' },
|
|
4682
|
+
* );
|
|
4683
|
+
* ```
|
|
4684
|
+
*/
|
|
4685
|
+
update(groupID, body, options) {
|
|
4686
|
+
return this._client.post(path `/organization/groups/${groupID}`, {
|
|
4687
|
+
body,
|
|
4688
|
+
...options,
|
|
4689
|
+
__security: { adminAPIKeyAuth: true },
|
|
4690
|
+
});
|
|
4691
|
+
}
|
|
4692
|
+
/**
|
|
4693
|
+
* Lists all groups in the organization.
|
|
4694
|
+
*
|
|
4695
|
+
* @example
|
|
4696
|
+
* ```ts
|
|
4697
|
+
* // Automatically fetches more pages as needed.
|
|
4698
|
+
* for await (const group of client.admin.organization.groups.list()) {
|
|
4699
|
+
* // ...
|
|
4700
|
+
* }
|
|
4701
|
+
* ```
|
|
4702
|
+
*/
|
|
4703
|
+
list(query = {}, options) {
|
|
4704
|
+
return this._client.getAPIList('/organization/groups', (NextCursorPage), {
|
|
4705
|
+
query,
|
|
4706
|
+
...options,
|
|
4707
|
+
__security: { adminAPIKeyAuth: true },
|
|
4708
|
+
});
|
|
4709
|
+
}
|
|
4710
|
+
/**
|
|
4711
|
+
* Deletes a group from the organization.
|
|
4712
|
+
*
|
|
4713
|
+
* @example
|
|
4714
|
+
* ```ts
|
|
4715
|
+
* const group = await client.admin.organization.groups.delete(
|
|
4716
|
+
* 'group_id',
|
|
4717
|
+
* );
|
|
4718
|
+
* ```
|
|
4719
|
+
*/
|
|
4720
|
+
delete(groupID, options) {
|
|
4721
|
+
return this._client.delete(path `/organization/groups/${groupID}`, {
|
|
4722
|
+
...options,
|
|
4723
|
+
__security: { adminAPIKeyAuth: true },
|
|
4724
|
+
});
|
|
4725
|
+
}
|
|
4726
|
+
};
|
|
4727
|
+
Groups$1.Users = Users$2;
|
|
4728
|
+
Groups$1.Roles = Roles$4;
|
|
4729
|
+
|
|
4730
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4731
|
+
class APIKeys extends APIResource {
|
|
4732
|
+
/**
|
|
4733
|
+
* Retrieves an API key in the project.
|
|
4734
|
+
*
|
|
4735
|
+
* @example
|
|
4736
|
+
* ```ts
|
|
4737
|
+
* const projectAPIKey =
|
|
4738
|
+
* await client.admin.organization.projects.apiKeys.retrieve(
|
|
4739
|
+
* 'api_key_id',
|
|
4740
|
+
* { project_id: 'project_id' },
|
|
4741
|
+
* );
|
|
4742
|
+
* ```
|
|
4743
|
+
*/
|
|
4744
|
+
retrieve(apiKeyID, params, options) {
|
|
4745
|
+
const { project_id } = params;
|
|
4746
|
+
return this._client.get(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
4747
|
+
...options,
|
|
4748
|
+
__security: { adminAPIKeyAuth: true },
|
|
4749
|
+
});
|
|
4750
|
+
}
|
|
4751
|
+
/**
|
|
4752
|
+
* Returns a list of API keys in the project.
|
|
4753
|
+
*
|
|
4754
|
+
* @example
|
|
4755
|
+
* ```ts
|
|
4756
|
+
* // Automatically fetches more pages as needed.
|
|
4757
|
+
* for await (const projectAPIKey of client.admin.organization.projects.apiKeys.list(
|
|
4758
|
+
* 'project_id',
|
|
4759
|
+
* )) {
|
|
4760
|
+
* // ...
|
|
4761
|
+
* }
|
|
4762
|
+
* ```
|
|
4763
|
+
*/
|
|
4764
|
+
list(projectID, query = {}, options) {
|
|
4765
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/api_keys`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4766
|
+
}
|
|
4767
|
+
/**
|
|
4768
|
+
* Deletes an API key from the project.
|
|
4769
|
+
*
|
|
4770
|
+
* Returns confirmation of the key deletion, or an error if the key belonged to a
|
|
4771
|
+
* service account.
|
|
4772
|
+
*
|
|
4773
|
+
* @example
|
|
4774
|
+
* ```ts
|
|
4775
|
+
* const apiKey =
|
|
4776
|
+
* await client.admin.organization.projects.apiKeys.delete(
|
|
4777
|
+
* 'api_key_id',
|
|
4778
|
+
* { project_id: 'project_id' },
|
|
4779
|
+
* );
|
|
4780
|
+
* ```
|
|
4781
|
+
*/
|
|
4782
|
+
delete(apiKeyID, params, options) {
|
|
4783
|
+
const { project_id } = params;
|
|
4784
|
+
return this._client.delete(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
4785
|
+
...options,
|
|
4786
|
+
__security: { adminAPIKeyAuth: true },
|
|
4787
|
+
});
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
|
|
4791
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4792
|
+
class Certificates extends APIResource {
|
|
4793
|
+
/**
|
|
4794
|
+
* List certificates for this project.
|
|
4795
|
+
*
|
|
4796
|
+
* @example
|
|
4797
|
+
* ```ts
|
|
4798
|
+
* // Automatically fetches more pages as needed.
|
|
4799
|
+
* for await (const certificateListResponse of client.admin.organization.projects.certificates.list(
|
|
4800
|
+
* 'project_id',
|
|
4801
|
+
* )) {
|
|
4802
|
+
* // ...
|
|
4803
|
+
* }
|
|
4804
|
+
* ```
|
|
4805
|
+
*/
|
|
4806
|
+
list(projectID, query = {}, options) {
|
|
4807
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4808
|
+
}
|
|
4809
|
+
/**
|
|
4810
|
+
* Activate certificates at the project level.
|
|
4811
|
+
*
|
|
4812
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
4813
|
+
*
|
|
4814
|
+
* @example
|
|
4815
|
+
* ```ts
|
|
4816
|
+
* // Automatically fetches more pages as needed.
|
|
4817
|
+
* for await (const certificateActivateResponse of client.admin.organization.projects.certificates.activate(
|
|
4818
|
+
* 'project_id',
|
|
4819
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4820
|
+
* )) {
|
|
4821
|
+
* // ...
|
|
4822
|
+
* }
|
|
4823
|
+
* ```
|
|
4824
|
+
*/
|
|
4825
|
+
activate(projectID, body, options) {
|
|
4826
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/activate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
4827
|
+
}
|
|
4828
|
+
/**
|
|
4829
|
+
* Deactivate certificates at the project level. You can atomically and
|
|
4830
|
+
* idempotently deactivate up to 10 certificates at a time.
|
|
4831
|
+
*
|
|
4832
|
+
* @example
|
|
4833
|
+
* ```ts
|
|
4834
|
+
* // Automatically fetches more pages as needed.
|
|
4835
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.projects.certificates.deactivate(
|
|
4836
|
+
* 'project_id',
|
|
4837
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4838
|
+
* )) {
|
|
4839
|
+
* // ...
|
|
4840
|
+
* }
|
|
4841
|
+
* ```
|
|
4842
|
+
*/
|
|
4843
|
+
deactivate(projectID, body, options) {
|
|
4844
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/deactivate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4848
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4849
|
+
class RateLimits extends APIResource {
|
|
4850
|
+
/**
|
|
4851
|
+
* Returns the rate limits per model for a project.
|
|
4852
|
+
*
|
|
4853
|
+
* @example
|
|
4854
|
+
* ```ts
|
|
4855
|
+
* // Automatically fetches more pages as needed.
|
|
4856
|
+
* for await (const projectRateLimit of client.admin.organization.projects.rateLimits.listRateLimits(
|
|
4857
|
+
* 'project_id',
|
|
4858
|
+
* )) {
|
|
4859
|
+
* // ...
|
|
4860
|
+
* }
|
|
4861
|
+
* ```
|
|
4862
|
+
*/
|
|
4863
|
+
listRateLimits(projectID, query = {}, options) {
|
|
4864
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/rate_limits`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4865
|
+
}
|
|
4866
|
+
/**
|
|
4867
|
+
* Updates a project rate limit.
|
|
4868
|
+
*
|
|
4869
|
+
* @example
|
|
4870
|
+
* ```ts
|
|
4871
|
+
* const projectRateLimit =
|
|
4872
|
+
* await client.admin.organization.projects.rateLimits.updateRateLimit(
|
|
4873
|
+
* 'rate_limit_id',
|
|
4874
|
+
* { project_id: 'project_id' },
|
|
4875
|
+
* );
|
|
4876
|
+
* ```
|
|
4877
|
+
*/
|
|
4878
|
+
updateRateLimit(rateLimitID, params, options) {
|
|
4879
|
+
const { project_id, ...body } = params;
|
|
4880
|
+
return this._client.post(path `/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
|
|
4881
|
+
body,
|
|
4882
|
+
...options,
|
|
4883
|
+
__security: { adminAPIKeyAuth: true },
|
|
4884
|
+
});
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4889
|
+
let Roles$3 = class Roles extends APIResource {
|
|
4890
|
+
/**
|
|
4891
|
+
* Creates a custom role for a project.
|
|
4892
|
+
*
|
|
4893
|
+
* @example
|
|
4894
|
+
* ```ts
|
|
4895
|
+
* const role =
|
|
4896
|
+
* await client.admin.organization.projects.roles.create(
|
|
4897
|
+
* 'project_id',
|
|
4898
|
+
* { permissions: ['string'], role_name: 'role_name' },
|
|
4899
|
+
* );
|
|
4900
|
+
* ```
|
|
4901
|
+
*/
|
|
4902
|
+
create(projectID, body, options) {
|
|
4903
|
+
return this._client.post(path `/projects/${projectID}/roles`, {
|
|
4904
|
+
body,
|
|
4905
|
+
...options,
|
|
4906
|
+
__security: { adminAPIKeyAuth: true },
|
|
4907
|
+
});
|
|
4908
|
+
}
|
|
4909
|
+
/**
|
|
4910
|
+
* Updates an existing project role.
|
|
4911
|
+
*
|
|
4912
|
+
* @example
|
|
4913
|
+
* ```ts
|
|
4914
|
+
* const role =
|
|
4915
|
+
* await client.admin.organization.projects.roles.update(
|
|
4916
|
+
* 'role_id',
|
|
4917
|
+
* { project_id: 'project_id' },
|
|
4918
|
+
* );
|
|
4919
|
+
* ```
|
|
4920
|
+
*/
|
|
4921
|
+
update(roleID, params, options) {
|
|
4922
|
+
const { project_id, ...body } = params;
|
|
4923
|
+
return this._client.post(path `/projects/${project_id}/roles/${roleID}`, {
|
|
4924
|
+
body,
|
|
4925
|
+
...options,
|
|
4926
|
+
__security: { adminAPIKeyAuth: true },
|
|
4927
|
+
});
|
|
4928
|
+
}
|
|
4929
|
+
/**
|
|
4930
|
+
* Lists the roles configured for a project.
|
|
4931
|
+
*
|
|
4932
|
+
* @example
|
|
4933
|
+
* ```ts
|
|
4934
|
+
* // Automatically fetches more pages as needed.
|
|
4935
|
+
* for await (const role of client.admin.organization.projects.roles.list(
|
|
4936
|
+
* 'project_id',
|
|
4937
|
+
* )) {
|
|
4938
|
+
* // ...
|
|
4939
|
+
* }
|
|
4940
|
+
* ```
|
|
4941
|
+
*/
|
|
4942
|
+
list(projectID, query = {}, options) {
|
|
4943
|
+
return this._client.getAPIList(path `/projects/${projectID}/roles`, (NextCursorPage), {
|
|
4944
|
+
query,
|
|
4945
|
+
...options,
|
|
4946
|
+
__security: { adminAPIKeyAuth: true },
|
|
4947
|
+
});
|
|
4948
|
+
}
|
|
4949
|
+
/**
|
|
4950
|
+
* Deletes a custom role from a project.
|
|
4951
|
+
*
|
|
4952
|
+
* @example
|
|
4953
|
+
* ```ts
|
|
4954
|
+
* const role =
|
|
4955
|
+
* await client.admin.organization.projects.roles.delete(
|
|
4956
|
+
* 'role_id',
|
|
4957
|
+
* { project_id: 'project_id' },
|
|
4958
|
+
* );
|
|
4959
|
+
* ```
|
|
4960
|
+
*/
|
|
4961
|
+
delete(roleID, params, options) {
|
|
4962
|
+
const { project_id } = params;
|
|
4963
|
+
return this._client.delete(path `/projects/${project_id}/roles/${roleID}`, {
|
|
4964
|
+
...options,
|
|
4965
|
+
__security: { adminAPIKeyAuth: true },
|
|
4966
|
+
});
|
|
4967
|
+
}
|
|
4968
|
+
};
|
|
4969
|
+
|
|
4970
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4971
|
+
class ServiceAccounts extends APIResource {
|
|
4972
|
+
/**
|
|
4973
|
+
* Creates a new service account in the project. This also returns an unredacted
|
|
4974
|
+
* API key for the service account.
|
|
4975
|
+
*
|
|
4976
|
+
* @example
|
|
4977
|
+
* ```ts
|
|
4978
|
+
* const serviceAccount =
|
|
4979
|
+
* await client.admin.organization.projects.serviceAccounts.create(
|
|
4980
|
+
* 'project_id',
|
|
4981
|
+
* { name: 'name' },
|
|
4982
|
+
* );
|
|
4983
|
+
* ```
|
|
4984
|
+
*/
|
|
4985
|
+
create(projectID, body, options) {
|
|
4986
|
+
return this._client.post(path `/organization/projects/${projectID}/service_accounts`, {
|
|
4987
|
+
body,
|
|
4988
|
+
...options,
|
|
4989
|
+
__security: { adminAPIKeyAuth: true },
|
|
4990
|
+
});
|
|
4991
|
+
}
|
|
4992
|
+
/**
|
|
4993
|
+
* Retrieves a service account in the project.
|
|
4994
|
+
*
|
|
4995
|
+
* @example
|
|
4996
|
+
* ```ts
|
|
4997
|
+
* const projectServiceAccount =
|
|
4998
|
+
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
4999
|
+
* 'service_account_id',
|
|
5000
|
+
* { project_id: 'project_id' },
|
|
5001
|
+
* );
|
|
5002
|
+
* ```
|
|
5003
|
+
*/
|
|
5004
|
+
retrieve(serviceAccountID, params, options) {
|
|
5005
|
+
const { project_id } = params;
|
|
5006
|
+
return this._client.get(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
5007
|
+
...options,
|
|
5008
|
+
__security: { adminAPIKeyAuth: true },
|
|
5009
|
+
});
|
|
5010
|
+
}
|
|
5011
|
+
/**
|
|
5012
|
+
* Returns a list of service accounts in the project.
|
|
5013
|
+
*
|
|
5014
|
+
* @example
|
|
5015
|
+
* ```ts
|
|
5016
|
+
* // Automatically fetches more pages as needed.
|
|
5017
|
+
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
5018
|
+
* 'project_id',
|
|
5019
|
+
* )) {
|
|
5020
|
+
* // ...
|
|
5021
|
+
* }
|
|
5022
|
+
* ```
|
|
5023
|
+
*/
|
|
5024
|
+
list(projectID, query = {}, options) {
|
|
5025
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/service_accounts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5026
|
+
}
|
|
5027
|
+
/**
|
|
5028
|
+
* Deletes a service account from the project.
|
|
5029
|
+
*
|
|
5030
|
+
* Returns confirmation of service account deletion, or an error if the project is
|
|
5031
|
+
* archived (archived projects have no service accounts).
|
|
5032
|
+
*
|
|
5033
|
+
* @example
|
|
5034
|
+
* ```ts
|
|
5035
|
+
* const serviceAccount =
|
|
5036
|
+
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
5037
|
+
* 'service_account_id',
|
|
5038
|
+
* { project_id: 'project_id' },
|
|
5039
|
+
* );
|
|
5040
|
+
* ```
|
|
5041
|
+
*/
|
|
5042
|
+
delete(serviceAccountID, params, options) {
|
|
5043
|
+
const { project_id } = params;
|
|
5044
|
+
return this._client.delete(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
|
|
5048
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5049
|
+
let Roles$2 = class Roles extends APIResource {
|
|
5050
|
+
/**
|
|
5051
|
+
* Assigns a project role to a group within a project.
|
|
5052
|
+
*
|
|
5053
|
+
* @example
|
|
5054
|
+
* ```ts
|
|
5055
|
+
* const role =
|
|
5056
|
+
* await client.admin.organization.projects.groups.roles.create(
|
|
5057
|
+
* 'group_id',
|
|
5058
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
5059
|
+
* );
|
|
5060
|
+
* ```
|
|
5061
|
+
*/
|
|
5062
|
+
create(groupID, params, options) {
|
|
5063
|
+
const { project_id, ...body } = params;
|
|
5064
|
+
return this._client.post(path `/projects/${project_id}/groups/${groupID}/roles`, {
|
|
5065
|
+
body,
|
|
5066
|
+
...options,
|
|
5067
|
+
__security: { adminAPIKeyAuth: true },
|
|
5068
|
+
});
|
|
5069
|
+
}
|
|
5070
|
+
/**
|
|
5071
|
+
* Lists the project roles assigned to a group within a project.
|
|
5072
|
+
*
|
|
5073
|
+
* @example
|
|
5074
|
+
* ```ts
|
|
5075
|
+
* // Automatically fetches more pages as needed.
|
|
5076
|
+
* for await (const roleListResponse of client.admin.organization.projects.groups.roles.list(
|
|
5077
|
+
* 'group_id',
|
|
5078
|
+
* { project_id: 'project_id' },
|
|
5079
|
+
* )) {
|
|
5080
|
+
* // ...
|
|
5081
|
+
* }
|
|
5082
|
+
* ```
|
|
5083
|
+
*/
|
|
5084
|
+
list(groupID, params, options) {
|
|
5085
|
+
const { project_id, ...query } = params;
|
|
5086
|
+
return this._client.getAPIList(path `/projects/${project_id}/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5087
|
+
}
|
|
5088
|
+
/**
|
|
5089
|
+
* Unassigns a project role from a group within a project.
|
|
5090
|
+
*
|
|
5091
|
+
* @example
|
|
5092
|
+
* ```ts
|
|
5093
|
+
* const role =
|
|
5094
|
+
* await client.admin.organization.projects.groups.roles.delete(
|
|
5095
|
+
* 'role_id',
|
|
5096
|
+
* { project_id: 'project_id', group_id: 'group_id' },
|
|
5097
|
+
* );
|
|
5098
|
+
* ```
|
|
5099
|
+
*/
|
|
5100
|
+
delete(roleID, params, options) {
|
|
5101
|
+
const { project_id, group_id } = params;
|
|
5102
|
+
return this._client.delete(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
|
|
5103
|
+
...options,
|
|
5104
|
+
__security: { adminAPIKeyAuth: true },
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
};
|
|
5108
|
+
|
|
5109
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5110
|
+
class Groups extends APIResource {
|
|
5111
|
+
constructor() {
|
|
5112
|
+
super(...arguments);
|
|
5113
|
+
this.roles = new Roles$2(this._client);
|
|
5114
|
+
}
|
|
5115
|
+
/**
|
|
5116
|
+
* Grants a group access to a project.
|
|
5117
|
+
*
|
|
5118
|
+
* @example
|
|
5119
|
+
* ```ts
|
|
5120
|
+
* const projectGroup =
|
|
5121
|
+
* await client.admin.organization.projects.groups.create(
|
|
5122
|
+
* 'project_id',
|
|
5123
|
+
* { group_id: 'group_id', role: 'role' },
|
|
5124
|
+
* );
|
|
5125
|
+
* ```
|
|
5126
|
+
*/
|
|
5127
|
+
create(projectID, body, options) {
|
|
5128
|
+
return this._client.post(path `/organization/projects/${projectID}/groups`, {
|
|
5129
|
+
body,
|
|
5130
|
+
...options,
|
|
5131
|
+
__security: { adminAPIKeyAuth: true },
|
|
5132
|
+
});
|
|
5133
|
+
}
|
|
5134
|
+
/**
|
|
5135
|
+
* Lists the groups that have access to a project.
|
|
5136
|
+
*
|
|
5137
|
+
* @example
|
|
5138
|
+
* ```ts
|
|
5139
|
+
* // Automatically fetches more pages as needed.
|
|
5140
|
+
* for await (const projectGroup of client.admin.organization.projects.groups.list(
|
|
5141
|
+
* 'project_id',
|
|
5142
|
+
* )) {
|
|
5143
|
+
* // ...
|
|
5144
|
+
* }
|
|
5145
|
+
* ```
|
|
5146
|
+
*/
|
|
5147
|
+
list(projectID, query = {}, options) {
|
|
5148
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/groups`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5149
|
+
}
|
|
5150
|
+
/**
|
|
5151
|
+
* Revokes a group's access to a project.
|
|
5152
|
+
*
|
|
5153
|
+
* @example
|
|
5154
|
+
* ```ts
|
|
5155
|
+
* const group =
|
|
5156
|
+
* await client.admin.organization.projects.groups.delete(
|
|
5157
|
+
* 'group_id',
|
|
5158
|
+
* { project_id: 'project_id' },
|
|
5159
|
+
* );
|
|
5160
|
+
* ```
|
|
5161
|
+
*/
|
|
5162
|
+
delete(groupID, params, options) {
|
|
5163
|
+
const { project_id } = params;
|
|
5164
|
+
return this._client.delete(path `/organization/projects/${project_id}/groups/${groupID}`, {
|
|
5165
|
+
...options,
|
|
5166
|
+
__security: { adminAPIKeyAuth: true },
|
|
5167
|
+
});
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
Groups.Roles = Roles$2;
|
|
5171
|
+
|
|
5172
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5173
|
+
let Roles$1 = class Roles extends APIResource {
|
|
5174
|
+
/**
|
|
5175
|
+
* Assigns a project role to a user within a project.
|
|
5176
|
+
*
|
|
5177
|
+
* @example
|
|
5178
|
+
* ```ts
|
|
5179
|
+
* const role =
|
|
5180
|
+
* await client.admin.organization.projects.users.roles.create(
|
|
5181
|
+
* 'user_id',
|
|
5182
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
5183
|
+
* );
|
|
5184
|
+
* ```
|
|
5185
|
+
*/
|
|
5186
|
+
create(userID, params, options) {
|
|
5187
|
+
const { project_id, ...body } = params;
|
|
5188
|
+
return this._client.post(path `/projects/${project_id}/users/${userID}/roles`, {
|
|
5189
|
+
body,
|
|
5190
|
+
...options,
|
|
5191
|
+
__security: { adminAPIKeyAuth: true },
|
|
5192
|
+
});
|
|
5193
|
+
}
|
|
5194
|
+
/**
|
|
5195
|
+
* Lists the project roles assigned to a user within a project.
|
|
5196
|
+
*
|
|
5197
|
+
* @example
|
|
5198
|
+
* ```ts
|
|
5199
|
+
* // Automatically fetches more pages as needed.
|
|
5200
|
+
* for await (const roleListResponse of client.admin.organization.projects.users.roles.list(
|
|
5201
|
+
* 'user_id',
|
|
5202
|
+
* { project_id: 'project_id' },
|
|
5203
|
+
* )) {
|
|
5204
|
+
* // ...
|
|
5205
|
+
* }
|
|
5206
|
+
* ```
|
|
5207
|
+
*/
|
|
5208
|
+
list(userID, params, options) {
|
|
5209
|
+
const { project_id, ...query } = params;
|
|
5210
|
+
return this._client.getAPIList(path `/projects/${project_id}/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5211
|
+
}
|
|
5212
|
+
/**
|
|
5213
|
+
* Unassigns a project role from a user within a project.
|
|
5214
|
+
*
|
|
5215
|
+
* @example
|
|
5216
|
+
* ```ts
|
|
5217
|
+
* const role =
|
|
5218
|
+
* await client.admin.organization.projects.users.roles.delete(
|
|
5219
|
+
* 'role_id',
|
|
5220
|
+
* { project_id: 'project_id', user_id: 'user_id' },
|
|
5221
|
+
* );
|
|
5222
|
+
* ```
|
|
5223
|
+
*/
|
|
5224
|
+
delete(roleID, params, options) {
|
|
5225
|
+
const { project_id, user_id } = params;
|
|
5226
|
+
return this._client.delete(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
|
|
5227
|
+
...options,
|
|
5228
|
+
__security: { adminAPIKeyAuth: true },
|
|
5229
|
+
});
|
|
5230
|
+
}
|
|
5231
|
+
};
|
|
5232
|
+
|
|
5233
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5234
|
+
let Users$1 = class Users extends APIResource {
|
|
5235
|
+
constructor() {
|
|
5236
|
+
super(...arguments);
|
|
5237
|
+
this.roles = new Roles$1(this._client);
|
|
5238
|
+
}
|
|
5239
|
+
/**
|
|
5240
|
+
* Adds a user to the project. Users must already be members of the organization to
|
|
5241
|
+
* be added to a project.
|
|
5242
|
+
*
|
|
5243
|
+
* @example
|
|
5244
|
+
* ```ts
|
|
5245
|
+
* const projectUser =
|
|
5246
|
+
* await client.admin.organization.projects.users.create(
|
|
5247
|
+
* 'project_id',
|
|
5248
|
+
* { role: 'role' },
|
|
5249
|
+
* );
|
|
5250
|
+
* ```
|
|
5251
|
+
*/
|
|
5252
|
+
create(projectID, body, options) {
|
|
5253
|
+
return this._client.post(path `/organization/projects/${projectID}/users`, {
|
|
5254
|
+
body,
|
|
5255
|
+
...options,
|
|
5256
|
+
__security: { adminAPIKeyAuth: true },
|
|
5257
|
+
});
|
|
5258
|
+
}
|
|
5259
|
+
/**
|
|
5260
|
+
* Retrieves a user in the project.
|
|
5261
|
+
*
|
|
5262
|
+
* @example
|
|
5263
|
+
* ```ts
|
|
5264
|
+
* const projectUser =
|
|
5265
|
+
* await client.admin.organization.projects.users.retrieve(
|
|
5266
|
+
* 'user_id',
|
|
5267
|
+
* { project_id: 'project_id' },
|
|
5268
|
+
* );
|
|
5269
|
+
* ```
|
|
5270
|
+
*/
|
|
5271
|
+
retrieve(userID, params, options) {
|
|
5272
|
+
const { project_id } = params;
|
|
5273
|
+
return this._client.get(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
5274
|
+
...options,
|
|
5275
|
+
__security: { adminAPIKeyAuth: true },
|
|
5276
|
+
});
|
|
5277
|
+
}
|
|
5278
|
+
/**
|
|
5279
|
+
* Modifies a user's role in the project.
|
|
5280
|
+
*
|
|
5281
|
+
* @example
|
|
5282
|
+
* ```ts
|
|
5283
|
+
* const projectUser =
|
|
5284
|
+
* await client.admin.organization.projects.users.update(
|
|
5285
|
+
* 'user_id',
|
|
5286
|
+
* { project_id: 'project_id' },
|
|
5287
|
+
* );
|
|
5288
|
+
* ```
|
|
5289
|
+
*/
|
|
5290
|
+
update(userID, params, options) {
|
|
5291
|
+
const { project_id, ...body } = params;
|
|
5292
|
+
return this._client.post(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
5293
|
+
body,
|
|
5294
|
+
...options,
|
|
5295
|
+
__security: { adminAPIKeyAuth: true },
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
/**
|
|
5299
|
+
* Returns a list of users in the project.
|
|
5300
|
+
*
|
|
5301
|
+
* @example
|
|
5302
|
+
* ```ts
|
|
5303
|
+
* // Automatically fetches more pages as needed.
|
|
5304
|
+
* for await (const projectUser of client.admin.organization.projects.users.list(
|
|
5305
|
+
* 'project_id',
|
|
5306
|
+
* )) {
|
|
5307
|
+
* // ...
|
|
5308
|
+
* }
|
|
5309
|
+
* ```
|
|
5310
|
+
*/
|
|
5311
|
+
list(projectID, query = {}, options) {
|
|
5312
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/users`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5313
|
+
}
|
|
5314
|
+
/**
|
|
5315
|
+
* Deletes a user from the project.
|
|
5316
|
+
*
|
|
5317
|
+
* Returns confirmation of project user deletion, or an error if the project is
|
|
5318
|
+
* archived (archived projects have no users).
|
|
5319
|
+
*
|
|
5320
|
+
* @example
|
|
5321
|
+
* ```ts
|
|
5322
|
+
* const user =
|
|
5323
|
+
* await client.admin.organization.projects.users.delete(
|
|
5324
|
+
* 'user_id',
|
|
5325
|
+
* { project_id: 'project_id' },
|
|
5326
|
+
* );
|
|
5327
|
+
* ```
|
|
5328
|
+
*/
|
|
5329
|
+
delete(userID, params, options) {
|
|
5330
|
+
const { project_id } = params;
|
|
5331
|
+
return this._client.delete(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
5332
|
+
...options,
|
|
5333
|
+
__security: { adminAPIKeyAuth: true },
|
|
5334
|
+
});
|
|
5335
|
+
}
|
|
5336
|
+
};
|
|
5337
|
+
Users$1.Roles = Roles$1;
|
|
5338
|
+
|
|
5339
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5340
|
+
class Projects extends APIResource {
|
|
5341
|
+
constructor() {
|
|
5342
|
+
super(...arguments);
|
|
5343
|
+
this.users = new Users$1(this._client);
|
|
5344
|
+
this.serviceAccounts = new ServiceAccounts(this._client);
|
|
5345
|
+
this.apiKeys = new APIKeys(this._client);
|
|
5346
|
+
this.rateLimits = new RateLimits(this._client);
|
|
5347
|
+
this.groups = new Groups(this._client);
|
|
5348
|
+
this.roles = new Roles$3(this._client);
|
|
5349
|
+
this.certificates = new Certificates(this._client);
|
|
5350
|
+
}
|
|
5351
|
+
/**
|
|
5352
|
+
* Create a new project in the organization. Projects can be created and archived,
|
|
5353
|
+
* but cannot be deleted.
|
|
5354
|
+
*
|
|
5355
|
+
* @example
|
|
5356
|
+
* ```ts
|
|
5357
|
+
* const project =
|
|
5358
|
+
* await client.admin.organization.projects.create({
|
|
5359
|
+
* name: 'name',
|
|
5360
|
+
* });
|
|
5361
|
+
* ```
|
|
5362
|
+
*/
|
|
5363
|
+
create(body, options) {
|
|
5364
|
+
return this._client.post('/organization/projects', {
|
|
5365
|
+
body,
|
|
5366
|
+
...options,
|
|
5367
|
+
__security: { adminAPIKeyAuth: true },
|
|
5368
|
+
});
|
|
5369
|
+
}
|
|
5370
|
+
/**
|
|
5371
|
+
* Retrieves a project.
|
|
5372
|
+
*
|
|
5373
|
+
* @example
|
|
5374
|
+
* ```ts
|
|
5375
|
+
* const project =
|
|
5376
|
+
* await client.admin.organization.projects.retrieve(
|
|
5377
|
+
* 'project_id',
|
|
5378
|
+
* );
|
|
5379
|
+
* ```
|
|
5380
|
+
*/
|
|
5381
|
+
retrieve(projectID, options) {
|
|
5382
|
+
return this._client.get(path `/organization/projects/${projectID}`, {
|
|
5383
|
+
...options,
|
|
5384
|
+
__security: { adminAPIKeyAuth: true },
|
|
5385
|
+
});
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* Modifies a project in the organization.
|
|
5389
|
+
*
|
|
5390
|
+
* @example
|
|
5391
|
+
* ```ts
|
|
5392
|
+
* const project =
|
|
5393
|
+
* await client.admin.organization.projects.update(
|
|
5394
|
+
* 'project_id',
|
|
5395
|
+
* );
|
|
5396
|
+
* ```
|
|
5397
|
+
*/
|
|
5398
|
+
update(projectID, body, options) {
|
|
5399
|
+
return this._client.post(path `/organization/projects/${projectID}`, {
|
|
5400
|
+
body,
|
|
5401
|
+
...options,
|
|
5402
|
+
__security: { adminAPIKeyAuth: true },
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
/**
|
|
5406
|
+
* Returns a list of projects.
|
|
5407
|
+
*
|
|
5408
|
+
* @example
|
|
5409
|
+
* ```ts
|
|
5410
|
+
* // Automatically fetches more pages as needed.
|
|
5411
|
+
* for await (const project of client.admin.organization.projects.list()) {
|
|
5412
|
+
* // ...
|
|
5413
|
+
* }
|
|
5414
|
+
* ```
|
|
5415
|
+
*/
|
|
5416
|
+
list(query = {}, options) {
|
|
5417
|
+
return this._client.getAPIList('/organization/projects', (ConversationCursorPage), {
|
|
5418
|
+
query,
|
|
5419
|
+
...options,
|
|
5420
|
+
__security: { adminAPIKeyAuth: true },
|
|
5421
|
+
});
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Archives a project in the organization. Archived projects cannot be used or
|
|
5425
|
+
* updated.
|
|
5426
|
+
*
|
|
5427
|
+
* @example
|
|
5428
|
+
* ```ts
|
|
5429
|
+
* const project =
|
|
5430
|
+
* await client.admin.organization.projects.archive(
|
|
5431
|
+
* 'project_id',
|
|
5432
|
+
* );
|
|
5433
|
+
* ```
|
|
5434
|
+
*/
|
|
5435
|
+
archive(projectID, options) {
|
|
5436
|
+
return this._client.post(path `/organization/projects/${projectID}/archive`, {
|
|
5437
|
+
...options,
|
|
5438
|
+
__security: { adminAPIKeyAuth: true },
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
Projects.Users = Users$1;
|
|
5443
|
+
Projects.ServiceAccounts = ServiceAccounts;
|
|
5444
|
+
Projects.APIKeys = APIKeys;
|
|
5445
|
+
Projects.RateLimits = RateLimits;
|
|
5446
|
+
Projects.Groups = Groups;
|
|
5447
|
+
Projects.Roles = Roles$3;
|
|
5448
|
+
Projects.Certificates = Certificates;
|
|
5449
|
+
|
|
5450
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5451
|
+
class Roles extends APIResource {
|
|
5452
|
+
/**
|
|
5453
|
+
* Assigns an organization role to a user within the organization.
|
|
5454
|
+
*
|
|
5455
|
+
* @example
|
|
5456
|
+
* ```ts
|
|
5457
|
+
* const role =
|
|
5458
|
+
* await client.admin.organization.users.roles.create(
|
|
5459
|
+
* 'user_id',
|
|
5460
|
+
* { role_id: 'role_id' },
|
|
5461
|
+
* );
|
|
5462
|
+
* ```
|
|
5463
|
+
*/
|
|
5464
|
+
create(userID, body, options) {
|
|
5465
|
+
return this._client.post(path `/organization/users/${userID}/roles`, {
|
|
5466
|
+
body,
|
|
5467
|
+
...options,
|
|
5468
|
+
__security: { adminAPIKeyAuth: true },
|
|
5469
|
+
});
|
|
5470
|
+
}
|
|
5471
|
+
/**
|
|
5472
|
+
* Lists the organization roles assigned to a user within the organization.
|
|
5473
|
+
*
|
|
5474
|
+
* @example
|
|
5475
|
+
* ```ts
|
|
5476
|
+
* // Automatically fetches more pages as needed.
|
|
5477
|
+
* for await (const roleListResponse of client.admin.organization.users.roles.list(
|
|
5478
|
+
* 'user_id',
|
|
5479
|
+
* )) {
|
|
5480
|
+
* // ...
|
|
5481
|
+
* }
|
|
5482
|
+
* ```
|
|
5483
|
+
*/
|
|
5484
|
+
list(userID, query = {}, options) {
|
|
5485
|
+
return this._client.getAPIList(path `/organization/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5486
|
+
}
|
|
5487
|
+
/**
|
|
5488
|
+
* Unassigns an organization role from a user within the organization.
|
|
5489
|
+
*
|
|
5490
|
+
* @example
|
|
5491
|
+
* ```ts
|
|
5492
|
+
* const role =
|
|
5493
|
+
* await client.admin.organization.users.roles.delete(
|
|
5494
|
+
* 'role_id',
|
|
5495
|
+
* { user_id: 'user_id' },
|
|
5496
|
+
* );
|
|
5497
|
+
* ```
|
|
5498
|
+
*/
|
|
5499
|
+
delete(roleID, params, options) {
|
|
5500
|
+
const { user_id } = params;
|
|
5501
|
+
return this._client.delete(path `/organization/users/${user_id}/roles/${roleID}`, {
|
|
3819
5502
|
...options,
|
|
3820
|
-
|
|
3821
|
-
};
|
|
3822
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
3823
|
-
return runner;
|
|
5503
|
+
__security: { adminAPIKeyAuth: true },
|
|
5504
|
+
});
|
|
3824
5505
|
}
|
|
3825
5506
|
}
|
|
3826
5507
|
|
|
3827
5508
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3828
|
-
|
|
3829
|
-
* Given a list of messages comprising a conversation, the model will return a response.
|
|
3830
|
-
*/
|
|
3831
|
-
let Completions$1 = class Completions extends APIResource {
|
|
5509
|
+
class Users extends APIResource {
|
|
3832
5510
|
constructor() {
|
|
3833
5511
|
super(...arguments);
|
|
3834
|
-
this.
|
|
3835
|
-
}
|
|
3836
|
-
create(body, options) {
|
|
3837
|
-
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false });
|
|
5512
|
+
this.roles = new Roles(this._client);
|
|
3838
5513
|
}
|
|
3839
5514
|
/**
|
|
3840
|
-
*
|
|
3841
|
-
* the `store` parameter set to `true` will be returned.
|
|
5515
|
+
* Retrieves a user by their identifier.
|
|
3842
5516
|
*
|
|
3843
5517
|
* @example
|
|
3844
5518
|
* ```ts
|
|
3845
|
-
* const
|
|
3846
|
-
* await client.
|
|
5519
|
+
* const organizationUser =
|
|
5520
|
+
* await client.admin.organization.users.retrieve('user_id');
|
|
3847
5521
|
* ```
|
|
3848
5522
|
*/
|
|
3849
|
-
retrieve(
|
|
3850
|
-
return this._client.get(path `/
|
|
5523
|
+
retrieve(userID, options) {
|
|
5524
|
+
return this._client.get(path `/organization/users/${userID}`, {
|
|
5525
|
+
...options,
|
|
5526
|
+
__security: { adminAPIKeyAuth: true },
|
|
5527
|
+
});
|
|
3851
5528
|
}
|
|
3852
5529
|
/**
|
|
3853
|
-
*
|
|
3854
|
-
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
3855
|
-
* supported modification is to update the `metadata` field.
|
|
5530
|
+
* Modifies a user's role in the organization.
|
|
3856
5531
|
*
|
|
3857
5532
|
* @example
|
|
3858
5533
|
* ```ts
|
|
3859
|
-
* const
|
|
3860
|
-
* '
|
|
3861
|
-
* { metadata: { foo: 'string' } },
|
|
3862
|
-
* );
|
|
5534
|
+
* const organizationUser =
|
|
5535
|
+
* await client.admin.organization.users.update('user_id');
|
|
3863
5536
|
* ```
|
|
3864
5537
|
*/
|
|
3865
|
-
update(
|
|
3866
|
-
return this._client.post(path `/
|
|
5538
|
+
update(userID, body, options) {
|
|
5539
|
+
return this._client.post(path `/organization/users/${userID}`, {
|
|
5540
|
+
body,
|
|
5541
|
+
...options,
|
|
5542
|
+
__security: { adminAPIKeyAuth: true },
|
|
5543
|
+
});
|
|
3867
5544
|
}
|
|
3868
5545
|
/**
|
|
3869
|
-
*
|
|
3870
|
-
* the `store` parameter set to `true` will be returned.
|
|
5546
|
+
* Lists all of the users in the organization.
|
|
3871
5547
|
*
|
|
3872
5548
|
* @example
|
|
3873
5549
|
* ```ts
|
|
3874
5550
|
* // Automatically fetches more pages as needed.
|
|
3875
|
-
* for await (const
|
|
5551
|
+
* for await (const organizationUser of client.admin.organization.users.list()) {
|
|
3876
5552
|
* // ...
|
|
3877
5553
|
* }
|
|
3878
5554
|
* ```
|
|
3879
5555
|
*/
|
|
3880
5556
|
list(query = {}, options) {
|
|
3881
|
-
return this._client.getAPIList('/
|
|
5557
|
+
return this._client.getAPIList('/organization/users', (ConversationCursorPage), {
|
|
5558
|
+
query,
|
|
5559
|
+
...options,
|
|
5560
|
+
__security: { adminAPIKeyAuth: true },
|
|
5561
|
+
});
|
|
3882
5562
|
}
|
|
3883
5563
|
/**
|
|
3884
|
-
*
|
|
3885
|
-
* with the `store` parameter set to `true` can be deleted.
|
|
5564
|
+
* Deletes a user from the organization.
|
|
3886
5565
|
*
|
|
3887
5566
|
* @example
|
|
3888
5567
|
* ```ts
|
|
3889
|
-
* const
|
|
3890
|
-
*
|
|
5568
|
+
* const user = await client.admin.organization.users.delete(
|
|
5569
|
+
* 'user_id',
|
|
5570
|
+
* );
|
|
3891
5571
|
* ```
|
|
3892
5572
|
*/
|
|
3893
|
-
delete(
|
|
3894
|
-
return this._client.delete(path `/
|
|
3895
|
-
}
|
|
3896
|
-
parse(body, options) {
|
|
3897
|
-
validateInputTools(body.tools);
|
|
3898
|
-
return this._client.chat.completions
|
|
3899
|
-
.create(body, {
|
|
5573
|
+
delete(userID, options) {
|
|
5574
|
+
return this._client.delete(path `/organization/users/${userID}`, {
|
|
3900
5575
|
...options,
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
3904
|
-
},
|
|
3905
|
-
})
|
|
3906
|
-
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
3907
|
-
}
|
|
3908
|
-
runTools(body, options) {
|
|
3909
|
-
if (body.stream) {
|
|
3910
|
-
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
3911
|
-
}
|
|
3912
|
-
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
3913
|
-
}
|
|
3914
|
-
/**
|
|
3915
|
-
* Creates a chat completion stream
|
|
3916
|
-
*/
|
|
3917
|
-
stream(body, options) {
|
|
3918
|
-
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
5576
|
+
__security: { adminAPIKeyAuth: true },
|
|
5577
|
+
});
|
|
3919
5578
|
}
|
|
3920
|
-
}
|
|
3921
|
-
|
|
5579
|
+
}
|
|
5580
|
+
Users.Roles = Roles;
|
|
3922
5581
|
|
|
3923
5582
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3924
|
-
class
|
|
5583
|
+
class Organization extends APIResource {
|
|
3925
5584
|
constructor() {
|
|
3926
5585
|
super(...arguments);
|
|
3927
|
-
this.
|
|
5586
|
+
this.auditLogs = new AuditLogs(this._client);
|
|
5587
|
+
this.adminAPIKeys = new AdminAPIKeys(this._client);
|
|
5588
|
+
this.usage = new Usage(this._client);
|
|
5589
|
+
this.invites = new Invites(this._client);
|
|
5590
|
+
this.users = new Users(this._client);
|
|
5591
|
+
this.groups = new Groups$1(this._client);
|
|
5592
|
+
this.roles = new Roles$5(this._client);
|
|
5593
|
+
this.certificates = new Certificates$1(this._client);
|
|
5594
|
+
this.projects = new Projects(this._client);
|
|
5595
|
+
}
|
|
5596
|
+
}
|
|
5597
|
+
Organization.AuditLogs = AuditLogs;
|
|
5598
|
+
Organization.AdminAPIKeys = AdminAPIKeys;
|
|
5599
|
+
Organization.Usage = Usage;
|
|
5600
|
+
Organization.Invites = Invites;
|
|
5601
|
+
Organization.Users = Users;
|
|
5602
|
+
Organization.Groups = Groups$1;
|
|
5603
|
+
Organization.Roles = Roles$5;
|
|
5604
|
+
Organization.Certificates = Certificates$1;
|
|
5605
|
+
Organization.Projects = Projects;
|
|
5606
|
+
|
|
5607
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5608
|
+
class Admin extends APIResource {
|
|
5609
|
+
constructor() {
|
|
5610
|
+
super(...arguments);
|
|
5611
|
+
this.organization = new Organization(this._client);
|
|
3928
5612
|
}
|
|
3929
5613
|
}
|
|
3930
|
-
|
|
5614
|
+
Admin.Organization = Organization;
|
|
3931
5615
|
|
|
3932
5616
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3933
5617
|
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
|
|
@@ -4024,6 +5708,7 @@ class Speech extends APIResource {
|
|
|
4024
5708
|
body,
|
|
4025
5709
|
...options,
|
|
4026
5710
|
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
5711
|
+
__security: { bearerAuth: true },
|
|
4027
5712
|
__binaryResponse: true,
|
|
4028
5713
|
});
|
|
4029
5714
|
}
|
|
@@ -4040,6 +5725,7 @@ class Transcriptions extends APIResource {
|
|
|
4040
5725
|
...options,
|
|
4041
5726
|
stream: body.stream ?? false,
|
|
4042
5727
|
__metadata: { model: body.model },
|
|
5728
|
+
__security: { bearerAuth: true },
|
|
4043
5729
|
}, this._client));
|
|
4044
5730
|
}
|
|
4045
5731
|
}
|
|
@@ -4050,7 +5736,7 @@ class Transcriptions extends APIResource {
|
|
|
4050
5736
|
*/
|
|
4051
5737
|
class Translations extends APIResource {
|
|
4052
5738
|
create(body, options) {
|
|
4053
|
-
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
5739
|
+
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
|
|
4054
5740
|
}
|
|
4055
5741
|
}
|
|
4056
5742
|
|
|
@@ -4076,19 +5762,23 @@ class Batches extends APIResource {
|
|
|
4076
5762
|
* Creates and executes a batch from an uploaded file of requests
|
|
4077
5763
|
*/
|
|
4078
5764
|
create(body, options) {
|
|
4079
|
-
return this._client.post('/batches', { body, ...options });
|
|
5765
|
+
return this._client.post('/batches', { body, ...options, __security: { bearerAuth: true } });
|
|
4080
5766
|
}
|
|
4081
5767
|
/**
|
|
4082
5768
|
* Retrieves a batch.
|
|
4083
5769
|
*/
|
|
4084
5770
|
retrieve(batchID, options) {
|
|
4085
|
-
return this._client.get(path `/batches/${batchID}`, options);
|
|
5771
|
+
return this._client.get(path `/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
|
|
4086
5772
|
}
|
|
4087
5773
|
/**
|
|
4088
5774
|
* List your organization's batches.
|
|
4089
5775
|
*/
|
|
4090
5776
|
list(query = {}, options) {
|
|
4091
|
-
return this._client.getAPIList('/batches', (CursorPage), {
|
|
5777
|
+
return this._client.getAPIList('/batches', (CursorPage), {
|
|
5778
|
+
query,
|
|
5779
|
+
...options,
|
|
5780
|
+
__security: { bearerAuth: true },
|
|
5781
|
+
});
|
|
4092
5782
|
}
|
|
4093
5783
|
/**
|
|
4094
5784
|
* Cancels an in-progress batch. The batch will be in status `cancelling` for up to
|
|
@@ -4096,7 +5786,10 @@ class Batches extends APIResource {
|
|
|
4096
5786
|
* (if any) available in the output file.
|
|
4097
5787
|
*/
|
|
4098
5788
|
cancel(batchID, options) {
|
|
4099
|
-
return this._client.post(path `/batches/${batchID}/cancel`,
|
|
5789
|
+
return this._client.post(path `/batches/${batchID}/cancel`, {
|
|
5790
|
+
...options,
|
|
5791
|
+
__security: { bearerAuth: true },
|
|
5792
|
+
});
|
|
4100
5793
|
}
|
|
4101
5794
|
}
|
|
4102
5795
|
|
|
@@ -4115,6 +5808,7 @@ class Assistants extends APIResource {
|
|
|
4115
5808
|
body,
|
|
4116
5809
|
...options,
|
|
4117
5810
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5811
|
+
__security: { bearerAuth: true },
|
|
4118
5812
|
});
|
|
4119
5813
|
}
|
|
4120
5814
|
/**
|
|
@@ -4126,6 +5820,7 @@ class Assistants extends APIResource {
|
|
|
4126
5820
|
return this._client.get(path `/assistants/${assistantID}`, {
|
|
4127
5821
|
...options,
|
|
4128
5822
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5823
|
+
__security: { bearerAuth: true },
|
|
4129
5824
|
});
|
|
4130
5825
|
}
|
|
4131
5826
|
/**
|
|
@@ -4138,6 +5833,7 @@ class Assistants extends APIResource {
|
|
|
4138
5833
|
body,
|
|
4139
5834
|
...options,
|
|
4140
5835
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5836
|
+
__security: { bearerAuth: true },
|
|
4141
5837
|
});
|
|
4142
5838
|
}
|
|
4143
5839
|
/**
|
|
@@ -4150,6 +5846,7 @@ class Assistants extends APIResource {
|
|
|
4150
5846
|
query,
|
|
4151
5847
|
...options,
|
|
4152
5848
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5849
|
+
__security: { bearerAuth: true },
|
|
4153
5850
|
});
|
|
4154
5851
|
}
|
|
4155
5852
|
/**
|
|
@@ -4161,6 +5858,7 @@ class Assistants extends APIResource {
|
|
|
4161
5858
|
return this._client.delete(path `/assistants/${assistantID}`, {
|
|
4162
5859
|
...options,
|
|
4163
5860
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5861
|
+
__security: { bearerAuth: true },
|
|
4164
5862
|
});
|
|
4165
5863
|
}
|
|
4166
5864
|
}
|
|
@@ -4187,6 +5885,7 @@ let Sessions$1 = class Sessions extends APIResource {
|
|
|
4187
5885
|
body,
|
|
4188
5886
|
...options,
|
|
4189
5887
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5888
|
+
__security: { bearerAuth: true },
|
|
4190
5889
|
});
|
|
4191
5890
|
}
|
|
4192
5891
|
};
|
|
@@ -4213,6 +5912,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
4213
5912
|
body,
|
|
4214
5913
|
...options,
|
|
4215
5914
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5915
|
+
__security: { bearerAuth: true },
|
|
4216
5916
|
});
|
|
4217
5917
|
}
|
|
4218
5918
|
}
|
|
@@ -4250,6 +5950,7 @@ class Sessions extends APIResource {
|
|
|
4250
5950
|
body,
|
|
4251
5951
|
...options,
|
|
4252
5952
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5953
|
+
__security: { bearerAuth: true },
|
|
4253
5954
|
});
|
|
4254
5955
|
}
|
|
4255
5956
|
/**
|
|
@@ -4267,6 +5968,7 @@ class Sessions extends APIResource {
|
|
|
4267
5968
|
return this._client.post(path `/chatkit/sessions/${sessionID}/cancel`, {
|
|
4268
5969
|
...options,
|
|
4269
5970
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5971
|
+
__security: { bearerAuth: true },
|
|
4270
5972
|
});
|
|
4271
5973
|
}
|
|
4272
5974
|
}
|
|
@@ -4286,6 +5988,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
4286
5988
|
return this._client.get(path `/chatkit/threads/${threadID}`, {
|
|
4287
5989
|
...options,
|
|
4288
5990
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5991
|
+
__security: { bearerAuth: true },
|
|
4289
5992
|
});
|
|
4290
5993
|
}
|
|
4291
5994
|
/**
|
|
@@ -4304,6 +6007,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
4304
6007
|
query,
|
|
4305
6008
|
...options,
|
|
4306
6009
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6010
|
+
__security: { bearerAuth: true },
|
|
4307
6011
|
});
|
|
4308
6012
|
}
|
|
4309
6013
|
/**
|
|
@@ -4320,6 +6024,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
4320
6024
|
return this._client.delete(path `/chatkit/threads/${threadID}`, {
|
|
4321
6025
|
...options,
|
|
4322
6026
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6027
|
+
__security: { bearerAuth: true },
|
|
4323
6028
|
});
|
|
4324
6029
|
}
|
|
4325
6030
|
/**
|
|
@@ -4336,7 +6041,12 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
4336
6041
|
* ```
|
|
4337
6042
|
*/
|
|
4338
6043
|
listItems(threadID, query = {}, options) {
|
|
4339
|
-
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
6044
|
+
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
6045
|
+
query,
|
|
6046
|
+
...options,
|
|
6047
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6048
|
+
__security: { bearerAuth: true },
|
|
6049
|
+
});
|
|
4340
6050
|
}
|
|
4341
6051
|
};
|
|
4342
6052
|
|
|
@@ -4368,6 +6078,7 @@ class Messages extends APIResource {
|
|
|
4368
6078
|
body,
|
|
4369
6079
|
...options,
|
|
4370
6080
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6081
|
+
__security: { bearerAuth: true },
|
|
4371
6082
|
});
|
|
4372
6083
|
}
|
|
4373
6084
|
/**
|
|
@@ -4380,6 +6091,7 @@ class Messages extends APIResource {
|
|
|
4380
6091
|
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
4381
6092
|
...options,
|
|
4382
6093
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6094
|
+
__security: { bearerAuth: true },
|
|
4383
6095
|
});
|
|
4384
6096
|
}
|
|
4385
6097
|
/**
|
|
@@ -4393,6 +6105,7 @@ class Messages extends APIResource {
|
|
|
4393
6105
|
body,
|
|
4394
6106
|
...options,
|
|
4395
6107
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6108
|
+
__security: { bearerAuth: true },
|
|
4396
6109
|
});
|
|
4397
6110
|
}
|
|
4398
6111
|
/**
|
|
@@ -4405,6 +6118,7 @@ class Messages extends APIResource {
|
|
|
4405
6118
|
query,
|
|
4406
6119
|
...options,
|
|
4407
6120
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6121
|
+
__security: { bearerAuth: true },
|
|
4408
6122
|
});
|
|
4409
6123
|
}
|
|
4410
6124
|
/**
|
|
@@ -4417,6 +6131,7 @@ class Messages extends APIResource {
|
|
|
4417
6131
|
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
4418
6132
|
...options,
|
|
4419
6133
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6134
|
+
__security: { bearerAuth: true },
|
|
4420
6135
|
});
|
|
4421
6136
|
}
|
|
4422
6137
|
}
|
|
@@ -4439,6 +6154,7 @@ class Steps extends APIResource {
|
|
|
4439
6154
|
query,
|
|
4440
6155
|
...options,
|
|
4441
6156
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6157
|
+
__security: { bearerAuth: true },
|
|
4442
6158
|
});
|
|
4443
6159
|
}
|
|
4444
6160
|
/**
|
|
@@ -4452,6 +6168,7 @@ class Steps extends APIResource {
|
|
|
4452
6168
|
query,
|
|
4453
6169
|
...options,
|
|
4454
6170
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6171
|
+
__security: { bearerAuth: true },
|
|
4455
6172
|
});
|
|
4456
6173
|
}
|
|
4457
6174
|
}
|
|
@@ -5055,6 +6772,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5055
6772
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5056
6773
|
stream: params.stream ?? false,
|
|
5057
6774
|
__synthesizeEventData: true,
|
|
6775
|
+
__security: { bearerAuth: true },
|
|
5058
6776
|
});
|
|
5059
6777
|
}
|
|
5060
6778
|
/**
|
|
@@ -5067,6 +6785,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5067
6785
|
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
|
5068
6786
|
...options,
|
|
5069
6787
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6788
|
+
__security: { bearerAuth: true },
|
|
5070
6789
|
});
|
|
5071
6790
|
}
|
|
5072
6791
|
/**
|
|
@@ -5080,6 +6799,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5080
6799
|
body,
|
|
5081
6800
|
...options,
|
|
5082
6801
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6802
|
+
__security: { bearerAuth: true },
|
|
5083
6803
|
});
|
|
5084
6804
|
}
|
|
5085
6805
|
/**
|
|
@@ -5092,6 +6812,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5092
6812
|
query,
|
|
5093
6813
|
...options,
|
|
5094
6814
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6815
|
+
__security: { bearerAuth: true },
|
|
5095
6816
|
});
|
|
5096
6817
|
}
|
|
5097
6818
|
/**
|
|
@@ -5104,6 +6825,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5104
6825
|
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
5105
6826
|
...options,
|
|
5106
6827
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6828
|
+
__security: { bearerAuth: true },
|
|
5107
6829
|
});
|
|
5108
6830
|
}
|
|
5109
6831
|
/**
|
|
@@ -5186,6 +6908,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5186
6908
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5187
6909
|
stream: params.stream ?? false,
|
|
5188
6910
|
__synthesizeEventData: true,
|
|
6911
|
+
__security: { bearerAuth: true },
|
|
5189
6912
|
});
|
|
5190
6913
|
}
|
|
5191
6914
|
/**
|
|
@@ -5230,6 +6953,7 @@ class Threads extends APIResource {
|
|
|
5230
6953
|
body,
|
|
5231
6954
|
...options,
|
|
5232
6955
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6956
|
+
__security: { bearerAuth: true },
|
|
5233
6957
|
});
|
|
5234
6958
|
}
|
|
5235
6959
|
/**
|
|
@@ -5241,6 +6965,7 @@ class Threads extends APIResource {
|
|
|
5241
6965
|
return this._client.get(path `/threads/${threadID}`, {
|
|
5242
6966
|
...options,
|
|
5243
6967
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6968
|
+
__security: { bearerAuth: true },
|
|
5244
6969
|
});
|
|
5245
6970
|
}
|
|
5246
6971
|
/**
|
|
@@ -5253,6 +6978,7 @@ class Threads extends APIResource {
|
|
|
5253
6978
|
body,
|
|
5254
6979
|
...options,
|
|
5255
6980
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6981
|
+
__security: { bearerAuth: true },
|
|
5256
6982
|
});
|
|
5257
6983
|
}
|
|
5258
6984
|
/**
|
|
@@ -5264,6 +6990,7 @@ class Threads extends APIResource {
|
|
|
5264
6990
|
return this._client.delete(path `/threads/${threadID}`, {
|
|
5265
6991
|
...options,
|
|
5266
6992
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6993
|
+
__security: { bearerAuth: true },
|
|
5267
6994
|
});
|
|
5268
6995
|
}
|
|
5269
6996
|
createAndRun(body, options) {
|
|
@@ -5273,6 +7000,7 @@ class Threads extends APIResource {
|
|
|
5273
7000
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5274
7001
|
stream: body.stream ?? false,
|
|
5275
7002
|
__synthesizeEventData: true,
|
|
7003
|
+
__security: { bearerAuth: true },
|
|
5276
7004
|
});
|
|
5277
7005
|
}
|
|
5278
7006
|
/**
|
|
@@ -5315,7 +7043,12 @@ Beta.Threads = Threads;
|
|
|
5315
7043
|
*/
|
|
5316
7044
|
class Completions extends APIResource {
|
|
5317
7045
|
create(body, options) {
|
|
5318
|
-
return this._client.post('/completions', {
|
|
7046
|
+
return this._client.post('/completions', {
|
|
7047
|
+
body,
|
|
7048
|
+
...options,
|
|
7049
|
+
stream: body.stream ?? false,
|
|
7050
|
+
__security: { bearerAuth: true },
|
|
7051
|
+
});
|
|
5319
7052
|
}
|
|
5320
7053
|
}
|
|
5321
7054
|
|
|
@@ -5329,6 +7062,7 @@ let Content$2 = class Content extends APIResource {
|
|
|
5329
7062
|
return this._client.get(path `/containers/${container_id}/files/${fileID}/content`, {
|
|
5330
7063
|
...options,
|
|
5331
7064
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
7065
|
+
__security: { bearerAuth: true },
|
|
5332
7066
|
__binaryResponse: true,
|
|
5333
7067
|
});
|
|
5334
7068
|
}
|
|
@@ -5347,14 +7081,17 @@ let Files$2 = class Files extends APIResource {
|
|
|
5347
7081
|
* a JSON request with a file ID.
|
|
5348
7082
|
*/
|
|
5349
7083
|
create(containerID, body, options) {
|
|
5350
|
-
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
7084
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
5351
7085
|
}
|
|
5352
7086
|
/**
|
|
5353
7087
|
* Retrieve Container File
|
|
5354
7088
|
*/
|
|
5355
7089
|
retrieve(fileID, params, options) {
|
|
5356
7090
|
const { container_id } = params;
|
|
5357
|
-
return this._client.get(path `/containers/${container_id}/files/${fileID}`,
|
|
7091
|
+
return this._client.get(path `/containers/${container_id}/files/${fileID}`, {
|
|
7092
|
+
...options,
|
|
7093
|
+
__security: { bearerAuth: true },
|
|
7094
|
+
});
|
|
5358
7095
|
}
|
|
5359
7096
|
/**
|
|
5360
7097
|
* List Container files
|
|
@@ -5363,6 +7100,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
5363
7100
|
return this._client.getAPIList(path `/containers/${containerID}/files`, (CursorPage), {
|
|
5364
7101
|
query,
|
|
5365
7102
|
...options,
|
|
7103
|
+
__security: { bearerAuth: true },
|
|
5366
7104
|
});
|
|
5367
7105
|
}
|
|
5368
7106
|
/**
|
|
@@ -5373,6 +7111,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
5373
7111
|
return this._client.delete(path `/containers/${container_id}/files/${fileID}`, {
|
|
5374
7112
|
...options,
|
|
5375
7113
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7114
|
+
__security: { bearerAuth: true },
|
|
5376
7115
|
});
|
|
5377
7116
|
}
|
|
5378
7117
|
};
|
|
@@ -5388,19 +7127,26 @@ class Containers extends APIResource {
|
|
|
5388
7127
|
* Create Container
|
|
5389
7128
|
*/
|
|
5390
7129
|
create(body, options) {
|
|
5391
|
-
return this._client.post('/containers', { body, ...options });
|
|
7130
|
+
return this._client.post('/containers', { body, ...options, __security: { bearerAuth: true } });
|
|
5392
7131
|
}
|
|
5393
7132
|
/**
|
|
5394
7133
|
* Retrieve Container
|
|
5395
7134
|
*/
|
|
5396
7135
|
retrieve(containerID, options) {
|
|
5397
|
-
return this._client.get(path `/containers/${containerID}`,
|
|
7136
|
+
return this._client.get(path `/containers/${containerID}`, {
|
|
7137
|
+
...options,
|
|
7138
|
+
__security: { bearerAuth: true },
|
|
7139
|
+
});
|
|
5398
7140
|
}
|
|
5399
7141
|
/**
|
|
5400
7142
|
* List Containers
|
|
5401
7143
|
*/
|
|
5402
7144
|
list(query = {}, options) {
|
|
5403
|
-
return this._client.getAPIList('/containers', (CursorPage), {
|
|
7145
|
+
return this._client.getAPIList('/containers', (CursorPage), {
|
|
7146
|
+
query,
|
|
7147
|
+
...options,
|
|
7148
|
+
__security: { bearerAuth: true },
|
|
7149
|
+
});
|
|
5404
7150
|
}
|
|
5405
7151
|
/**
|
|
5406
7152
|
* Delete Container
|
|
@@ -5409,6 +7155,7 @@ class Containers extends APIResource {
|
|
|
5409
7155
|
return this._client.delete(path `/containers/${containerID}`, {
|
|
5410
7156
|
...options,
|
|
5411
7157
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7158
|
+
__security: { bearerAuth: true },
|
|
5412
7159
|
});
|
|
5413
7160
|
}
|
|
5414
7161
|
}
|
|
@@ -5428,6 +7175,7 @@ class Items extends APIResource {
|
|
|
5428
7175
|
query: { include },
|
|
5429
7176
|
body,
|
|
5430
7177
|
...options,
|
|
7178
|
+
__security: { bearerAuth: true },
|
|
5431
7179
|
});
|
|
5432
7180
|
}
|
|
5433
7181
|
/**
|
|
@@ -5435,20 +7183,27 @@ class Items extends APIResource {
|
|
|
5435
7183
|
*/
|
|
5436
7184
|
retrieve(itemID, params, options) {
|
|
5437
7185
|
const { conversation_id, ...query } = params;
|
|
5438
|
-
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
7186
|
+
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
7187
|
+
query,
|
|
7188
|
+
...options,
|
|
7189
|
+
__security: { bearerAuth: true },
|
|
7190
|
+
});
|
|
5439
7191
|
}
|
|
5440
7192
|
/**
|
|
5441
7193
|
* List all items for a conversation with the given ID.
|
|
5442
7194
|
*/
|
|
5443
7195
|
list(conversationID, query = {}, options) {
|
|
5444
|
-
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
|
|
7196
|
+
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5445
7197
|
}
|
|
5446
7198
|
/**
|
|
5447
7199
|
* Delete an item from a conversation with the given IDs.
|
|
5448
7200
|
*/
|
|
5449
7201
|
delete(itemID, params, options) {
|
|
5450
7202
|
const { conversation_id } = params;
|
|
5451
|
-
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`,
|
|
7203
|
+
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
7204
|
+
...options,
|
|
7205
|
+
__security: { bearerAuth: true },
|
|
7206
|
+
});
|
|
5452
7207
|
}
|
|
5453
7208
|
}
|
|
5454
7209
|
|
|
@@ -5465,25 +7220,35 @@ class Conversations extends APIResource {
|
|
|
5465
7220
|
* Create a conversation.
|
|
5466
7221
|
*/
|
|
5467
7222
|
create(body = {}, options) {
|
|
5468
|
-
return this._client.post('/conversations', { body, ...options });
|
|
7223
|
+
return this._client.post('/conversations', { body, ...options, __security: { bearerAuth: true } });
|
|
5469
7224
|
}
|
|
5470
7225
|
/**
|
|
5471
7226
|
* Get a conversation
|
|
5472
7227
|
*/
|
|
5473
7228
|
retrieve(conversationID, options) {
|
|
5474
|
-
return this._client.get(path `/conversations/${conversationID}`,
|
|
7229
|
+
return this._client.get(path `/conversations/${conversationID}`, {
|
|
7230
|
+
...options,
|
|
7231
|
+
__security: { bearerAuth: true },
|
|
7232
|
+
});
|
|
5475
7233
|
}
|
|
5476
7234
|
/**
|
|
5477
7235
|
* Update a conversation
|
|
5478
7236
|
*/
|
|
5479
7237
|
update(conversationID, body, options) {
|
|
5480
|
-
return this._client.post(path `/conversations/${conversationID}`, {
|
|
7238
|
+
return this._client.post(path `/conversations/${conversationID}`, {
|
|
7239
|
+
body,
|
|
7240
|
+
...options,
|
|
7241
|
+
__security: { bearerAuth: true },
|
|
7242
|
+
});
|
|
5481
7243
|
}
|
|
5482
7244
|
/**
|
|
5483
7245
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
5484
7246
|
*/
|
|
5485
7247
|
delete(conversationID, options) {
|
|
5486
|
-
return this._client.delete(path `/conversations/${conversationID}`,
|
|
7248
|
+
return this._client.delete(path `/conversations/${conversationID}`, {
|
|
7249
|
+
...options,
|
|
7250
|
+
__security: { bearerAuth: true },
|
|
7251
|
+
});
|
|
5487
7252
|
}
|
|
5488
7253
|
}
|
|
5489
7254
|
Conversations.Items = Items;
|
|
@@ -5519,6 +7284,7 @@ class Embeddings extends APIResource {
|
|
|
5519
7284
|
encoding_format: encoding_format,
|
|
5520
7285
|
},
|
|
5521
7286
|
...options,
|
|
7287
|
+
__security: { bearerAuth: true },
|
|
5522
7288
|
});
|
|
5523
7289
|
// if the user specified an encoding_format, return the response as-is
|
|
5524
7290
|
if (hasUserProvidedEncodingFormat) {
|
|
@@ -5551,14 +7317,17 @@ class OutputItems extends APIResource {
|
|
|
5551
7317
|
*/
|
|
5552
7318
|
retrieve(outputItemID, params, options) {
|
|
5553
7319
|
const { eval_id, run_id } = params;
|
|
5554
|
-
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`,
|
|
7320
|
+
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
|
|
7321
|
+
...options,
|
|
7322
|
+
__security: { bearerAuth: true },
|
|
7323
|
+
});
|
|
5555
7324
|
}
|
|
5556
7325
|
/**
|
|
5557
7326
|
* Get a list of output items for an evaluation run.
|
|
5558
7327
|
*/
|
|
5559
7328
|
list(runID, params, options) {
|
|
5560
7329
|
const { eval_id, ...query } = params;
|
|
5561
|
-
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options });
|
|
7330
|
+
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5562
7331
|
}
|
|
5563
7332
|
}
|
|
5564
7333
|
|
|
@@ -5577,14 +7346,21 @@ class Runs extends APIResource {
|
|
|
5577
7346
|
* schema specified in the config of the evaluation.
|
|
5578
7347
|
*/
|
|
5579
7348
|
create(evalID, body, options) {
|
|
5580
|
-
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
7349
|
+
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
7350
|
+
body,
|
|
7351
|
+
...options,
|
|
7352
|
+
__security: { bearerAuth: true },
|
|
7353
|
+
});
|
|
5581
7354
|
}
|
|
5582
7355
|
/**
|
|
5583
7356
|
* Get an evaluation run by ID.
|
|
5584
7357
|
*/
|
|
5585
7358
|
retrieve(runID, params, options) {
|
|
5586
7359
|
const { eval_id } = params;
|
|
5587
|
-
return this._client.get(path `/evals/${eval_id}/runs/${runID}`,
|
|
7360
|
+
return this._client.get(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7361
|
+
...options,
|
|
7362
|
+
__security: { bearerAuth: true },
|
|
7363
|
+
});
|
|
5588
7364
|
}
|
|
5589
7365
|
/**
|
|
5590
7366
|
* Get a list of runs for an evaluation.
|
|
@@ -5593,6 +7369,7 @@ class Runs extends APIResource {
|
|
|
5593
7369
|
return this._client.getAPIList(path `/evals/${evalID}/runs`, (CursorPage), {
|
|
5594
7370
|
query,
|
|
5595
7371
|
...options,
|
|
7372
|
+
__security: { bearerAuth: true },
|
|
5596
7373
|
});
|
|
5597
7374
|
}
|
|
5598
7375
|
/**
|
|
@@ -5600,14 +7377,20 @@ class Runs extends APIResource {
|
|
|
5600
7377
|
*/
|
|
5601
7378
|
delete(runID, params, options) {
|
|
5602
7379
|
const { eval_id } = params;
|
|
5603
|
-
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`,
|
|
7380
|
+
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7381
|
+
...options,
|
|
7382
|
+
__security: { bearerAuth: true },
|
|
7383
|
+
});
|
|
5604
7384
|
}
|
|
5605
7385
|
/**
|
|
5606
7386
|
* Cancel an ongoing evaluation run.
|
|
5607
7387
|
*/
|
|
5608
7388
|
cancel(runID, params, options) {
|
|
5609
7389
|
const { eval_id } = params;
|
|
5610
|
-
return this._client.post(path `/evals/${eval_id}/runs/${runID}`,
|
|
7390
|
+
return this._client.post(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7391
|
+
...options,
|
|
7392
|
+
__security: { bearerAuth: true },
|
|
7393
|
+
});
|
|
5611
7394
|
}
|
|
5612
7395
|
}
|
|
5613
7396
|
Runs.OutputItems = OutputItems;
|
|
@@ -5630,31 +7413,35 @@ class Evals extends APIResource {
|
|
|
5630
7413
|
* the [Evals guide](https://platform.openai.com/docs/guides/evals).
|
|
5631
7414
|
*/
|
|
5632
7415
|
create(body, options) {
|
|
5633
|
-
return this._client.post('/evals', { body, ...options });
|
|
7416
|
+
return this._client.post('/evals', { body, ...options, __security: { bearerAuth: true } });
|
|
5634
7417
|
}
|
|
5635
7418
|
/**
|
|
5636
7419
|
* Get an evaluation by ID.
|
|
5637
7420
|
*/
|
|
5638
7421
|
retrieve(evalID, options) {
|
|
5639
|
-
return this._client.get(path `/evals/${evalID}`, options);
|
|
7422
|
+
return this._client.get(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
5640
7423
|
}
|
|
5641
7424
|
/**
|
|
5642
7425
|
* Update certain properties of an evaluation.
|
|
5643
7426
|
*/
|
|
5644
7427
|
update(evalID, body, options) {
|
|
5645
|
-
return this._client.post(path `/evals/${evalID}`, { body, ...options });
|
|
7428
|
+
return this._client.post(path `/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
|
|
5646
7429
|
}
|
|
5647
7430
|
/**
|
|
5648
7431
|
* List evaluations for a project.
|
|
5649
7432
|
*/
|
|
5650
7433
|
list(query = {}, options) {
|
|
5651
|
-
return this._client.getAPIList('/evals', (CursorPage), {
|
|
7434
|
+
return this._client.getAPIList('/evals', (CursorPage), {
|
|
7435
|
+
query,
|
|
7436
|
+
...options,
|
|
7437
|
+
__security: { bearerAuth: true },
|
|
7438
|
+
});
|
|
5652
7439
|
}
|
|
5653
7440
|
/**
|
|
5654
7441
|
* Delete an evaluation.
|
|
5655
7442
|
*/
|
|
5656
7443
|
delete(evalID, options) {
|
|
5657
|
-
return this._client.delete(path `/evals/${evalID}`, options);
|
|
7444
|
+
return this._client.delete(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
5658
7445
|
}
|
|
5659
7446
|
}
|
|
5660
7447
|
Evals.Runs = Runs;
|
|
@@ -5667,7 +7454,8 @@ let Files$1 = class Files extends APIResource {
|
|
|
5667
7454
|
/**
|
|
5668
7455
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
5669
7456
|
* up to 512 MB, and each project can store up to 2.5 TB of files in total. There
|
|
5670
|
-
* is no organization-wide storage limit.
|
|
7457
|
+
* is no organization-wide storage limit. Uploads to this endpoint are rate-limited
|
|
7458
|
+
* to 1,000 requests per minute per authenticated user.
|
|
5671
7459
|
*
|
|
5672
7460
|
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
5673
7461
|
* types. See the
|
|
@@ -5682,30 +7470,40 @@ let Files$1 = class Files extends APIResource {
|
|
|
5682
7470
|
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
5683
7471
|
* also has a specific required
|
|
5684
7472
|
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
7473
|
+
* - For Retrieval or `file_search` ingestion, upload files here first. If you need
|
|
7474
|
+
* to attach multiple uploaded files to the same vector store, use
|
|
7475
|
+
* [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
|
|
7476
|
+
* instead of attaching them one by one. Vector store attachment has separate
|
|
7477
|
+
* limits from file upload, including 2,000 attached files per minute per
|
|
7478
|
+
* organization.
|
|
5685
7479
|
*
|
|
5686
7480
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
5687
7481
|
* storage limits.
|
|
5688
7482
|
*/
|
|
5689
7483
|
create(body, options) {
|
|
5690
|
-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
7484
|
+
return this._client.post('/files', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
5691
7485
|
}
|
|
5692
7486
|
/**
|
|
5693
7487
|
* Returns information about a specific file.
|
|
5694
7488
|
*/
|
|
5695
7489
|
retrieve(fileID, options) {
|
|
5696
|
-
return this._client.get(path `/files/${fileID}`, options);
|
|
7490
|
+
return this._client.get(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
5697
7491
|
}
|
|
5698
7492
|
/**
|
|
5699
7493
|
* Returns a list of files.
|
|
5700
7494
|
*/
|
|
5701
7495
|
list(query = {}, options) {
|
|
5702
|
-
return this._client.getAPIList('/files', (CursorPage), {
|
|
7496
|
+
return this._client.getAPIList('/files', (CursorPage), {
|
|
7497
|
+
query,
|
|
7498
|
+
...options,
|
|
7499
|
+
__security: { bearerAuth: true },
|
|
7500
|
+
});
|
|
5703
7501
|
}
|
|
5704
7502
|
/**
|
|
5705
7503
|
* Delete a file and remove it from all vector stores.
|
|
5706
7504
|
*/
|
|
5707
7505
|
delete(fileID, options) {
|
|
5708
|
-
return this._client.delete(path `/files/${fileID}`, options);
|
|
7506
|
+
return this._client.delete(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
5709
7507
|
}
|
|
5710
7508
|
/**
|
|
5711
7509
|
* Returns the contents of the specified file.
|
|
@@ -5714,6 +7512,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
5714
7512
|
return this._client.get(path `/files/${fileID}/content`, {
|
|
5715
7513
|
...options,
|
|
5716
7514
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
7515
|
+
__security: { bearerAuth: true },
|
|
5717
7516
|
__binaryResponse: true,
|
|
5718
7517
|
});
|
|
5719
7518
|
}
|
|
@@ -5764,7 +7563,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
5764
7563
|
* ```
|
|
5765
7564
|
*/
|
|
5766
7565
|
run(body, options) {
|
|
5767
|
-
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
7566
|
+
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
7567
|
+
body,
|
|
7568
|
+
...options,
|
|
7569
|
+
__security: { bearerAuth: true },
|
|
7570
|
+
});
|
|
5768
7571
|
}
|
|
5769
7572
|
/**
|
|
5770
7573
|
* Validate a grader.
|
|
@@ -5784,7 +7587,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
5784
7587
|
* ```
|
|
5785
7588
|
*/
|
|
5786
7589
|
validate(body, options) {
|
|
5787
|
-
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
7590
|
+
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
7591
|
+
body,
|
|
7592
|
+
...options,
|
|
7593
|
+
__security: { bearerAuth: true },
|
|
7594
|
+
});
|
|
5788
7595
|
}
|
|
5789
7596
|
};
|
|
5790
7597
|
|
|
@@ -5820,7 +7627,7 @@ class Permissions extends APIResource {
|
|
|
5820
7627
|
* ```
|
|
5821
7628
|
*/
|
|
5822
7629
|
create(fineTunedModelCheckpoint, body, options) {
|
|
5823
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options });
|
|
7630
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5824
7631
|
}
|
|
5825
7632
|
/**
|
|
5826
7633
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -5834,6 +7641,7 @@ class Permissions extends APIResource {
|
|
|
5834
7641
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
5835
7642
|
query,
|
|
5836
7643
|
...options,
|
|
7644
|
+
__security: { adminAPIKeyAuth: true },
|
|
5837
7645
|
});
|
|
5838
7646
|
}
|
|
5839
7647
|
/**
|
|
@@ -5853,7 +7661,7 @@ class Permissions extends APIResource {
|
|
|
5853
7661
|
* ```
|
|
5854
7662
|
*/
|
|
5855
7663
|
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
5856
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
|
|
7664
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5857
7665
|
}
|
|
5858
7666
|
/**
|
|
5859
7667
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -5875,7 +7683,7 @@ class Permissions extends APIResource {
|
|
|
5875
7683
|
*/
|
|
5876
7684
|
delete(permissionID, params, options) {
|
|
5877
7685
|
const { fine_tuned_model_checkpoint } = params;
|
|
5878
|
-
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
|
|
7686
|
+
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
5879
7687
|
}
|
|
5880
7688
|
}
|
|
5881
7689
|
|
|
@@ -5907,7 +7715,7 @@ class Checkpoints extends APIResource {
|
|
|
5907
7715
|
* ```
|
|
5908
7716
|
*/
|
|
5909
7717
|
list(fineTuningJobID, query = {}, options) {
|
|
5910
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options });
|
|
7718
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5911
7719
|
}
|
|
5912
7720
|
}
|
|
5913
7721
|
|
|
@@ -5938,7 +7746,7 @@ class Jobs extends APIResource {
|
|
|
5938
7746
|
* ```
|
|
5939
7747
|
*/
|
|
5940
7748
|
create(body, options) {
|
|
5941
|
-
return this._client.post('/fine_tuning/jobs', { body, ...options });
|
|
7749
|
+
return this._client.post('/fine_tuning/jobs', { body, ...options, __security: { bearerAuth: true } });
|
|
5942
7750
|
}
|
|
5943
7751
|
/**
|
|
5944
7752
|
* Get info about a fine-tuning job.
|
|
@@ -5953,7 +7761,10 @@ class Jobs extends APIResource {
|
|
|
5953
7761
|
* ```
|
|
5954
7762
|
*/
|
|
5955
7763
|
retrieve(fineTuningJobID, options) {
|
|
5956
|
-
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`,
|
|
7764
|
+
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`, {
|
|
7765
|
+
...options,
|
|
7766
|
+
__security: { bearerAuth: true },
|
|
7767
|
+
});
|
|
5957
7768
|
}
|
|
5958
7769
|
/**
|
|
5959
7770
|
* List your organization's fine-tuning jobs
|
|
@@ -5967,7 +7778,11 @@ class Jobs extends APIResource {
|
|
|
5967
7778
|
* ```
|
|
5968
7779
|
*/
|
|
5969
7780
|
list(query = {}, options) {
|
|
5970
|
-
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
7781
|
+
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
7782
|
+
query,
|
|
7783
|
+
...options,
|
|
7784
|
+
__security: { bearerAuth: true },
|
|
7785
|
+
});
|
|
5971
7786
|
}
|
|
5972
7787
|
/**
|
|
5973
7788
|
* Immediately cancel a fine-tune job.
|
|
@@ -5980,7 +7795,10 @@ class Jobs extends APIResource {
|
|
|
5980
7795
|
* ```
|
|
5981
7796
|
*/
|
|
5982
7797
|
cancel(fineTuningJobID, options) {
|
|
5983
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`,
|
|
7798
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
|
|
7799
|
+
...options,
|
|
7800
|
+
__security: { bearerAuth: true },
|
|
7801
|
+
});
|
|
5984
7802
|
}
|
|
5985
7803
|
/**
|
|
5986
7804
|
* Get status updates for a fine-tuning job.
|
|
@@ -5996,7 +7814,7 @@ class Jobs extends APIResource {
|
|
|
5996
7814
|
* ```
|
|
5997
7815
|
*/
|
|
5998
7816
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
5999
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options });
|
|
7817
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6000
7818
|
}
|
|
6001
7819
|
/**
|
|
6002
7820
|
* Pause a fine-tune job.
|
|
@@ -6009,7 +7827,10 @@ class Jobs extends APIResource {
|
|
|
6009
7827
|
* ```
|
|
6010
7828
|
*/
|
|
6011
7829
|
pause(fineTuningJobID, options) {
|
|
6012
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`,
|
|
7830
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`, {
|
|
7831
|
+
...options,
|
|
7832
|
+
__security: { bearerAuth: true },
|
|
7833
|
+
});
|
|
6013
7834
|
}
|
|
6014
7835
|
/**
|
|
6015
7836
|
* Resume a fine-tune job.
|
|
@@ -6022,7 +7843,10 @@ class Jobs extends APIResource {
|
|
|
6022
7843
|
* ```
|
|
6023
7844
|
*/
|
|
6024
7845
|
resume(fineTuningJobID, options) {
|
|
6025
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`,
|
|
7846
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`, {
|
|
7847
|
+
...options,
|
|
7848
|
+
__security: { bearerAuth: true },
|
|
7849
|
+
});
|
|
6026
7850
|
}
|
|
6027
7851
|
}
|
|
6028
7852
|
Jobs.Checkpoints = Checkpoints;
|
|
@@ -6071,13 +7895,18 @@ class Images extends APIResource {
|
|
|
6071
7895
|
* ```
|
|
6072
7896
|
*/
|
|
6073
7897
|
createVariation(body, options) {
|
|
6074
|
-
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
7898
|
+
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6075
7899
|
}
|
|
6076
7900
|
edit(body, options) {
|
|
6077
|
-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
|
|
7901
|
+
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
|
|
6078
7902
|
}
|
|
6079
7903
|
generate(body, options) {
|
|
6080
|
-
return this._client.post('/images/generations', {
|
|
7904
|
+
return this._client.post('/images/generations', {
|
|
7905
|
+
body,
|
|
7906
|
+
...options,
|
|
7907
|
+
stream: body.stream ?? false,
|
|
7908
|
+
__security: { bearerAuth: true },
|
|
7909
|
+
});
|
|
6081
7910
|
}
|
|
6082
7911
|
}
|
|
6083
7912
|
|
|
@@ -6091,21 +7920,21 @@ class Models extends APIResource {
|
|
|
6091
7920
|
* the owner and permissioning.
|
|
6092
7921
|
*/
|
|
6093
7922
|
retrieve(model, options) {
|
|
6094
|
-
return this._client.get(path `/models/${model}`, options);
|
|
7923
|
+
return this._client.get(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
6095
7924
|
}
|
|
6096
7925
|
/**
|
|
6097
7926
|
* Lists the currently available models, and provides basic information about each
|
|
6098
7927
|
* one such as the owner and availability.
|
|
6099
7928
|
*/
|
|
6100
7929
|
list(options) {
|
|
6101
|
-
return this._client.getAPIList('/models', (Page), options);
|
|
7930
|
+
return this._client.getAPIList('/models', (Page), { ...options, __security: { bearerAuth: true } });
|
|
6102
7931
|
}
|
|
6103
7932
|
/**
|
|
6104
7933
|
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
6105
7934
|
* delete a model.
|
|
6106
7935
|
*/
|
|
6107
7936
|
delete(model, options) {
|
|
6108
|
-
return this._client.delete(path `/models/${model}`, options);
|
|
7937
|
+
return this._client.delete(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
6109
7938
|
}
|
|
6110
7939
|
}
|
|
6111
7940
|
|
|
@@ -6119,7 +7948,7 @@ class Moderations extends APIResource {
|
|
|
6119
7948
|
* the [moderation guide](https://platform.openai.com/docs/guides/moderation).
|
|
6120
7949
|
*/
|
|
6121
7950
|
create(body, options) {
|
|
6122
|
-
return this._client.post('/moderations', { body, ...options });
|
|
7951
|
+
return this._client.post('/moderations', { body, ...options, __security: { bearerAuth: true } });
|
|
6123
7952
|
}
|
|
6124
7953
|
}
|
|
6125
7954
|
|
|
@@ -6141,6 +7970,7 @@ class Calls extends APIResource {
|
|
|
6141
7970
|
body,
|
|
6142
7971
|
...options,
|
|
6143
7972
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7973
|
+
__security: { bearerAuth: true },
|
|
6144
7974
|
});
|
|
6145
7975
|
}
|
|
6146
7976
|
/**
|
|
@@ -6155,6 +7985,7 @@ class Calls extends APIResource {
|
|
|
6155
7985
|
return this._client.post(path `/realtime/calls/${callID}/hangup`, {
|
|
6156
7986
|
...options,
|
|
6157
7987
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7988
|
+
__security: { bearerAuth: true },
|
|
6158
7989
|
});
|
|
6159
7990
|
}
|
|
6160
7991
|
/**
|
|
@@ -6172,6 +8003,7 @@ class Calls extends APIResource {
|
|
|
6172
8003
|
body,
|
|
6173
8004
|
...options,
|
|
6174
8005
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8006
|
+
__security: { bearerAuth: true },
|
|
6175
8007
|
});
|
|
6176
8008
|
}
|
|
6177
8009
|
/**
|
|
@@ -6187,6 +8019,7 @@ class Calls extends APIResource {
|
|
|
6187
8019
|
body,
|
|
6188
8020
|
...options,
|
|
6189
8021
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8022
|
+
__security: { bearerAuth: true },
|
|
6190
8023
|
});
|
|
6191
8024
|
}
|
|
6192
8025
|
}
|
|
@@ -6217,7 +8050,11 @@ class ClientSecrets extends APIResource {
|
|
|
6217
8050
|
* ```
|
|
6218
8051
|
*/
|
|
6219
8052
|
create(body, options) {
|
|
6220
|
-
return this._client.post('/realtime/client_secrets', {
|
|
8053
|
+
return this._client.post('/realtime/client_secrets', {
|
|
8054
|
+
body,
|
|
8055
|
+
...options,
|
|
8056
|
+
__security: { bearerAuth: true },
|
|
8057
|
+
});
|
|
6221
8058
|
}
|
|
6222
8059
|
}
|
|
6223
8060
|
|
|
@@ -6628,7 +8465,7 @@ class InputItems extends APIResource {
|
|
|
6628
8465
|
* ```
|
|
6629
8466
|
*/
|
|
6630
8467
|
list(responseID, query = {}, options) {
|
|
6631
|
-
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options });
|
|
8468
|
+
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6632
8469
|
}
|
|
6633
8470
|
}
|
|
6634
8471
|
|
|
@@ -6646,7 +8483,11 @@ class InputTokens extends APIResource {
|
|
|
6646
8483
|
* ```
|
|
6647
8484
|
*/
|
|
6648
8485
|
count(body = {}, options) {
|
|
6649
|
-
return this._client.post('/responses/input_tokens', {
|
|
8486
|
+
return this._client.post('/responses/input_tokens', {
|
|
8487
|
+
body,
|
|
8488
|
+
...options,
|
|
8489
|
+
__security: { bearerAuth: true },
|
|
8490
|
+
});
|
|
6650
8491
|
}
|
|
6651
8492
|
}
|
|
6652
8493
|
|
|
@@ -6658,7 +8499,12 @@ class Responses extends APIResource {
|
|
|
6658
8499
|
this.inputTokens = new InputTokens(this._client);
|
|
6659
8500
|
}
|
|
6660
8501
|
create(body, options) {
|
|
6661
|
-
return this._client.post('/responses', {
|
|
8502
|
+
return this._client.post('/responses', {
|
|
8503
|
+
body,
|
|
8504
|
+
...options,
|
|
8505
|
+
stream: body.stream ?? false,
|
|
8506
|
+
__security: { bearerAuth: true },
|
|
8507
|
+
})._thenUnwrap((rsp) => {
|
|
6662
8508
|
if ('object' in rsp && rsp.object === 'response') {
|
|
6663
8509
|
addOutputText(rsp);
|
|
6664
8510
|
}
|
|
@@ -6670,6 +8516,7 @@ class Responses extends APIResource {
|
|
|
6670
8516
|
query,
|
|
6671
8517
|
...options,
|
|
6672
8518
|
stream: query?.stream ?? false,
|
|
8519
|
+
__security: { bearerAuth: true },
|
|
6673
8520
|
})._thenUnwrap((rsp) => {
|
|
6674
8521
|
if ('object' in rsp && rsp.object === 'response') {
|
|
6675
8522
|
addOutputText(rsp);
|
|
@@ -6691,6 +8538,7 @@ class Responses extends APIResource {
|
|
|
6691
8538
|
return this._client.delete(path `/responses/${responseID}`, {
|
|
6692
8539
|
...options,
|
|
6693
8540
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8541
|
+
__security: { bearerAuth: true },
|
|
6694
8542
|
});
|
|
6695
8543
|
}
|
|
6696
8544
|
parse(body, options) {
|
|
@@ -6717,7 +8565,10 @@ class Responses extends APIResource {
|
|
|
6717
8565
|
* ```
|
|
6718
8566
|
*/
|
|
6719
8567
|
cancel(responseID, options) {
|
|
6720
|
-
return this._client.post(path `/responses/${responseID}/cancel`,
|
|
8568
|
+
return this._client.post(path `/responses/${responseID}/cancel`, {
|
|
8569
|
+
...options,
|
|
8570
|
+
__security: { bearerAuth: true },
|
|
8571
|
+
});
|
|
6721
8572
|
}
|
|
6722
8573
|
/**
|
|
6723
8574
|
* Compact a conversation. Returns a compacted response object.
|
|
@@ -6735,7 +8586,7 @@ class Responses extends APIResource {
|
|
|
6735
8586
|
* ```
|
|
6736
8587
|
*/
|
|
6737
8588
|
compact(body, options) {
|
|
6738
|
-
return this._client.post('/responses/compact', { body, ...options });
|
|
8589
|
+
return this._client.post('/responses/compact', { body, ...options, __security: { bearerAuth: true } });
|
|
6739
8590
|
}
|
|
6740
8591
|
}
|
|
6741
8592
|
Responses.InputItems = InputItems;
|
|
@@ -6750,6 +8601,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
6750
8601
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
6751
8602
|
...options,
|
|
6752
8603
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8604
|
+
__security: { bearerAuth: true },
|
|
6753
8605
|
__binaryResponse: true,
|
|
6754
8606
|
});
|
|
6755
8607
|
}
|
|
@@ -6765,6 +8617,7 @@ class Content extends APIResource {
|
|
|
6765
8617
|
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
6766
8618
|
...options,
|
|
6767
8619
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8620
|
+
__security: { bearerAuth: true },
|
|
6768
8621
|
__binaryResponse: true,
|
|
6769
8622
|
});
|
|
6770
8623
|
}
|
|
@@ -6780,14 +8633,17 @@ class Versions extends APIResource {
|
|
|
6780
8633
|
* Create a new immutable skill version.
|
|
6781
8634
|
*/
|
|
6782
8635
|
create(skillID, body = {}, options) {
|
|
6783
|
-
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8636
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6784
8637
|
}
|
|
6785
8638
|
/**
|
|
6786
8639
|
* Get a specific skill version.
|
|
6787
8640
|
*/
|
|
6788
8641
|
retrieve(version, params, options) {
|
|
6789
8642
|
const { skill_id } = params;
|
|
6790
|
-
return this._client.get(path `/skills/${skill_id}/versions/${version}`,
|
|
8643
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, {
|
|
8644
|
+
...options,
|
|
8645
|
+
__security: { bearerAuth: true },
|
|
8646
|
+
});
|
|
6791
8647
|
}
|
|
6792
8648
|
/**
|
|
6793
8649
|
* List skill versions for a skill.
|
|
@@ -6796,6 +8652,7 @@ class Versions extends APIResource {
|
|
|
6796
8652
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
6797
8653
|
query,
|
|
6798
8654
|
...options,
|
|
8655
|
+
__security: { bearerAuth: true },
|
|
6799
8656
|
});
|
|
6800
8657
|
}
|
|
6801
8658
|
/**
|
|
@@ -6803,7 +8660,10 @@ class Versions extends APIResource {
|
|
|
6803
8660
|
*/
|
|
6804
8661
|
delete(version, params, options) {
|
|
6805
8662
|
const { skill_id } = params;
|
|
6806
|
-
return this._client.delete(path `/skills/${skill_id}/versions/${version}`,
|
|
8663
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, {
|
|
8664
|
+
...options,
|
|
8665
|
+
__security: { bearerAuth: true },
|
|
8666
|
+
});
|
|
6807
8667
|
}
|
|
6808
8668
|
}
|
|
6809
8669
|
Versions.Content = Content;
|
|
@@ -6819,31 +8679,39 @@ class Skills extends APIResource {
|
|
|
6819
8679
|
* Create a new skill.
|
|
6820
8680
|
*/
|
|
6821
8681
|
create(body = {}, options) {
|
|
6822
|
-
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8682
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6823
8683
|
}
|
|
6824
8684
|
/**
|
|
6825
8685
|
* Get a skill by its ID.
|
|
6826
8686
|
*/
|
|
6827
8687
|
retrieve(skillID, options) {
|
|
6828
|
-
return this._client.get(path `/skills/${skillID}`, options);
|
|
8688
|
+
return this._client.get(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
6829
8689
|
}
|
|
6830
8690
|
/**
|
|
6831
8691
|
* Update the default version pointer for a skill.
|
|
6832
8692
|
*/
|
|
6833
8693
|
update(skillID, body, options) {
|
|
6834
|
-
return this._client.post(path `/skills/${skillID}`, {
|
|
8694
|
+
return this._client.post(path `/skills/${skillID}`, {
|
|
8695
|
+
body,
|
|
8696
|
+
...options,
|
|
8697
|
+
__security: { bearerAuth: true },
|
|
8698
|
+
});
|
|
6835
8699
|
}
|
|
6836
8700
|
/**
|
|
6837
8701
|
* List all skills for the current project.
|
|
6838
8702
|
*/
|
|
6839
8703
|
list(query = {}, options) {
|
|
6840
|
-
return this._client.getAPIList('/skills', (CursorPage), {
|
|
8704
|
+
return this._client.getAPIList('/skills', (CursorPage), {
|
|
8705
|
+
query,
|
|
8706
|
+
...options,
|
|
8707
|
+
__security: { bearerAuth: true },
|
|
8708
|
+
});
|
|
6841
8709
|
}
|
|
6842
8710
|
/**
|
|
6843
8711
|
* Delete a skill by its ID.
|
|
6844
8712
|
*/
|
|
6845
8713
|
delete(skillID, options) {
|
|
6846
|
-
return this._client.delete(path `/skills/${skillID}`, options);
|
|
8714
|
+
return this._client.delete(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
6847
8715
|
}
|
|
6848
8716
|
}
|
|
6849
8717
|
Skills.Content = Content$1;
|
|
@@ -6868,7 +8736,7 @@ class Parts extends APIResource {
|
|
|
6868
8736
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
6869
8737
|
*/
|
|
6870
8738
|
create(uploadID, body, options) {
|
|
6871
|
-
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8739
|
+
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6872
8740
|
}
|
|
6873
8741
|
}
|
|
6874
8742
|
|
|
@@ -6905,7 +8773,7 @@ class Uploads extends APIResource {
|
|
|
6905
8773
|
* Returns the Upload object with status `pending`.
|
|
6906
8774
|
*/
|
|
6907
8775
|
create(body, options) {
|
|
6908
|
-
return this._client.post('/uploads', { body, ...options });
|
|
8776
|
+
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
|
|
6909
8777
|
}
|
|
6910
8778
|
/**
|
|
6911
8779
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
@@ -6913,7 +8781,10 @@ class Uploads extends APIResource {
|
|
|
6913
8781
|
* Returns the Upload object with status `cancelled`.
|
|
6914
8782
|
*/
|
|
6915
8783
|
cancel(uploadID, options) {
|
|
6916
|
-
return this._client.post(path `/uploads/${uploadID}/cancel`,
|
|
8784
|
+
return this._client.post(path `/uploads/${uploadID}/cancel`, {
|
|
8785
|
+
...options,
|
|
8786
|
+
__security: { bearerAuth: true },
|
|
8787
|
+
});
|
|
6917
8788
|
}
|
|
6918
8789
|
/**
|
|
6919
8790
|
* Completes the
|
|
@@ -6933,7 +8804,11 @@ class Uploads extends APIResource {
|
|
|
6933
8804
|
* object.
|
|
6934
8805
|
*/
|
|
6935
8806
|
complete(uploadID, body, options) {
|
|
6936
|
-
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
8807
|
+
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
8808
|
+
body,
|
|
8809
|
+
...options,
|
|
8810
|
+
__security: { bearerAuth: true },
|
|
8811
|
+
});
|
|
6937
8812
|
}
|
|
6938
8813
|
}
|
|
6939
8814
|
Uploads.Parts = Parts;
|
|
@@ -6970,6 +8845,7 @@ class FileBatches extends APIResource {
|
|
|
6970
8845
|
body,
|
|
6971
8846
|
...options,
|
|
6972
8847
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8848
|
+
__security: { bearerAuth: true },
|
|
6973
8849
|
});
|
|
6974
8850
|
}
|
|
6975
8851
|
/**
|
|
@@ -6980,6 +8856,7 @@ class FileBatches extends APIResource {
|
|
|
6980
8856
|
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
6981
8857
|
...options,
|
|
6982
8858
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8859
|
+
__security: { bearerAuth: true },
|
|
6983
8860
|
});
|
|
6984
8861
|
}
|
|
6985
8862
|
/**
|
|
@@ -6991,6 +8868,7 @@ class FileBatches extends APIResource {
|
|
|
6991
8868
|
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
6992
8869
|
...options,
|
|
6993
8870
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8871
|
+
__security: { bearerAuth: true },
|
|
6994
8872
|
});
|
|
6995
8873
|
}
|
|
6996
8874
|
/**
|
|
@@ -7005,7 +8883,12 @@ class FileBatches extends APIResource {
|
|
|
7005
8883
|
*/
|
|
7006
8884
|
listFiles(batchID, params, options) {
|
|
7007
8885
|
const { vector_store_id, ...query } = params;
|
|
7008
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
8886
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
8887
|
+
query,
|
|
8888
|
+
...options,
|
|
8889
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8890
|
+
__security: { bearerAuth: true },
|
|
8891
|
+
});
|
|
7009
8892
|
}
|
|
7010
8893
|
/**
|
|
7011
8894
|
* Wait for the given file batch to be processed.
|
|
@@ -7095,6 +8978,7 @@ class Files extends APIResource {
|
|
|
7095
8978
|
body,
|
|
7096
8979
|
...options,
|
|
7097
8980
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8981
|
+
__security: { bearerAuth: true },
|
|
7098
8982
|
});
|
|
7099
8983
|
}
|
|
7100
8984
|
/**
|
|
@@ -7105,6 +8989,7 @@ class Files extends APIResource {
|
|
|
7105
8989
|
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
7106
8990
|
...options,
|
|
7107
8991
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8992
|
+
__security: { bearerAuth: true },
|
|
7108
8993
|
});
|
|
7109
8994
|
}
|
|
7110
8995
|
/**
|
|
@@ -7116,6 +9001,7 @@ class Files extends APIResource {
|
|
|
7116
9001
|
body,
|
|
7117
9002
|
...options,
|
|
7118
9003
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9004
|
+
__security: { bearerAuth: true },
|
|
7119
9005
|
});
|
|
7120
9006
|
}
|
|
7121
9007
|
/**
|
|
@@ -7126,6 +9012,7 @@ class Files extends APIResource {
|
|
|
7126
9012
|
query,
|
|
7127
9013
|
...options,
|
|
7128
9014
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9015
|
+
__security: { bearerAuth: true },
|
|
7129
9016
|
});
|
|
7130
9017
|
}
|
|
7131
9018
|
/**
|
|
@@ -7139,6 +9026,7 @@ class Files extends APIResource {
|
|
|
7139
9026
|
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
7140
9027
|
...options,
|
|
7141
9028
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9029
|
+
__security: { bearerAuth: true },
|
|
7142
9030
|
});
|
|
7143
9031
|
}
|
|
7144
9032
|
/**
|
|
@@ -7212,7 +9100,11 @@ class Files extends APIResource {
|
|
|
7212
9100
|
*/
|
|
7213
9101
|
content(fileID, params, options) {
|
|
7214
9102
|
const { vector_store_id } = params;
|
|
7215
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
9103
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
9104
|
+
...options,
|
|
9105
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9106
|
+
__security: { bearerAuth: true },
|
|
9107
|
+
});
|
|
7216
9108
|
}
|
|
7217
9109
|
}
|
|
7218
9110
|
|
|
@@ -7231,6 +9123,7 @@ class VectorStores extends APIResource {
|
|
|
7231
9123
|
body,
|
|
7232
9124
|
...options,
|
|
7233
9125
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9126
|
+
__security: { bearerAuth: true },
|
|
7234
9127
|
});
|
|
7235
9128
|
}
|
|
7236
9129
|
/**
|
|
@@ -7240,6 +9133,7 @@ class VectorStores extends APIResource {
|
|
|
7240
9133
|
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
|
|
7241
9134
|
...options,
|
|
7242
9135
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9136
|
+
__security: { bearerAuth: true },
|
|
7243
9137
|
});
|
|
7244
9138
|
}
|
|
7245
9139
|
/**
|
|
@@ -7250,6 +9144,7 @@ class VectorStores extends APIResource {
|
|
|
7250
9144
|
body,
|
|
7251
9145
|
...options,
|
|
7252
9146
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9147
|
+
__security: { bearerAuth: true },
|
|
7253
9148
|
});
|
|
7254
9149
|
}
|
|
7255
9150
|
/**
|
|
@@ -7260,6 +9155,7 @@ class VectorStores extends APIResource {
|
|
|
7260
9155
|
query,
|
|
7261
9156
|
...options,
|
|
7262
9157
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9158
|
+
__security: { bearerAuth: true },
|
|
7263
9159
|
});
|
|
7264
9160
|
}
|
|
7265
9161
|
/**
|
|
@@ -7269,6 +9165,7 @@ class VectorStores extends APIResource {
|
|
|
7269
9165
|
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
|
|
7270
9166
|
...options,
|
|
7271
9167
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9168
|
+
__security: { bearerAuth: true },
|
|
7272
9169
|
});
|
|
7273
9170
|
}
|
|
7274
9171
|
/**
|
|
@@ -7281,6 +9178,7 @@ class VectorStores extends APIResource {
|
|
|
7281
9178
|
method: 'post',
|
|
7282
9179
|
...options,
|
|
7283
9180
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9181
|
+
__security: { bearerAuth: true },
|
|
7284
9182
|
});
|
|
7285
9183
|
}
|
|
7286
9184
|
}
|
|
@@ -7293,31 +9191,35 @@ class Videos extends APIResource {
|
|
|
7293
9191
|
* Create a new video generation job from a prompt and optional reference assets.
|
|
7294
9192
|
*/
|
|
7295
9193
|
create(body, options) {
|
|
7296
|
-
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9194
|
+
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7297
9195
|
}
|
|
7298
9196
|
/**
|
|
7299
9197
|
* Fetch the latest metadata for a generated video.
|
|
7300
9198
|
*/
|
|
7301
9199
|
retrieve(videoID, options) {
|
|
7302
|
-
return this._client.get(path `/videos/${videoID}`, options);
|
|
9200
|
+
return this._client.get(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
7303
9201
|
}
|
|
7304
9202
|
/**
|
|
7305
9203
|
* List recently generated videos for the current project.
|
|
7306
9204
|
*/
|
|
7307
9205
|
list(query = {}, options) {
|
|
7308
|
-
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
9206
|
+
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
9207
|
+
query,
|
|
9208
|
+
...options,
|
|
9209
|
+
__security: { bearerAuth: true },
|
|
9210
|
+
});
|
|
7309
9211
|
}
|
|
7310
9212
|
/**
|
|
7311
9213
|
* Permanently delete a completed or failed video and its stored assets.
|
|
7312
9214
|
*/
|
|
7313
9215
|
delete(videoID, options) {
|
|
7314
|
-
return this._client.delete(path `/videos/${videoID}`, options);
|
|
9216
|
+
return this._client.delete(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
7315
9217
|
}
|
|
7316
9218
|
/**
|
|
7317
9219
|
* Create a character from an uploaded video.
|
|
7318
9220
|
*/
|
|
7319
9221
|
createCharacter(body, options) {
|
|
7320
|
-
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9222
|
+
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7321
9223
|
}
|
|
7322
9224
|
/**
|
|
7323
9225
|
* Download the generated video bytes or a derived preview asset.
|
|
@@ -7329,6 +9231,7 @@ class Videos extends APIResource {
|
|
|
7329
9231
|
query,
|
|
7330
9232
|
...options,
|
|
7331
9233
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9234
|
+
__security: { bearerAuth: true },
|
|
7332
9235
|
__binaryResponse: true,
|
|
7333
9236
|
});
|
|
7334
9237
|
}
|
|
@@ -7337,25 +9240,28 @@ class Videos extends APIResource {
|
|
|
7337
9240
|
* generated video.
|
|
7338
9241
|
*/
|
|
7339
9242
|
edit(body, options) {
|
|
7340
|
-
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9243
|
+
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7341
9244
|
}
|
|
7342
9245
|
/**
|
|
7343
9246
|
* Create an extension of a completed video.
|
|
7344
9247
|
*/
|
|
7345
9248
|
extend(body, options) {
|
|
7346
|
-
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9249
|
+
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7347
9250
|
}
|
|
7348
9251
|
/**
|
|
7349
9252
|
* Fetch a character.
|
|
7350
9253
|
*/
|
|
7351
9254
|
getCharacter(characterID, options) {
|
|
7352
|
-
return this._client.get(path `/videos/characters/${characterID}`,
|
|
9255
|
+
return this._client.get(path `/videos/characters/${characterID}`, {
|
|
9256
|
+
...options,
|
|
9257
|
+
__security: { bearerAuth: true },
|
|
9258
|
+
});
|
|
7353
9259
|
}
|
|
7354
9260
|
/**
|
|
7355
9261
|
* Create a remix of a completed video using a refreshed prompt.
|
|
7356
9262
|
*/
|
|
7357
9263
|
remix(videoID, body, options) {
|
|
7358
|
-
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9264
|
+
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7359
9265
|
}
|
|
7360
9266
|
}
|
|
7361
9267
|
|
|
@@ -7462,7 +9368,8 @@ class OpenAI {
|
|
|
7462
9368
|
/**
|
|
7463
9369
|
* API Client for interfacing with the OpenAI API.
|
|
7464
9370
|
*
|
|
7465
|
-
* @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ??
|
|
9371
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? null]
|
|
9372
|
+
* @param {string | null | undefined} [opts.adminAPIKey=process.env['OPENAI_ADMIN_KEY'] ?? null]
|
|
7466
9373
|
* @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
|
|
7467
9374
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
7468
9375
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
@@ -7475,7 +9382,7 @@ class OpenAI {
|
|
|
7475
9382
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
7476
9383
|
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
7477
9384
|
*/
|
|
7478
|
-
constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, ...opts } = {}) {
|
|
9385
|
+
constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY') ?? null, adminAPIKey = readEnv('OPENAI_ADMIN_KEY') ?? null, organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, ...opts } = {}) {
|
|
7479
9386
|
_OpenAI_instances.add(this);
|
|
7480
9387
|
_OpenAI_encoder.set(this, void 0);
|
|
7481
9388
|
/**
|
|
@@ -7517,6 +9424,7 @@ class OpenAI {
|
|
|
7517
9424
|
* Use Uploads to upload large files in multiple parts.
|
|
7518
9425
|
*/
|
|
7519
9426
|
this.uploads = new Uploads(this);
|
|
9427
|
+
this.admin = new Admin(this);
|
|
7520
9428
|
this.responses = new Responses(this);
|
|
7521
9429
|
this.realtime = new Realtime(this);
|
|
7522
9430
|
/**
|
|
@@ -7530,17 +9438,9 @@ class OpenAI {
|
|
|
7530
9438
|
this.containers = new Containers(this);
|
|
7531
9439
|
this.skills = new Skills(this);
|
|
7532
9440
|
this.videos = new Videos(this);
|
|
7533
|
-
if (workloadIdentity) {
|
|
7534
|
-
if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
|
|
7535
|
-
throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
|
|
7536
|
-
}
|
|
7537
|
-
apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
|
|
7538
|
-
}
|
|
7539
|
-
else if (apiKey === undefined) {
|
|
7540
|
-
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
|
|
7541
|
-
}
|
|
7542
9441
|
const options = {
|
|
7543
9442
|
apiKey,
|
|
9443
|
+
adminAPIKey,
|
|
7544
9444
|
organization,
|
|
7545
9445
|
project,
|
|
7546
9446
|
webhookSecret,
|
|
@@ -7548,6 +9448,12 @@ class OpenAI {
|
|
|
7548
9448
|
...opts,
|
|
7549
9449
|
baseURL: baseURL || `https://api.openai.com/v1`,
|
|
7550
9450
|
};
|
|
9451
|
+
if (apiKey && workloadIdentity) {
|
|
9452
|
+
throw new OpenAIError('The `apiKey` and `workloadIdentity` options are mutually exclusive');
|
|
9453
|
+
}
|
|
9454
|
+
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
9455
|
+
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.');
|
|
9456
|
+
}
|
|
7551
9457
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
7552
9458
|
throw new OpenAIError("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");
|
|
7553
9459
|
}
|
|
@@ -7565,11 +9471,23 @@ class OpenAI {
|
|
|
7565
9471
|
this.maxRetries = options.maxRetries ?? 2;
|
|
7566
9472
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
7567
9473
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder);
|
|
9474
|
+
const customHeadersEnv = readEnv('OPENAI_CUSTOM_HEADERS');
|
|
9475
|
+
if (customHeadersEnv) {
|
|
9476
|
+
const parsed = {};
|
|
9477
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
9478
|
+
const colon = line.indexOf(':');
|
|
9479
|
+
if (colon >= 0) {
|
|
9480
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
9481
|
+
}
|
|
9482
|
+
}
|
|
9483
|
+
options.defaultHeaders = buildHeaders([parsed, options.defaultHeaders]);
|
|
9484
|
+
}
|
|
7568
9485
|
this._options = options;
|
|
7569
9486
|
if (workloadIdentity) {
|
|
7570
9487
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
7571
9488
|
}
|
|
7572
|
-
this.apiKey = typeof apiKey === 'string' ? apiKey :
|
|
9489
|
+
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
9490
|
+
this.adminAPIKey = adminAPIKey;
|
|
7573
9491
|
this.organization = organization;
|
|
7574
9492
|
this.project = project;
|
|
7575
9493
|
this.webhookSecret = webhookSecret;
|
|
@@ -7587,7 +9505,8 @@ class OpenAI {
|
|
|
7587
9505
|
logLevel: this.logLevel,
|
|
7588
9506
|
fetch: this.fetch,
|
|
7589
9507
|
fetchOptions: this.fetchOptions,
|
|
7590
|
-
apiKey: this.apiKey,
|
|
9508
|
+
apiKey: this._options.apiKey,
|
|
9509
|
+
adminAPIKey: this.adminAPIKey,
|
|
7591
9510
|
workloadIdentity: this._options.workloadIdentity,
|
|
7592
9511
|
organization: this.organization,
|
|
7593
9512
|
project: this.project,
|
|
@@ -7599,12 +9518,45 @@ class OpenAI {
|
|
|
7599
9518
|
defaultQuery() {
|
|
7600
9519
|
return this._options.defaultQuery;
|
|
7601
9520
|
}
|
|
7602
|
-
validateHeaders({ values, nulls }
|
|
7603
|
-
|
|
9521
|
+
validateHeaders({ values, nulls }, schemes = {
|
|
9522
|
+
bearerAuth: true,
|
|
9523
|
+
adminAPIKeyAuth: true,
|
|
9524
|
+
}) {
|
|
9525
|
+
if (values.get('authorization') || values.get('api-key')) {
|
|
9526
|
+
return;
|
|
9527
|
+
}
|
|
9528
|
+
if (nulls.has('authorization') || nulls.has('api-key')) {
|
|
9529
|
+
return;
|
|
9530
|
+
}
|
|
9531
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
9532
|
+
return;
|
|
9533
|
+
}
|
|
9534
|
+
throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted');
|
|
9535
|
+
}
|
|
9536
|
+
async authHeaders(opts, schemes = {
|
|
9537
|
+
bearerAuth: true,
|
|
9538
|
+
adminAPIKeyAuth: true,
|
|
9539
|
+
}) {
|
|
9540
|
+
return buildHeaders([
|
|
9541
|
+
schemes.bearerAuth ? await this.bearerAuth(opts) : null,
|
|
9542
|
+
schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null,
|
|
9543
|
+
]);
|
|
7604
9544
|
}
|
|
7605
|
-
async
|
|
9545
|
+
async bearerAuth(opts) {
|
|
9546
|
+
if (this._workloadIdentityAuth) {
|
|
9547
|
+
return buildHeaders([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
|
|
9548
|
+
}
|
|
9549
|
+
if (this.apiKey == null) {
|
|
9550
|
+
return undefined;
|
|
9551
|
+
}
|
|
7606
9552
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
7607
9553
|
}
|
|
9554
|
+
async adminAPIKeyAuth(opts) {
|
|
9555
|
+
if (this.adminAPIKey == null) {
|
|
9556
|
+
return undefined;
|
|
9557
|
+
}
|
|
9558
|
+
return buildHeaders([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
|
|
9559
|
+
}
|
|
7608
9560
|
stringifyQuery(query) {
|
|
7609
9561
|
return stringifyQuery(query);
|
|
7610
9562
|
}
|
|
@@ -7657,7 +9609,10 @@ class OpenAI {
|
|
|
7657
9609
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
7658
9610
|
*/
|
|
7659
9611
|
async prepareOptions(options) {
|
|
7660
|
-
|
|
9612
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
9613
|
+
if (security.bearerAuth) {
|
|
9614
|
+
await this._callApiKey();
|
|
9615
|
+
}
|
|
7661
9616
|
}
|
|
7662
9617
|
/**
|
|
7663
9618
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
@@ -7714,8 +9669,9 @@ class OpenAI {
|
|
|
7714
9669
|
if (options.signal?.aborted) {
|
|
7715
9670
|
throw new APIUserAbortError();
|
|
7716
9671
|
}
|
|
9672
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
7717
9673
|
const controller = new AbortController();
|
|
7718
|
-
const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
|
|
9674
|
+
const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError);
|
|
7719
9675
|
const headersTime = Date.now();
|
|
7720
9676
|
if (response instanceof globalThis.Error) {
|
|
7721
9677
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -7761,6 +9717,7 @@ class OpenAI {
|
|
|
7761
9717
|
if (!response.ok) {
|
|
7762
9718
|
if (response.status === 401 &&
|
|
7763
9719
|
this._workloadIdentityAuth &&
|
|
9720
|
+
security.bearerAuth &&
|
|
7764
9721
|
!options.__metadata?.['hasStreamingBody'] &&
|
|
7765
9722
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
7766
9723
|
await CancelReadableStream(response.body);
|
|
@@ -7823,8 +9780,11 @@ class OpenAI {
|
|
|
7823
9780
|
const request = this.makeRequest(options, null, undefined);
|
|
7824
9781
|
return new PagePromise(this, request, Page);
|
|
7825
9782
|
}
|
|
7826
|
-
async fetchWithAuth(url, init, timeout, controller
|
|
7827
|
-
|
|
9783
|
+
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
9784
|
+
bearerAuth: true,
|
|
9785
|
+
adminAPIKeyAuth: true,
|
|
9786
|
+
}) {
|
|
9787
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
7828
9788
|
const headers = init.headers;
|
|
7829
9789
|
const authHeader = headers.get('Authorization');
|
|
7830
9790
|
if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
@@ -7969,12 +9929,12 @@ class OpenAI {
|
|
|
7969
9929
|
'OpenAI-Organization': this.organization,
|
|
7970
9930
|
'OpenAI-Project': this.project,
|
|
7971
9931
|
},
|
|
7972
|
-
await this.authHeaders(options),
|
|
9932
|
+
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
7973
9933
|
this._options.defaultHeaders,
|
|
7974
9934
|
bodyHeaders,
|
|
7975
9935
|
options.headers,
|
|
7976
9936
|
]);
|
|
7977
|
-
this.validateHeaders(headers);
|
|
9937
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
7978
9938
|
return headers.values;
|
|
7979
9939
|
}
|
|
7980
9940
|
_makeAbort(controller) {
|
|
@@ -8071,6 +10031,7 @@ OpenAI.Webhooks = Webhooks;
|
|
|
8071
10031
|
OpenAI.Beta = Beta;
|
|
8072
10032
|
OpenAI.Batches = Batches;
|
|
8073
10033
|
OpenAI.Uploads = Uploads;
|
|
10034
|
+
OpenAI.Admin = Admin;
|
|
8074
10035
|
OpenAI.Responses = Responses;
|
|
8075
10036
|
OpenAI.Realtime = Realtime;
|
|
8076
10037
|
OpenAI.Conversations = Conversations;
|
|
@@ -9072,7 +11033,7 @@ class Doc {
|
|
|
9072
11033
|
const version = {
|
|
9073
11034
|
major: 4,
|
|
9074
11035
|
minor: 4,
|
|
9075
|
-
patch:
|
|
11036
|
+
patch: 3,
|
|
9076
11037
|
};
|
|
9077
11038
|
|
|
9078
11039
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
@@ -10070,6 +12031,7 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
10070
12031
|
});
|
|
10071
12032
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
10072
12033
|
$ZodType.init(inst, def);
|
|
12034
|
+
inst._zod.optin = "optional";
|
|
10073
12035
|
inst._zod.parse = (payload, ctx) => {
|
|
10074
12036
|
if (ctx.direction === "backward") {
|
|
10075
12037
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -10079,6 +12041,7 @@ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) =>
|
|
|
10079
12041
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
10080
12042
|
return output.then((output) => {
|
|
10081
12043
|
payload.value = output;
|
|
12044
|
+
payload.fallback = true;
|
|
10082
12045
|
return payload;
|
|
10083
12046
|
});
|
|
10084
12047
|
}
|
|
@@ -10086,11 +12049,12 @@ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) =>
|
|
|
10086
12049
|
throw new $ZodAsyncError();
|
|
10087
12050
|
}
|
|
10088
12051
|
payload.value = _out;
|
|
12052
|
+
payload.fallback = true;
|
|
10089
12053
|
return payload;
|
|
10090
12054
|
};
|
|
10091
12055
|
});
|
|
10092
12056
|
function handleOptionalResult(result, input) {
|
|
10093
|
-
if (result.issues.length
|
|
12057
|
+
if (input === undefined && (result.issues.length || result.fallback)) {
|
|
10094
12058
|
return { issues: [], value: undefined };
|
|
10095
12059
|
}
|
|
10096
12060
|
return result;
|
|
@@ -10108,10 +12072,11 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
|
10108
12072
|
});
|
|
10109
12073
|
inst._zod.parse = (payload, ctx) => {
|
|
10110
12074
|
if (def.innerType._zod.optin === "optional") {
|
|
12075
|
+
const input = payload.value;
|
|
10111
12076
|
const result = def.innerType._zod.run(payload, ctx);
|
|
10112
12077
|
if (result instanceof Promise)
|
|
10113
|
-
return result.then((r) => handleOptionalResult(r,
|
|
10114
|
-
return handleOptionalResult(result,
|
|
12078
|
+
return result.then((r) => handleOptionalResult(r, input));
|
|
12079
|
+
return handleOptionalResult(result, input);
|
|
10115
12080
|
}
|
|
10116
12081
|
if (payload.value === undefined) {
|
|
10117
12082
|
return payload;
|
|
@@ -10221,7 +12186,7 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
10221
12186
|
}
|
|
10222
12187
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
10223
12188
|
$ZodType.init(inst, def);
|
|
10224
|
-
|
|
12189
|
+
inst._zod.optin = "optional";
|
|
10225
12190
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
10226
12191
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
10227
12192
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -10242,6 +12207,7 @@ const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
|
10242
12207
|
input: payload.value,
|
|
10243
12208
|
});
|
|
10244
12209
|
payload.issues = [];
|
|
12210
|
+
payload.fallback = true;
|
|
10245
12211
|
}
|
|
10246
12212
|
return payload;
|
|
10247
12213
|
});
|
|
@@ -10256,6 +12222,7 @@ const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
|
10256
12222
|
input: payload.value,
|
|
10257
12223
|
});
|
|
10258
12224
|
payload.issues = [];
|
|
12225
|
+
payload.fallback = true;
|
|
10259
12226
|
}
|
|
10260
12227
|
return payload;
|
|
10261
12228
|
};
|
|
@@ -10287,7 +12254,7 @@ function handlePipeResult(left, next, ctx) {
|
|
|
10287
12254
|
left.aborted = true;
|
|
10288
12255
|
return left;
|
|
10289
12256
|
}
|
|
10290
|
-
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
12257
|
+
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
10291
12258
|
}
|
|
10292
12259
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
10293
12260
|
$ZodType.init(inst, def);
|
|
@@ -12556,10 +14523,12 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
12556
14523
|
if (output instanceof Promise) {
|
|
12557
14524
|
return output.then((output) => {
|
|
12558
14525
|
payload.value = output;
|
|
14526
|
+
payload.fallback = true;
|
|
12559
14527
|
return payload;
|
|
12560
14528
|
});
|
|
12561
14529
|
}
|
|
12562
14530
|
payload.value = output;
|
|
14531
|
+
payload.fallback = true;
|
|
12563
14532
|
return payload;
|
|
12564
14533
|
};
|
|
12565
14534
|
});
|
|
@@ -14168,7 +16137,6 @@ function zodTextFormat(zodObject, name, props) {
|
|
|
14168
16137
|
}, (content) => zodObject.parse(JSON.parse(content)));
|
|
14169
16138
|
}
|
|
14170
16139
|
|
|
14171
|
-
// llm-openai-config.ts
|
|
14172
16140
|
const DEFAULT_MODEL = 'gpt-5-mini';
|
|
14173
16141
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
14174
16142
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
@@ -14249,25 +16217,144 @@ const deepseekModelCosts = {
|
|
|
14249
16217
|
function shouldUseGPT5HighContextPricing(model, inputTokens) {
|
|
14250
16218
|
return (model === 'gpt-5.4' || model === 'gpt-5.5') && inputTokens > GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS;
|
|
14251
16219
|
}
|
|
14252
|
-
|
|
14253
|
-
const
|
|
14254
|
-
|
|
14255
|
-
'gpt-image-
|
|
16220
|
+
const DEFAULT_IMAGE_PRICING_QUALITY = 'high';
|
|
16221
|
+
const DEFAULT_IMAGE_PRICING_SIZE = '1024x1024';
|
|
16222
|
+
const PRICED_OPENAI_IMAGE_MODELS = [
|
|
16223
|
+
'gpt-image-2',
|
|
16224
|
+
'gpt-image-2-2026-04-21',
|
|
16225
|
+
'gpt-image-1.5',
|
|
16226
|
+
'gpt-image-1',
|
|
16227
|
+
'gpt-image-1-mini',
|
|
16228
|
+
];
|
|
16229
|
+
const OPENAI_IMAGE_PRICING_SIZES = ['1024x1024', '1024x1536', '1536x1024'];
|
|
16230
|
+
/**
|
|
16231
|
+
* Estimated image output costs in USD per image for common GPT Image sizes.
|
|
16232
|
+
* Last updated May 2026 from the OpenAI image generation guide. Text and image
|
|
16233
|
+
* input token costs for prompts and edit inputs are not included.
|
|
16234
|
+
*/
|
|
16235
|
+
const openAiImageCostByQualityAndSize = {
|
|
16236
|
+
'gpt-image-2': {
|
|
16237
|
+
low: {
|
|
16238
|
+
'1024x1024': 0.006,
|
|
16239
|
+
'1024x1536': 0.005,
|
|
16240
|
+
'1536x1024': 0.005,
|
|
16241
|
+
},
|
|
16242
|
+
medium: {
|
|
16243
|
+
'1024x1024': 0.053,
|
|
16244
|
+
'1024x1536': 0.041,
|
|
16245
|
+
'1536x1024': 0.041,
|
|
16246
|
+
},
|
|
16247
|
+
high: {
|
|
16248
|
+
'1024x1024': 0.211,
|
|
16249
|
+
'1024x1536': 0.165,
|
|
16250
|
+
'1536x1024': 0.165,
|
|
16251
|
+
},
|
|
16252
|
+
},
|
|
16253
|
+
'gpt-image-2-2026-04-21': {
|
|
16254
|
+
low: {
|
|
16255
|
+
'1024x1024': 0.006,
|
|
16256
|
+
'1024x1536': 0.005,
|
|
16257
|
+
'1536x1024': 0.005,
|
|
16258
|
+
},
|
|
16259
|
+
medium: {
|
|
16260
|
+
'1024x1024': 0.053,
|
|
16261
|
+
'1024x1536': 0.041,
|
|
16262
|
+
'1536x1024': 0.041,
|
|
16263
|
+
},
|
|
16264
|
+
high: {
|
|
16265
|
+
'1024x1024': 0.211,
|
|
16266
|
+
'1024x1536': 0.165,
|
|
16267
|
+
'1536x1024': 0.165,
|
|
16268
|
+
},
|
|
16269
|
+
},
|
|
16270
|
+
'gpt-image-1.5': {
|
|
16271
|
+
low: {
|
|
16272
|
+
'1024x1024': 0.009,
|
|
16273
|
+
'1024x1536': 0.013,
|
|
16274
|
+
'1536x1024': 0.013,
|
|
16275
|
+
},
|
|
16276
|
+
medium: {
|
|
16277
|
+
'1024x1024': 0.034,
|
|
16278
|
+
'1024x1536': 0.05,
|
|
16279
|
+
'1536x1024': 0.05,
|
|
16280
|
+
},
|
|
16281
|
+
high: {
|
|
16282
|
+
'1024x1024': 0.133,
|
|
16283
|
+
'1024x1536': 0.2,
|
|
16284
|
+
'1536x1024': 0.2,
|
|
16285
|
+
},
|
|
16286
|
+
},
|
|
16287
|
+
'gpt-image-1': {
|
|
16288
|
+
low: {
|
|
16289
|
+
'1024x1024': 0.011,
|
|
16290
|
+
'1024x1536': 0.016,
|
|
16291
|
+
'1536x1024': 0.016,
|
|
16292
|
+
},
|
|
16293
|
+
medium: {
|
|
16294
|
+
'1024x1024': 0.042,
|
|
16295
|
+
'1024x1536': 0.063,
|
|
16296
|
+
'1536x1024': 0.063,
|
|
16297
|
+
},
|
|
16298
|
+
high: {
|
|
16299
|
+
'1024x1024': 0.167,
|
|
16300
|
+
'1024x1536': 0.25,
|
|
16301
|
+
'1536x1024': 0.25,
|
|
16302
|
+
},
|
|
16303
|
+
},
|
|
16304
|
+
'gpt-image-1-mini': {
|
|
16305
|
+
low: {
|
|
16306
|
+
'1024x1024': 0.005,
|
|
16307
|
+
'1024x1536': 0.006,
|
|
16308
|
+
'1536x1024': 0.006,
|
|
16309
|
+
},
|
|
16310
|
+
medium: {
|
|
16311
|
+
'1024x1024': 0.011,
|
|
16312
|
+
'1024x1536': 0.015,
|
|
16313
|
+
'1536x1024': 0.015,
|
|
16314
|
+
},
|
|
16315
|
+
high: {
|
|
16316
|
+
'1024x1024': 0.036,
|
|
16317
|
+
'1024x1536': 0.052,
|
|
16318
|
+
'1536x1024': 0.052,
|
|
16319
|
+
},
|
|
16320
|
+
},
|
|
14256
16321
|
};
|
|
16322
|
+
function isPricedOpenAIImageModel(model) {
|
|
16323
|
+
return PRICED_OPENAI_IMAGE_MODELS.includes(model);
|
|
16324
|
+
}
|
|
16325
|
+
function isOpenAIImagePricingSize(size) {
|
|
16326
|
+
return OPENAI_IMAGE_PRICING_SIZES.includes(size);
|
|
16327
|
+
}
|
|
16328
|
+
function resolveImagePricingQuality(quality) {
|
|
16329
|
+
if (quality === 'low' || quality === 'medium' || quality === 'high') {
|
|
16330
|
+
return quality;
|
|
16331
|
+
}
|
|
16332
|
+
return DEFAULT_IMAGE_PRICING_QUALITY;
|
|
16333
|
+
}
|
|
16334
|
+
function resolveImagePricingSize(size) {
|
|
16335
|
+
if (typeof size === 'string' && isOpenAIImagePricingSize(size)) {
|
|
16336
|
+
return size;
|
|
16337
|
+
}
|
|
16338
|
+
return DEFAULT_IMAGE_PRICING_SIZE;
|
|
16339
|
+
}
|
|
14257
16340
|
/**
|
|
14258
16341
|
* Calculates the cost of generating images using OpenAI's Images API.
|
|
14259
16342
|
*
|
|
14260
16343
|
* @param model The image generation model name.
|
|
14261
16344
|
* @param imageCount The number of images generated.
|
|
16345
|
+
* @param quality The requested image quality.
|
|
16346
|
+
* @param size The requested image size.
|
|
14262
16347
|
* @returns The cost of generating the images in USD.
|
|
14263
16348
|
*/
|
|
14264
|
-
function calculateImageCost(model, imageCount) {
|
|
16349
|
+
function calculateImageCost(model, imageCount, quality, size) {
|
|
14265
16350
|
if (typeof model !== 'string' || typeof imageCount !== 'number' || imageCount <= 0) {
|
|
14266
16351
|
return 0;
|
|
14267
16352
|
}
|
|
14268
|
-
|
|
14269
|
-
if (!costPerImage)
|
|
16353
|
+
if (!isPricedOpenAIImageModel(model))
|
|
14270
16354
|
return 0;
|
|
16355
|
+
const pricingQuality = resolveImagePricingQuality(quality);
|
|
16356
|
+
const pricingSize = resolveImagePricingSize(size);
|
|
16357
|
+
const costPerImage = openAiImageCostByQualityAndSize[model][pricingQuality][pricingSize];
|
|
14271
16358
|
return imageCount * costPerImage;
|
|
14272
16359
|
}
|
|
14273
16360
|
/**
|
|
@@ -14958,7 +17045,7 @@ async function makeLLMCall(input, options = {}) {
|
|
|
14958
17045
|
return await makeResponsesAPICall(processedInput, responsesOptions);
|
|
14959
17046
|
}
|
|
14960
17047
|
|
|
14961
|
-
const DEFAULT_IMAGE_MODEL = 'gpt-image-
|
|
17048
|
+
const DEFAULT_IMAGE_MODEL = 'gpt-image-2';
|
|
14962
17049
|
const resolveImageModel = (model) => model ?? DEFAULT_IMAGE_MODEL;
|
|
14963
17050
|
const MULTIMODAL_VISION_MODELS = new Set(OPENAI_MODELS);
|
|
14964
17051
|
/**
|
|
@@ -15047,7 +17134,7 @@ async function makeImagesCall(prompt, options = {}) {
|
|
|
15047
17134
|
throw new Error('No images returned from OpenAI Images API');
|
|
15048
17135
|
}
|
|
15049
17136
|
// Calculate cost
|
|
15050
|
-
const cost = calculateImageCost(imageModel, count || 1);
|
|
17137
|
+
const cost = calculateImageCost(imageModel, count || 1, quality, size);
|
|
15051
17138
|
// Return the response with enhanced usage information
|
|
15052
17139
|
const enhancedResponse = {
|
|
15053
17140
|
...response,
|