Skip to content

Commit 47395b9

Browse files
🌿 Fern Regeneration -- May 30, 2024 (#162)
* SDK regeneration * Fix test * Fix test --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Billy Trend <[email protected]>
1 parent ed3f034 commit 47395b9

File tree

23 files changed

+1870
-821
lines changed

23 files changed

+1870
-821
lines changed

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cohere-ai",
3-
"version": "7.10.1",
3+
"version": "7.10.2",
44
"private": false,
55
"repository": "https://github.com/cohere-ai/cohere-typescript",
66
"main": "./index.js",
@@ -18,7 +18,11 @@
1818
"node-fetch": "2.7.0",
1919
"qs": "6.11.2",
2020
"js-base64": "3.7.2",
21-
"form-data-encoder": "^4.0.2"
21+
"form-data-encoder": "^4.0.2",
22+
"@aws-sdk/client-sagemaker": "^3.583.0",
23+
"@aws-sdk/credential-providers": "^3.583.0",
24+
"@aws-sdk/protocol-http": "^3.374.0",
25+
"@aws-sdk/signature-v4": "^3.374.0"
2226
},
2327
"devDependencies": {
2428
"@types/url-join": "4.0.1",

src/Client.ts

Lines changed: 254 additions & 54 deletions
Large diffs are not rendered by default.

src/api/client/requests/ChatRequest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,6 @@ export interface ChatRequest {
228228
toolResults?: Cohere.ToolResult[];
229229
/** Forces the chat to be single step. Defaults to `false`. */
230230
forceSingleStep?: boolean;
231+
/** (not public yet) Guidance parameters for the generation, forcing the model to output json. */
232+
responseFormat?: Cohere.ChatRequestResponseFormat;
231233
}

src/api/client/requests/ChatStreamRequest.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ import * as Cohere from "../../index";
9494
* }
9595
* }]
9696
* }],
97-
* forceSingleStep: true
97+
* forceSingleStep: true,
98+
* responseFormat: {
99+
* type: "json_object",
100+
* schema: "string"
101+
* }
98102
* }
99103
*/
100104
export interface ChatStreamRequest {
@@ -312,4 +316,6 @@ export interface ChatStreamRequest {
312316
toolResults?: Cohere.ToolResult[];
313317
/** Forces the chat to be single step. Defaults to `false`. */
314318
forceSingleStep?: boolean;
319+
/** (not public yet) Guidance parameters for the generation, forcing the model to output json. */
320+
responseFormat?: Cohere.ChatStreamRequestResponseFormat;
315321
}

src/api/resources/connectors/client/Client.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ export declare namespace Connectors {
1414
environment?: core.Supplier<environments.CohereEnvironment | string>;
1515
token?: core.Supplier<core.BearerToken | undefined>;
1616
clientName?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
2021
timeoutInSeconds?: number;
2122
maxRetries?: number;
23+
abortSignal?: AbortSignal;
2224
}
2325
}
2426

@@ -52,7 +54,7 @@ export class Connectors {
5254
_queryParams["offset"] = offset.toString();
5355
}
5456

55-
const _response = await core.fetcher({
57+
const _response = await (this._options.fetcher ?? core.fetcher)({
5658
url: urlJoin(
5759
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
5860
"connectors"
@@ -66,14 +68,15 @@ export class Connectors {
6668
: undefined,
6769
"X-Fern-Language": "JavaScript",
6870
"X-Fern-SDK-Name": "cohere-ai",
69-
"X-Fern-SDK-Version": "7.10.1",
71+
"X-Fern-SDK-Version": "7.10.2",
7072
"X-Fern-Runtime": core.RUNTIME.type,
7173
"X-Fern-Runtime-Version": core.RUNTIME.version,
7274
},
7375
contentType: "application/json",
7476
queryParameters: _queryParams,
7577
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
7678
maxRetries: requestOptions?.maxRetries,
79+
abortSignal: requestOptions?.abortSignal,
7780
});
7881
if (_response.ok) {
7982
return await serializers.ListConnectorsResponse.parseOrThrow(_response.body, {
@@ -145,7 +148,7 @@ export class Connectors {
145148
request: Cohere.CreateConnectorRequest,
146149
requestOptions?: Connectors.RequestOptions
147150
): Promise<Cohere.CreateConnectorResponse> {
148-
const _response = await core.fetcher({
151+
const _response = await (this._options.fetcher ?? core.fetcher)({
149152
url: urlJoin(
150153
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
151154
"connectors"
@@ -159,7 +162,7 @@ export class Connectors {
159162
: undefined,
160163
"X-Fern-Language": "JavaScript",
161164
"X-Fern-SDK-Name": "cohere-ai",
162-
"X-Fern-SDK-Version": "7.10.1",
165+
"X-Fern-SDK-Version": "7.10.2",
163166
"X-Fern-Runtime": core.RUNTIME.type,
164167
"X-Fern-Runtime-Version": core.RUNTIME.version,
165168
},
@@ -171,6 +174,7 @@ export class Connectors {
171174
}),
172175
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
173176
maxRetries: requestOptions?.maxRetries,
177+
abortSignal: requestOptions?.abortSignal,
174178
});
175179
if (_response.ok) {
176180
return await serializers.CreateConnectorResponse.parseOrThrow(_response.body, {
@@ -238,7 +242,7 @@ export class Connectors {
238242
* await cohere.connectors.get("id")
239243
*/
240244
public async get(id: string, requestOptions?: Connectors.RequestOptions): Promise<Cohere.GetConnectorResponse> {
241-
const _response = await core.fetcher({
245+
const _response = await (this._options.fetcher ?? core.fetcher)({
242246
url: urlJoin(
243247
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
244248
`connectors/${encodeURIComponent(id)}`
@@ -252,13 +256,14 @@ export class Connectors {
252256
: undefined,
253257
"X-Fern-Language": "JavaScript",
254258
"X-Fern-SDK-Name": "cohere-ai",
255-
"X-Fern-SDK-Version": "7.10.1",
259+
"X-Fern-SDK-Version": "7.10.2",
256260
"X-Fern-Runtime": core.RUNTIME.type,
257261
"X-Fern-Runtime-Version": core.RUNTIME.version,
258262
},
259263
contentType: "application/json",
260264
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
261265
maxRetries: requestOptions?.maxRetries,
266+
abortSignal: requestOptions?.abortSignal,
262267
});
263268
if (_response.ok) {
264269
return await serializers.GetConnectorResponse.parseOrThrow(_response.body, {
@@ -330,7 +335,7 @@ export class Connectors {
330335
id: string,
331336
requestOptions?: Connectors.RequestOptions
332337
): Promise<Cohere.DeleteConnectorResponse> {
333-
const _response = await core.fetcher({
338+
const _response = await (this._options.fetcher ?? core.fetcher)({
334339
url: urlJoin(
335340
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
336341
`connectors/${encodeURIComponent(id)}`
@@ -344,13 +349,14 @@ export class Connectors {
344349
: undefined,
345350
"X-Fern-Language": "JavaScript",
346351
"X-Fern-SDK-Name": "cohere-ai",
347-
"X-Fern-SDK-Version": "7.10.1",
352+
"X-Fern-SDK-Version": "7.10.2",
348353
"X-Fern-Runtime": core.RUNTIME.type,
349354
"X-Fern-Runtime-Version": core.RUNTIME.version,
350355
},
351356
contentType: "application/json",
352357
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
353358
maxRetries: requestOptions?.maxRetries,
359+
abortSignal: requestOptions?.abortSignal,
354360
});
355361
if (_response.ok) {
356362
return await serializers.DeleteConnectorResponse.parseOrThrow(_response.body, {
@@ -426,7 +432,7 @@ export class Connectors {
426432
request: Cohere.UpdateConnectorRequest = {},
427433
requestOptions?: Connectors.RequestOptions
428434
): Promise<Cohere.UpdateConnectorResponse> {
429-
const _response = await core.fetcher({
435+
const _response = await (this._options.fetcher ?? core.fetcher)({
430436
url: urlJoin(
431437
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
432438
`connectors/${encodeURIComponent(id)}`
@@ -440,7 +446,7 @@ export class Connectors {
440446
: undefined,
441447
"X-Fern-Language": "JavaScript",
442448
"X-Fern-SDK-Name": "cohere-ai",
443-
"X-Fern-SDK-Version": "7.10.1",
449+
"X-Fern-SDK-Version": "7.10.2",
444450
"X-Fern-Runtime": core.RUNTIME.type,
445451
"X-Fern-Runtime-Version": core.RUNTIME.version,
446452
},
@@ -452,6 +458,7 @@ export class Connectors {
452458
}),
453459
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
454460
maxRetries: requestOptions?.maxRetries,
461+
abortSignal: requestOptions?.abortSignal,
455462
});
456463
if (_response.ok) {
457464
return await serializers.UpdateConnectorResponse.parseOrThrow(_response.body, {
@@ -532,7 +539,7 @@ export class Connectors {
532539
_queryParams["after_token_redirect"] = afterTokenRedirect;
533540
}
534541

535-
const _response = await core.fetcher({
542+
const _response = await (this._options.fetcher ?? core.fetcher)({
536543
url: urlJoin(
537544
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
538545
`connectors/${encodeURIComponent(id)}/oauth/authorize`
@@ -546,14 +553,15 @@ export class Connectors {
546553
: undefined,
547554
"X-Fern-Language": "JavaScript",
548555
"X-Fern-SDK-Name": "cohere-ai",
549-
"X-Fern-SDK-Version": "7.10.1",
556+
"X-Fern-SDK-Version": "7.10.2",
550557
"X-Fern-Runtime": core.RUNTIME.type,
551558
"X-Fern-Runtime-Version": core.RUNTIME.version,
552559
},
553560
contentType: "application/json",
554561
queryParameters: _queryParams,
555562
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
556563
maxRetries: requestOptions?.maxRetries,
564+
abortSignal: requestOptions?.abortSignal,
557565
});
558566
if (_response.ok) {
559567
return await serializers.OAuthAuthorizeResponse.parseOrThrow(_response.body, {

src/api/resources/datasets/client/Client.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export declare namespace Datasets {
1515
environment?: core.Supplier<environments.CohereEnvironment | string>;
1616
token?: core.Supplier<core.BearerToken | undefined>;
1717
clientName?: core.Supplier<string | undefined>;
18+
fetcher?: core.FetchFunction;
1819
}
1920

2021
interface RequestOptions {
2122
timeoutInSeconds?: number;
2223
maxRetries?: number;
24+
abortSignal?: AbortSignal;
2325
}
2426
}
2527

@@ -67,7 +69,7 @@ export class Datasets {
6769
_queryParams["validationStatus"] = validationStatus;
6870
}
6971

70-
const _response = await core.fetcher({
72+
const _response = await (this._options.fetcher ?? core.fetcher)({
7173
url: urlJoin(
7274
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
7375
"datasets"
@@ -81,14 +83,15 @@ export class Datasets {
8183
: undefined,
8284
"X-Fern-Language": "JavaScript",
8385
"X-Fern-SDK-Name": "cohere-ai",
84-
"X-Fern-SDK-Version": "7.10.1",
86+
"X-Fern-SDK-Version": "7.10.2",
8587
"X-Fern-Runtime": core.RUNTIME.type,
8688
"X-Fern-Runtime-Version": core.RUNTIME.version,
8789
},
8890
contentType: "application/json",
8991
queryParameters: _queryParams,
9092
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
9193
maxRetries: requestOptions?.maxRetries,
94+
abortSignal: requestOptions?.abortSignal,
9295
});
9396
if (_response.ok) {
9497
return await serializers.DatasetsListResponse.parseOrThrow(_response.body, {
@@ -203,7 +206,7 @@ export class Datasets {
203206
}
204207

205208
const _maybeEncodedRequest = _request.getRequest();
206-
const _response = await core.fetcher({
209+
const _response = await (this._options.fetcher ?? core.fetcher)({
207210
url: urlJoin(
208211
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
209212
"datasets"
@@ -217,7 +220,7 @@ export class Datasets {
217220
: undefined,
218221
"X-Fern-Language": "JavaScript",
219222
"X-Fern-SDK-Name": "cohere-ai",
220-
"X-Fern-SDK-Version": "7.10.1",
223+
"X-Fern-SDK-Version": "7.10.2",
221224
"X-Fern-Runtime": core.RUNTIME.type,
222225
"X-Fern-Runtime-Version": core.RUNTIME.version,
223226
...(await _maybeEncodedRequest.getHeaders()),
@@ -226,6 +229,7 @@ export class Datasets {
226229
body: await _maybeEncodedRequest.getBody(),
227230
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
228231
maxRetries: requestOptions?.maxRetries,
232+
abortSignal: requestOptions?.abortSignal,
229233
});
230234
if (_response.ok) {
231235
return await serializers.DatasetsCreateResponse.parseOrThrow(_response.body, {
@@ -283,7 +287,7 @@ export class Datasets {
283287
* await cohere.datasets.getUsage()
284288
*/
285289
public async getUsage(requestOptions?: Datasets.RequestOptions): Promise<Cohere.DatasetsGetUsageResponse> {
286-
const _response = await core.fetcher({
290+
const _response = await (this._options.fetcher ?? core.fetcher)({
287291
url: urlJoin(
288292
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
289293
"datasets/usage"
@@ -297,13 +301,14 @@ export class Datasets {
297301
: undefined,
298302
"X-Fern-Language": "JavaScript",
299303
"X-Fern-SDK-Name": "cohere-ai",
300-
"X-Fern-SDK-Version": "7.10.1",
304+
"X-Fern-SDK-Version": "7.10.2",
301305
"X-Fern-Runtime": core.RUNTIME.type,
302306
"X-Fern-Runtime-Version": core.RUNTIME.version,
303307
},
304308
contentType: "application/json",
305309
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
306310
maxRetries: requestOptions?.maxRetries,
311+
abortSignal: requestOptions?.abortSignal,
307312
});
308313
if (_response.ok) {
309314
return await serializers.DatasetsGetUsageResponse.parseOrThrow(_response.body, {
@@ -362,7 +367,7 @@ export class Datasets {
362367
* await cohere.datasets.get("id")
363368
*/
364369
public async get(id: string, requestOptions?: Datasets.RequestOptions): Promise<Cohere.DatasetsGetResponse> {
365-
const _response = await core.fetcher({
370+
const _response = await (this._options.fetcher ?? core.fetcher)({
366371
url: urlJoin(
367372
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
368373
`datasets/${encodeURIComponent(id)}`
@@ -376,13 +381,14 @@ export class Datasets {
376381
: undefined,
377382
"X-Fern-Language": "JavaScript",
378383
"X-Fern-SDK-Name": "cohere-ai",
379-
"X-Fern-SDK-Version": "7.10.1",
384+
"X-Fern-SDK-Version": "7.10.2",
380385
"X-Fern-Runtime": core.RUNTIME.type,
381386
"X-Fern-Runtime-Version": core.RUNTIME.version,
382387
},
383388
contentType: "application/json",
384389
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
385390
maxRetries: requestOptions?.maxRetries,
391+
abortSignal: requestOptions?.abortSignal,
386392
});
387393
if (_response.ok) {
388394
return await serializers.DatasetsGetResponse.parseOrThrow(_response.body, {
@@ -441,7 +447,7 @@ export class Datasets {
441447
* await cohere.datasets.delete("id")
442448
*/
443449
public async delete(id: string, requestOptions?: Datasets.RequestOptions): Promise<Record<string, unknown>> {
444-
const _response = await core.fetcher({
450+
const _response = await (this._options.fetcher ?? core.fetcher)({
445451
url: urlJoin(
446452
(await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production,
447453
`datasets/${encodeURIComponent(id)}`
@@ -455,13 +461,14 @@ export class Datasets {
455461
: undefined,
456462
"X-Fern-Language": "JavaScript",
457463
"X-Fern-SDK-Name": "cohere-ai",
458-
"X-Fern-SDK-Version": "7.10.1",
464+
"X-Fern-SDK-Version": "7.10.2",
459465
"X-Fern-Runtime": core.RUNTIME.type,
460466
"X-Fern-Runtime-Version": core.RUNTIME.version,
461467
},
462468
contentType: "application/json",
463469
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
464470
maxRetries: requestOptions?.maxRetries,
471+
abortSignal: requestOptions?.abortSignal,
465472
});
466473
if (_response.ok) {
467474
return await serializers.datasets.delete.Response.parseOrThrow(_response.body, {

0 commit comments

Comments
 (0)