diff --git a/.fernignore b/.fernignore index 7419241e..ccb5a6e5 100644 --- a/.fernignore +++ b/.fernignore @@ -12,4 +12,5 @@ src/AwsClient.ts src/SagemakerClient.ts src/index.ts src/aws-utils.ts -src/core/streaming-fetcher/streaming-utils.ts \ No newline at end of file +src/core/streaming-fetcher/streaming-utils.ts +src/ClientV2.ts \ No newline at end of file diff --git a/package.json b/package.json index 3a4ac58e..90800b1d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cohere-ai", - "version": "7.11.2", + "version": "7.12.0", "private": false, "repository": "https://github.com/cohere-ai/cohere-typescript", "main": "./index.js", diff --git a/reference.md b/reference.md index 2b403a1a..299afd38 100644 --- a/reference.md +++ b/reference.md @@ -57,6 +57,183 @@ await client.checkApiKey(); ## +## V2 + +
client.v2.chatStream({ ...params }) -> core.Stream +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.v2.chatStream({ + model: "string", + messages: [ + { + role: "assistant", + toolCalls: [ + { + id: "string", + type: "function", + function: { + name: "string", + arguments: "string", + }, + }, + ], + toolPlan: "string", + content: [ + { + text: "string", + }, + ], + citations: [ + { + start: "string", + end: "string", + text: "string", + sources: [ + { + type: "tool", + id: "string", + toolOutput: { + string: { + key: "value", + }, + }, + }, + ], + }, + ], + }, + ], + tools: [ + { + type: "function", + function: { + name: "string", + description: "string", + parameters: { + string: { + key: "value", + }, + }, + }, + }, + ], + toolChoice: Cohere.V2ChatStreamRequestToolChoice.Auto, + citationMode: Cohere.V2ChatStreamRequestCitationMode.Fast, + truncationMode: Cohere.V2ChatStreamRequestTruncationMode.Off, + responseFormat: { + type: "json_object", + schema: { + string: { + key: "value", + }, + }, + }, + maxTokens: 1, + stopSequences: ["string"], + maxInputTokens: 1, + temperature: 1.1, + seed: 1, + frequencyPenalty: 1.1, + presencePenalty: 1.1, + k: 1, + p: 1, + returnPrompt: true, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Cohere.V2ChatStreamRequest` + +
+
+ +
+
+ +**requestOptions:** `V2.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.v2.chat({ ...params }) -> Cohere.NonStreamedChatResponse2 +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.v2.chat({ + model: "model", + messages: [], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Cohere.V2ChatRequest` + +
+
+ +
+
+ +**requestOptions:** `V2.RequestOptions` + +
+
+
+
+ +
+
+
+ ## EmbedJobs
client.embedJobs.list() -> Cohere.ListEmbedJobResponse diff --git a/src/Client.ts b/src/Client.ts index 851bd95a..e7bc7203 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -9,6 +9,7 @@ import * as serializers from "./serialization/index"; import urlJoin from "url-join"; import * as stream from "readable-stream"; import * as errors from "./errors/index"; +import { V2 } from "./api/resources/v2/client/Client"; import { EmbedJobs } from "./api/resources/embedJobs/client/Client"; import { Datasets } from "./api/resources/datasets/client/Client"; import { Connectors } from "./api/resources/connectors/client/Client"; @@ -50,7 +51,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "chat" + "v1/chat" ), method: "POST", headers: { @@ -61,7 +62,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -220,7 +221,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "chat" + "v1/chat" ), method: "POST", headers: { @@ -231,7 +232,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -360,7 +361,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "generate" + "v1/generate" ), method: "POST", headers: { @@ -371,7 +372,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -531,7 +532,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "generate" + "v1/generate" ), method: "POST", headers: { @@ -542,7 +543,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -695,7 +696,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "embed" + "v1/embed" ), method: "POST", headers: { @@ -706,7 +707,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -850,7 +851,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "rerank" + "v1/rerank" ), method: "POST", headers: { @@ -861,7 +862,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1035,7 +1036,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "classify" + "v1/classify" ), method: "POST", headers: { @@ -1046,7 +1047,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1192,7 +1193,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "summarize" + "v1/summarize" ), method: "POST", headers: { @@ -1203,7 +1204,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1346,7 +1347,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "tokenize" + "v1/tokenize" ), method: "POST", headers: { @@ -1357,7 +1358,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1500,7 +1501,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "detokenize" + "v1/detokenize" ), method: "POST", headers: { @@ -1511,7 +1512,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1647,7 +1648,7 @@ export class CohereClient { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "check-api-key" + "v1/check-api-key" ), method: "POST", headers: { @@ -1658,7 +1659,7 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -1765,6 +1766,12 @@ export class CohereClient { } } + protected _v2: V2 | undefined; + + public get v2(): V2 { + return (this._v2 ??= new V2(this._options)); + } + protected _embedJobs: EmbedJobs | undefined; public get embedJobs(): EmbedJobs { diff --git a/src/ClientV2.ts b/src/ClientV2.ts new file mode 100644 index 00000000..6230161c --- /dev/null +++ b/src/ClientV2.ts @@ -0,0 +1,30 @@ +import { V2 } from "./api/resources/v2/client/Client"; +import { CohereClient } from "./Client"; + +// this class will require manual updates over time +export class CohereClientV2 implements Omit, Pick { + constructor(private _options: CohereClient.Options) { + } + + private client = new CohereClient(this._options); + private clientV2 = new V2(this._options); + + chat = this.clientV2.chat.bind(this.clientV2) + chatStream = this.clientV2.chatStream.bind(this.clientV2) + + generateStream = this.client.generateStream.bind(this.clientV2) + generate = this.client.generate.bind(this.clientV2) + embed = this.client.embed.bind(this.clientV2) + rerank = this.client.rerank.bind(this.clientV2) + classify = this.client.classify.bind(this.clientV2) + summarize = this.client.summarize.bind(this.clientV2) + tokenize = this.client.tokenize.bind(this.clientV2) + detokenize = this.client.detokenize.bind(this.clientV2) + checkApiKey = this.client.checkApiKey.bind(this.clientV2) + + embedJobs = this.client.embedJobs + datasets = this.client.datasets + connectors = this.client.connectors + models = this.client.models + finetuning = this.client.finetuning +} \ No newline at end of file diff --git a/src/api/resources/connectors/client/Client.ts b/src/api/resources/connectors/client/Client.ts index 548ccc88..07b1341f 100644 --- a/src/api/resources/connectors/client/Client.ts +++ b/src/api/resources/connectors/client/Client.ts @@ -71,7 +71,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "connectors" + "v1/connectors" ), method: "GET", headers: { @@ -82,7 +82,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -221,7 +221,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "connectors" + "v1/connectors" ), method: "POST", headers: { @@ -232,7 +232,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -369,7 +369,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `connectors/${encodeURIComponent(id)}` + `v1/connectors/${encodeURIComponent(id)}` ), method: "GET", headers: { @@ -380,7 +380,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -515,7 +515,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `connectors/${encodeURIComponent(id)}` + `v1/connectors/${encodeURIComponent(id)}` ), method: "DELETE", headers: { @@ -526,7 +526,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -663,7 +663,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `connectors/${encodeURIComponent(id)}` + `v1/connectors/${encodeURIComponent(id)}` ), method: "PATCH", headers: { @@ -674,7 +674,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -822,7 +822,7 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `connectors/${encodeURIComponent(id)}/oauth/authorize` + `v1/connectors/${encodeURIComponent(id)}/oauth/authorize` ), method: "POST", headers: { @@ -833,7 +833,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/datasets/client/Client.ts b/src/api/resources/datasets/client/Client.ts index 2dae5f17..bf6ef976 100644 --- a/src/api/resources/datasets/client/Client.ts +++ b/src/api/resources/datasets/client/Client.ts @@ -89,7 +89,7 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "datasets" + "v1/datasets" ), method: "GET", headers: { @@ -100,7 +100,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -289,7 +289,7 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "datasets" + "v1/datasets" ), method: "POST", headers: { @@ -300,7 +300,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ..._maybeEncodedRequest.headers, @@ -434,7 +434,7 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "datasets/usage" + "v1/datasets/usage" ), method: "GET", headers: { @@ -445,7 +445,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -577,7 +577,7 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `datasets/${encodeURIComponent(id)}` + `v1/datasets/${encodeURIComponent(id)}` ), method: "GET", headers: { @@ -588,7 +588,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -720,7 +720,7 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `datasets/${encodeURIComponent(id)}` + `v1/datasets/${encodeURIComponent(id)}` ), method: "DELETE", headers: { @@ -731,7 +731,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/embedJobs/client/Client.ts b/src/api/resources/embedJobs/client/Client.ts index d492778d..ded25608 100644 --- a/src/api/resources/embedJobs/client/Client.ts +++ b/src/api/resources/embedJobs/client/Client.ts @@ -57,7 +57,7 @@ export class EmbedJobs { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "embed-jobs" + "v1/embed-jobs" ), method: "GET", headers: { @@ -68,7 +68,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -207,7 +207,7 @@ export class EmbedJobs { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "embed-jobs" + "v1/embed-jobs" ), method: "POST", headers: { @@ -218,7 +218,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -355,7 +355,7 @@ export class EmbedJobs { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `embed-jobs/${encodeURIComponent(id)}` + `v1/embed-jobs/${encodeURIComponent(id)}` ), method: "GET", headers: { @@ -366,7 +366,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -498,7 +498,7 @@ export class EmbedJobs { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `embed-jobs/${encodeURIComponent(id)}/cancel` + `v1/embed-jobs/${encodeURIComponent(id)}/cancel` ), method: "POST", headers: { @@ -509,7 +509,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/finetuning/client/Client.ts b/src/api/resources/finetuning/client/Client.ts index 3aeb2d9f..a8fd9738 100644 --- a/src/api/resources/finetuning/client/Client.ts +++ b/src/api/resources/finetuning/client/Client.ts @@ -71,7 +71,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "finetuning/finetuned-models" + "v1/finetuning/finetuned-models" ), method: "GET", headers: { @@ -82,7 +82,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -169,7 +169,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "finetuning/finetuned-models" + "v1/finetuning/finetuned-models" ), method: "POST", headers: { @@ -180,7 +180,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -263,7 +263,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `finetuning/finetuned-models/${encodeURIComponent(id)}` + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` ), method: "GET", headers: { @@ -274,7 +274,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -352,7 +352,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `finetuning/finetuned-models/${encodeURIComponent(id)}` + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` ), method: "DELETE", headers: { @@ -363,7 +363,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -451,7 +451,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `finetuning/finetuned-models/${encodeURIComponent(id)}` + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` ), method: "PATCH", headers: { @@ -462,7 +462,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -561,7 +561,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/events` + `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/events` ), method: "GET", headers: { @@ -572,7 +572,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -663,7 +663,7 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/training-step-metrics` + `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/training-step-metrics` ), method: "GET", headers: { @@ -674,7 +674,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/finetuning/resources/finetuning/types/Settings.ts b/src/api/resources/finetuning/resources/finetuning/types/Settings.ts index c12befa1..097281c9 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/Settings.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/Settings.ts @@ -16,4 +16,6 @@ export interface Settings { hyperparameters?: Cohere.finetuning.Hyperparameters; /** read-only. Whether the model is single-label or multi-label (only for classification). */ multiLabel?: boolean; + /** The Weights & Biases configuration. */ + wandb?: Cohere.finetuning.WandbConfig; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts b/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts new file mode 100644 index 00000000..d031967a --- /dev/null +++ b/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The Weights & Biases configuration. + */ +export interface WandbConfig { + /** The WandB project name to be used during training. */ + project: string; + /** The WandB API key to be used during training. */ + apiKey: string; + /** The WandB entity name to be used during training. */ + entity?: string; +} diff --git a/src/api/resources/finetuning/resources/finetuning/types/index.ts b/src/api/resources/finetuning/resources/finetuning/types/index.ts index 94b55ae4..f3727066 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/index.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/index.ts @@ -2,6 +2,7 @@ export * from "./BaseType"; export * from "./Strategy"; export * from "./BaseModel"; export * from "./Hyperparameters"; +export * from "./WandbConfig"; export * from "./Settings"; export * from "./Status"; export * from "./FinetunedModel"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 4e7a494b..829d2684 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,3 +1,5 @@ +export * as v2 from "./v2"; +export * from "./v2/types"; export * as embedJobs from "./embedJobs"; export * from "./embedJobs/types"; export * as datasets from "./datasets"; @@ -5,6 +7,7 @@ export * from "./datasets/types"; export * as finetuning from "./finetuning"; export * as connectors from "./connectors"; export * as models from "./models"; +export * from "./v2/client/requests"; export * from "./embedJobs/client/requests"; export * from "./datasets/client/requests"; export * from "./connectors/client/requests"; diff --git a/src/api/resources/models/client/Client.ts b/src/api/resources/models/client/Client.ts index 7c45f852..fac284a6 100644 --- a/src/api/resources/models/client/Client.ts +++ b/src/api/resources/models/client/Client.ts @@ -58,7 +58,7 @@ export class Models { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `models/${encodeURIComponent(model)}` + `v1/models/${encodeURIComponent(model)}` ), method: "GET", headers: { @@ -69,7 +69,7 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -222,7 +222,7 @@ export class Models { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "models" + "v1/models" ), method: "GET", headers: { @@ -233,7 +233,7 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.11.2", + "X-Fern-SDK-Version": "7.12.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/v2/client/Client.ts b/src/api/resources/v2/client/Client.ts new file mode 100644 index 00000000..01705a0a --- /dev/null +++ b/src/api/resources/v2/client/Client.ts @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Cohere from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as stream from "readable-stream"; +import * as errors from "../../../../errors/index"; + +export declare namespace V2 { + interface Options { + environment?: core.Supplier; + token?: core.Supplier; + /** Override the X-Client-Name header */ + clientName?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the X-Client-Name header */ + clientName?: string | undefined; + } +} + +export class V2 { + constructor(protected readonly _options: V2.Options = {}) {} + + public async chatStream( + request: Cohere.V2ChatStreamRequest, + requestOptions?: V2.RequestOptions + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v2/chat" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.12.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: { + ...serializers.V2ChatStreamRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + stream: true, + }, + responseType: "sse", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return new core.Stream({ + stream: _response.body, + parse: async (data) => { + return serializers.StreamedChatResponse2.parseOrThrow(data, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + }, + signal: requestOptions?.abortSignal, + eventShape: { + type: "sse", + streamTerminator: "[DONE]", + }, + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 401: + throw new Cohere.UnauthorizedError(_response.error.body); + case 403: + throw new Cohere.ForbiddenError(_response.error.body); + case 404: + throw new Cohere.NotFoundError(_response.error.body); + case 422: + throw new Cohere.UnprocessableEntityError( + serializers.UnprocessableEntityErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Cohere.TooManyRequestsError( + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 499: + throw new Cohere.ClientClosedRequestError( + serializers.ClientClosedRequestErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + case 501: + throw new Cohere.NotImplementedError( + serializers.NotImplementedErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Cohere.ServiceUnavailableError(_response.error.body); + case 504: + throw new Cohere.GatewayTimeoutError( + serializers.GatewayTimeoutErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * @param {Cohere.V2ChatRequest} request + * @param {V2.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.UnauthorizedError} + * @throws {@link Cohere.ForbiddenError} + * @throws {@link Cohere.NotFoundError} + * @throws {@link Cohere.UnprocessableEntityError} + * @throws {@link Cohere.TooManyRequestsError} + * @throws {@link Cohere.ClientClosedRequestError} + * @throws {@link Cohere.InternalServerError} + * @throws {@link Cohere.NotImplementedError} + * @throws {@link Cohere.ServiceUnavailableError} + * @throws {@link Cohere.GatewayTimeoutError} + * + * @example + * await client.v2.chat({ + * model: "model", + * messages: [] + * }) + */ + public async chat( + request: Cohere.V2ChatRequest, + requestOptions?: V2.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v2/chat" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Client-Name": + (await core.Supplier.get(this._options.clientName)) != null + ? await core.Supplier.get(this._options.clientName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.12.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: { + ...serializers.V2ChatRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + stream: false, + }, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.NonStreamedChatResponse2.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 401: + throw new Cohere.UnauthorizedError(_response.error.body); + case 403: + throw new Cohere.ForbiddenError(_response.error.body); + case 404: + throw new Cohere.NotFoundError(_response.error.body); + case 422: + throw new Cohere.UnprocessableEntityError( + serializers.UnprocessableEntityErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Cohere.TooManyRequestsError( + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 499: + throw new Cohere.ClientClosedRequestError( + serializers.ClientClosedRequestErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + case 501: + throw new Cohere.NotImplementedError( + serializers.NotImplementedErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Cohere.ServiceUnavailableError(_response.error.body); + case 504: + throw new Cohere.GatewayTimeoutError( + serializers.GatewayTimeoutErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["CO_API_KEY"]; + if (bearer == null) { + throw new errors.CohereError({ + message: "Please specify CO_API_KEY when instantiating the client.", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/v2/client/index.ts b/src/api/resources/v2/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/v2/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/v2/client/requests/V2ChatRequest.ts b/src/api/resources/v2/client/requests/V2ChatRequest.ts new file mode 100644 index 00000000..b2f7a277 --- /dev/null +++ b/src/api/resources/v2/client/requests/V2ChatRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../../index"; + +/** + * @example + * { + * model: "model", + * messages: [] + * } + */ +export interface V2ChatRequest { + /** The model to use for the chat. */ + model: string; + messages: Cohere.ChatMessages; + tools?: Cohere.Tool2[]; + toolChoice?: Cohere.V2ChatRequestToolChoice; + citationMode?: Cohere.V2ChatRequestCitationMode; + truncationMode?: Cohere.V2ChatRequestTruncationMode; + responseFormat?: Cohere.V2ChatRequestResponseFormat; + /** The maximum number of tokens to generate. */ + maxTokens?: number; + /** A list of strings that the model will stop generating at. */ + stopSequences?: string[]; + /** The maximum number of tokens to feed into the model. */ + maxInputTokens?: number; + /** The temperature of the model. */ + temperature?: number; + seed?: number; + /** The frequency penalty of the model. */ + frequencyPenalty?: number; + /** The presence penalty of the model. */ + presencePenalty?: number; + k?: number; + p?: number; + /** Whether to return the prompt in the response. */ + returnPrompt?: boolean; +} diff --git a/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts b/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts new file mode 100644 index 00000000..0ade54b7 --- /dev/null +++ b/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../../index"; + +/** + * @example + * { + * model: "string", + * messages: [{ + * role: "assistant", + * toolCalls: [{ + * id: "string", + * type: "function", + * function: { + * name: "string", + * arguments: "string" + * } + * }], + * toolPlan: "string", + * content: [{ + * text: "string" + * }], + * citations: [{ + * start: "string", + * end: "string", + * text: "string", + * sources: [{ + * type: "tool", + * id: "string", + * toolOutput: { + * "string": { + * "key": "value" + * } + * } + * }] + * }] + * }], + * tools: [{ + * type: "function", + * function: { + * name: "string", + * description: "string", + * parameters: { + * "string": { + * "key": "value" + * } + * } + * } + * }], + * toolChoice: Cohere.V2ChatStreamRequestToolChoice.Auto, + * citationMode: Cohere.V2ChatStreamRequestCitationMode.Fast, + * truncationMode: Cohere.V2ChatStreamRequestTruncationMode.Off, + * responseFormat: { + * type: "json_object", + * schema: { + * "string": { + * "key": "value" + * } + * } + * }, + * maxTokens: 1, + * stopSequences: ["string"], + * maxInputTokens: 1, + * temperature: 1.1, + * seed: 1, + * frequencyPenalty: 1.1, + * presencePenalty: 1.1, + * k: 1, + * p: 1, + * returnPrompt: true + * } + */ +export interface V2ChatStreamRequest { + /** The model to use for the chat. */ + model: string; + messages: Cohere.ChatMessages; + tools?: Cohere.Tool2[]; + toolChoice?: Cohere.V2ChatStreamRequestToolChoice; + citationMode?: Cohere.V2ChatStreamRequestCitationMode; + truncationMode?: Cohere.V2ChatStreamRequestTruncationMode; + responseFormat?: Cohere.V2ChatStreamRequestResponseFormat; + /** The maximum number of tokens to generate. */ + maxTokens?: number; + /** A list of strings that the model will stop generating at. */ + stopSequences?: string[]; + /** The maximum number of tokens to feed into the model. */ + maxInputTokens?: number; + /** The temperature of the model. */ + temperature?: number; + seed?: number; + /** The frequency penalty of the model. */ + frequencyPenalty?: number; + /** The presence penalty of the model. */ + presencePenalty?: number; + k?: number; + p?: number; + /** Whether to return the prompt in the response. */ + returnPrompt?: boolean; +} diff --git a/src/api/resources/v2/client/requests/index.ts b/src/api/resources/v2/client/requests/index.ts new file mode 100644 index 00000000..e73d612e --- /dev/null +++ b/src/api/resources/v2/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type V2ChatStreamRequest } from "./V2ChatStreamRequest"; +export { type V2ChatRequest } from "./V2ChatRequest"; diff --git a/src/api/resources/v2/index.ts b/src/api/resources/v2/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/v2/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/v2/types/AssistantMessage.ts b/src/api/resources/v2/types/AssistantMessage.ts new file mode 100644 index 00000000..4d93549f --- /dev/null +++ b/src/api/resources/v2/types/AssistantMessage.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A message from the assistant role can contain text and tool call information. + */ +export interface AssistantMessage { + toolCalls?: Cohere.ToolCall2[]; + toolPlan?: string; + content?: Cohere.TextContent[]; + citations?: Cohere.Citation[]; +} diff --git a/src/api/resources/v2/types/ChatContentDeltaEvent.ts b/src/api/resources/v2/types/ChatContentDeltaEvent.ts new file mode 100644 index 00000000..17b75f1f --- /dev/null +++ b/src/api/resources/v2/types/ChatContentDeltaEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed delta event which contains a delta of chat text content. + */ +export interface ChatContentDeltaEvent extends Cohere.ChatStreamEventType { + index?: number; + delta?: Cohere.ChatContentDeltaEventDelta; +} diff --git a/src/api/resources/v2/types/ChatContentDeltaEventDelta.ts b/src/api/resources/v2/types/ChatContentDeltaEventDelta.ts new file mode 100644 index 00000000..a0177036 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentDeltaEventDelta.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatContentDeltaEventDelta { + message?: Cohere.ChatContentDeltaEventDeltaMessage; +} diff --git a/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts b/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts new file mode 100644 index 00000000..18a633d1 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatContentDeltaEventDeltaMessage { + content?: Cohere.ChatContentDeltaEventDeltaMessageContent; +} diff --git a/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts b/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts new file mode 100644 index 00000000..f437fbb8 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatContentDeltaEventDeltaMessageContent { + text?: string; +} diff --git a/src/api/resources/v2/types/ChatContentEndEvent.ts b/src/api/resources/v2/types/ChatContentEndEvent.ts new file mode 100644 index 00000000..5e9bdf50 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentEndEvent.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed delta event which signifies that the content block has ended. + */ +export interface ChatContentEndEvent extends Cohere.ChatStreamEventType { + index?: number; +} diff --git a/src/api/resources/v2/types/ChatContentStartEvent.ts b/src/api/resources/v2/types/ChatContentStartEvent.ts new file mode 100644 index 00000000..54415bce --- /dev/null +++ b/src/api/resources/v2/types/ChatContentStartEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed delta event which signifies that a new content block has started. + */ +export interface ChatContentStartEvent extends Cohere.ChatStreamEventType { + index?: number; + delta?: Cohere.ChatContentStartEventDelta; +} diff --git a/src/api/resources/v2/types/ChatContentStartEventDelta.ts b/src/api/resources/v2/types/ChatContentStartEventDelta.ts new file mode 100644 index 00000000..870b4a00 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentStartEventDelta.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatContentStartEventDelta { + message?: Cohere.ChatContentStartEventDeltaMessage; +} diff --git a/src/api/resources/v2/types/ChatContentStartEventDeltaMessage.ts b/src/api/resources/v2/types/ChatContentStartEventDeltaMessage.ts new file mode 100644 index 00000000..6e0d2968 --- /dev/null +++ b/src/api/resources/v2/types/ChatContentStartEventDeltaMessage.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatContentStartEventDeltaMessage { + content?: Cohere.ChatContentStartEventDeltaMessageContent; +} diff --git a/src/api/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts b/src/api/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts new file mode 100644 index 00000000..690268da --- /dev/null +++ b/src/api/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatContentStartEventDeltaMessageContent { + text?: string; + type?: "text"; +} diff --git a/src/api/resources/v2/types/ChatFinishReason.ts b/src/api/resources/v2/types/ChatFinishReason.ts new file mode 100644 index 00000000..290fe75f --- /dev/null +++ b/src/api/resources/v2/types/ChatFinishReason.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The reason a chat request has finished. + */ +export type ChatFinishReason = + | "complete" + | "stop_sequence" + | "max_tokens" + | "tool_call" + | "error" + | "content_blocked" + | "error_limit"; + +export const ChatFinishReason = { + Complete: "complete", + StopSequence: "stop_sequence", + MaxTokens: "max_tokens", + ToolCall: "tool_call", + Error: "error", + ContentBlocked: "content_blocked", + ErrorLimit: "error_limit", +} as const; diff --git a/src/api/resources/v2/types/ChatMessage2.ts b/src/api/resources/v2/types/ChatMessage2.ts new file mode 100644 index 00000000..d98cbd1e --- /dev/null +++ b/src/api/resources/v2/types/ChatMessage2.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * Represents a single message in the chat history from a given role. + */ +export type ChatMessage2 = + | Cohere.ChatMessage2.Assistant + | Cohere.ChatMessage2.System + | Cohere.ChatMessage2.User + | Cohere.ChatMessage2.Tool; + +export declare namespace ChatMessage2 { + interface Assistant extends Cohere.AssistantMessage { + role: "assistant"; + } + + interface System extends Cohere.SystemMessage { + role: "system"; + } + + interface User extends Cohere.UserMessage { + role: "user"; + } + + interface Tool extends Cohere.ToolMessage2 { + role: "tool"; + } +} diff --git a/src/api/resources/v2/types/ChatMessageEndEvent.ts b/src/api/resources/v2/types/ChatMessageEndEvent.ts new file mode 100644 index 00000000..dc63fceb --- /dev/null +++ b/src/api/resources/v2/types/ChatMessageEndEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event which signifies that the chat message has ended. + */ +export interface ChatMessageEndEvent extends Cohere.ChatStreamEventType { + id?: string; + delta?: Cohere.ChatMessageEndEventDelta; +} diff --git a/src/api/resources/v2/types/ChatMessageEndEventDelta.ts b/src/api/resources/v2/types/ChatMessageEndEventDelta.ts new file mode 100644 index 00000000..890f916d --- /dev/null +++ b/src/api/resources/v2/types/ChatMessageEndEventDelta.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatMessageEndEventDelta { + finishReason?: Cohere.ChatFinishReason; + usage?: Cohere.Usage; +} diff --git a/src/api/resources/v2/types/ChatMessageStartEvent.ts b/src/api/resources/v2/types/ChatMessageStartEvent.ts new file mode 100644 index 00000000..cc7f7e09 --- /dev/null +++ b/src/api/resources/v2/types/ChatMessageStartEvent.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event which signifies that a stream has started. + */ +export interface ChatMessageStartEvent extends Cohere.ChatStreamEventType { + /** Unique identifier for the generated reply. */ + id?: string; + delta?: Cohere.ChatMessageStartEventDelta; +} diff --git a/src/api/resources/v2/types/ChatMessageStartEventDelta.ts b/src/api/resources/v2/types/ChatMessageStartEventDelta.ts new file mode 100644 index 00000000..850b2a3f --- /dev/null +++ b/src/api/resources/v2/types/ChatMessageStartEventDelta.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatMessageStartEventDelta { + message?: Cohere.ChatMessageStartEventDeltaMessage; +} diff --git a/src/api/resources/v2/types/ChatMessageStartEventDeltaMessage.ts b/src/api/resources/v2/types/ChatMessageStartEventDeltaMessage.ts new file mode 100644 index 00000000..4f6d664c --- /dev/null +++ b/src/api/resources/v2/types/ChatMessageStartEventDeltaMessage.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatMessageStartEventDeltaMessage { + /** The role of the message. */ + role?: "assistant"; +} diff --git a/src/api/resources/v2/types/ChatMessages.ts b/src/api/resources/v2/types/ChatMessages.ts new file mode 100644 index 00000000..e6cd094a --- /dev/null +++ b/src/api/resources/v2/types/ChatMessages.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A list of chat messages representing the list chat message turns. + */ +export type ChatMessages = Cohere.ChatMessage2[]; diff --git a/src/api/resources/v2/types/ChatStreamEventType.ts b/src/api/resources/v2/types/ChatStreamEventType.ts new file mode 100644 index 00000000..76f613d7 --- /dev/null +++ b/src/api/resources/v2/types/ChatStreamEventType.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The streamed event types + */ +export interface ChatStreamEventType {} diff --git a/src/api/resources/v2/types/ChatToolCallDeltaEvent.ts b/src/api/resources/v2/types/ChatToolCallDeltaEvent.ts new file mode 100644 index 00000000..54b35fd6 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallDeltaEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event delta which signifies a delta in tool call arguments. + */ +export interface ChatToolCallDeltaEvent extends Cohere.ChatStreamEventType { + index?: number; + delta?: Cohere.ChatToolCallDeltaEventDelta; +} diff --git a/src/api/resources/v2/types/ChatToolCallDeltaEventDelta.ts b/src/api/resources/v2/types/ChatToolCallDeltaEventDelta.ts new file mode 100644 index 00000000..aa10ed28 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallDeltaEventDelta.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatToolCallDeltaEventDelta { + toolCall?: Cohere.ChatToolCallDeltaEventDeltaToolCall; +} diff --git a/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts b/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts new file mode 100644 index 00000000..d95c3117 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatToolCallDeltaEventDeltaToolCall { + function?: Cohere.ChatToolCallDeltaEventDeltaToolCallFunction; +} diff --git a/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts b/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts new file mode 100644 index 00000000..5c6f0ce8 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatToolCallDeltaEventDeltaToolCallFunction { + arguments?: string; +} diff --git a/src/api/resources/v2/types/ChatToolCallEndEvent.ts b/src/api/resources/v2/types/ChatToolCallEndEvent.ts new file mode 100644 index 00000000..65815d7e --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallEndEvent.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event delta which signifies a tool call has finished streaming. + */ +export interface ChatToolCallEndEvent extends Cohere.ChatStreamEventType { + index?: number; +} diff --git a/src/api/resources/v2/types/ChatToolCallStartEvent.ts b/src/api/resources/v2/types/ChatToolCallStartEvent.ts new file mode 100644 index 00000000..5a296279 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallStartEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event delta which signifies a tool call has started streaming. + */ +export interface ChatToolCallStartEvent extends Cohere.ChatStreamEventType { + index?: number; + delta?: Cohere.ChatToolCallStartEventDelta; +} diff --git a/src/api/resources/v2/types/ChatToolCallStartEventDelta.ts b/src/api/resources/v2/types/ChatToolCallStartEventDelta.ts new file mode 100644 index 00000000..564957e0 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallStartEventDelta.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatToolCallStartEventDelta { + toolCall?: Cohere.ChatToolCallStartEventDeltaToolCall; +} diff --git a/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts b/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts new file mode 100644 index 00000000..a387e779 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface ChatToolCallStartEventDeltaToolCall { + id?: string; + type?: "function"; + function?: Cohere.ChatToolCallStartEventDeltaToolCallFunction; +} diff --git a/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts b/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts new file mode 100644 index 00000000..03446d43 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatToolCallStartEventDeltaToolCallFunction { + name?: string; + arguments?: string; +} diff --git a/src/api/resources/v2/types/ChatToolPlanDeltaEvent.ts b/src/api/resources/v2/types/ChatToolPlanDeltaEvent.ts new file mode 100644 index 00000000..5c4d2957 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolPlanDeltaEvent.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A streamed event which contains a delta of tool plan text. + */ +export interface ChatToolPlanDeltaEvent extends Cohere.ChatStreamEventType { + delta?: Cohere.ChatToolPlanDeltaEventDelta; +} diff --git a/src/api/resources/v2/types/ChatToolPlanDeltaEventDelta.ts b/src/api/resources/v2/types/ChatToolPlanDeltaEventDelta.ts new file mode 100644 index 00000000..59d4bb31 --- /dev/null +++ b/src/api/resources/v2/types/ChatToolPlanDeltaEventDelta.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatToolPlanDeltaEventDelta { + toolPlan?: string; +} diff --git a/src/api/resources/v2/types/Citation.ts b/src/api/resources/v2/types/Citation.ts new file mode 100644 index 00000000..cbb0515e --- /dev/null +++ b/src/api/resources/v2/types/Citation.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * Citation information containing sources and the text cited. + */ +export interface Citation { + start?: string; + end?: string; + text?: string; + sources?: Cohere.Source[]; +} diff --git a/src/api/resources/v2/types/Content.ts b/src/api/resources/v2/types/Content.ts new file mode 100644 index 00000000..d7ebade2 --- /dev/null +++ b/src/api/resources/v2/types/Content.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A Content block which contains information about the content type and the content itself. + */ +export type Content = Cohere.Content.Text | Cohere.Content.Document; + +export declare namespace Content { + interface Text extends Cohere.TextContent { + type: "text"; + } + + interface Document extends Cohere.DocumentContent { + type: "document"; + } +} diff --git a/src/api/resources/v2/types/DocumentContent.ts b/src/api/resources/v2/types/DocumentContent.ts new file mode 100644 index 00000000..ea828c62 --- /dev/null +++ b/src/api/resources/v2/types/DocumentContent.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Content block of the message that contains information about documents. + */ +export interface DocumentContent { + id: string; + document: Record; +} diff --git a/src/api/resources/v2/types/DocumentSource.ts b/src/api/resources/v2/types/DocumentSource.ts new file mode 100644 index 00000000..b048b24e --- /dev/null +++ b/src/api/resources/v2/types/DocumentSource.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A document source object containing the unique identifier of the document and the document itself. + */ +export interface DocumentSource { + /** The unique identifier of the document */ + id?: string; + document?: Record; +} diff --git a/src/api/resources/v2/types/NonStreamedChatResponse2.ts b/src/api/resources/v2/types/NonStreamedChatResponse2.ts new file mode 100644 index 00000000..4a07eee5 --- /dev/null +++ b/src/api/resources/v2/types/NonStreamedChatResponse2.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface NonStreamedChatResponse2 { + /** Unique identifier for the generated reply. Useful for submitting feedback. */ + id: string; + finishReason: Cohere.ChatFinishReason; + /** The prompt that was used. Only present when `return_prompt` in the request is set to true. */ + prompt?: string; + message?: Cohere.AssistantMessage; + usage?: Cohere.Usage; +} diff --git a/src/api/resources/v2/types/Source.ts b/src/api/resources/v2/types/Source.ts new file mode 100644 index 00000000..5ba0b92b --- /dev/null +++ b/src/api/resources/v2/types/Source.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A source object containing information about the source of the data cited. + */ +export type Source = Cohere.Source.Tool | Cohere.Source.Document; + +export declare namespace Source { + interface Tool extends Cohere.ToolSource { + type: "tool"; + } + + interface Document extends Cohere.DocumentSource { + type: "document"; + } +} diff --git a/src/api/resources/v2/types/StreamedChatResponse2.ts b/src/api/resources/v2/types/StreamedChatResponse2.ts new file mode 100644 index 00000000..5577ed1e --- /dev/null +++ b/src/api/resources/v2/types/StreamedChatResponse2.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request). + */ +export type StreamedChatResponse2 = + | Cohere.StreamedChatResponse2.MessageStart + | Cohere.StreamedChatResponse2.ContentStart + | Cohere.StreamedChatResponse2.ContentDelta + | Cohere.StreamedChatResponse2.ContentEnd + | Cohere.StreamedChatResponse2.ToolPlanDelta + | Cohere.StreamedChatResponse2.ToolCallStart + | Cohere.StreamedChatResponse2.ToolCallDelta + | Cohere.StreamedChatResponse2.ToolCallEnd + | Cohere.StreamedChatResponse2.MessageEnd; + +export declare namespace StreamedChatResponse2 { + interface MessageStart extends Cohere.ChatMessageStartEvent { + type: "message-start"; + } + + interface ContentStart extends Cohere.ChatContentStartEvent { + type: "content-start"; + } + + interface ContentDelta extends Cohere.ChatContentDeltaEvent { + type: "content-delta"; + } + + interface ContentEnd extends Cohere.ChatContentEndEvent { + type: "content-end"; + } + + interface ToolPlanDelta extends Cohere.ChatToolPlanDeltaEvent { + type: "tool-plan-delta"; + } + + interface ToolCallStart extends Cohere.ChatToolCallStartEvent { + type: "tool-call-start"; + } + + interface ToolCallDelta extends Cohere.ChatToolCallDeltaEvent { + type: "tool-call-delta"; + } + + interface ToolCallEnd extends Cohere.ChatToolCallEndEvent { + type: "tool-call-end"; + } + + interface MessageEnd extends Cohere.ChatMessageEndEvent { + type: "message-end"; + } +} diff --git a/src/api/resources/v2/types/SystemMessage.ts b/src/api/resources/v2/types/SystemMessage.ts new file mode 100644 index 00000000..3efa6127 --- /dev/null +++ b/src/api/resources/v2/types/SystemMessage.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A message from the system. + */ +export interface SystemMessage { + content: Cohere.SystemMessageContent; +} diff --git a/src/api/resources/v2/types/SystemMessageContent.ts b/src/api/resources/v2/types/SystemMessageContent.ts new file mode 100644 index 00000000..656e5d84 --- /dev/null +++ b/src/api/resources/v2/types/SystemMessageContent.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export type SystemMessageContent = string | Cohere.SystemMessageContentItem[]; diff --git a/src/api/resources/v2/types/SystemMessageContentItem.ts b/src/api/resources/v2/types/SystemMessageContentItem.ts new file mode 100644 index 00000000..dcd45941 --- /dev/null +++ b/src/api/resources/v2/types/SystemMessageContentItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export type SystemMessageContentItem = Cohere.SystemMessageContentItem.Text; + +export declare namespace SystemMessageContentItem { + interface Text extends Cohere.TextContent { + type: "text"; + } +} diff --git a/src/api/resources/v2/types/TextContent.ts b/src/api/resources/v2/types/TextContent.ts new file mode 100644 index 00000000..a9cc35dd --- /dev/null +++ b/src/api/resources/v2/types/TextContent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Text content of the message. + */ +export interface TextContent { + text: string; +} diff --git a/src/api/resources/v2/types/Tool2.ts b/src/api/resources/v2/types/Tool2.ts new file mode 100644 index 00000000..0621eb9a --- /dev/null +++ b/src/api/resources/v2/types/Tool2.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface Tool2 { + type?: "function"; + function?: Cohere.Tool2Function; +} diff --git a/src/api/resources/v2/types/Tool2Function.ts b/src/api/resources/v2/types/Tool2Function.ts new file mode 100644 index 00000000..eb515088 --- /dev/null +++ b/src/api/resources/v2/types/Tool2Function.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Tool2Function { + name?: string; + description?: string; + /** The parameters of the function as a JSON schema. */ + parameters?: Record; +} diff --git a/src/api/resources/v2/types/ToolCall2.ts b/src/api/resources/v2/types/ToolCall2.ts new file mode 100644 index 00000000..d017d4a4 --- /dev/null +++ b/src/api/resources/v2/types/ToolCall2.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A array of tool calls to be made. + */ +export interface ToolCall2 { + id?: string; + type?: "function"; + function?: Cohere.ToolCall2Function; +} diff --git a/src/api/resources/v2/types/ToolCall2Function.ts b/src/api/resources/v2/types/ToolCall2Function.ts new file mode 100644 index 00000000..c49fba4c --- /dev/null +++ b/src/api/resources/v2/types/ToolCall2Function.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ToolCall2Function { + name?: string; + arguments?: string; +} diff --git a/src/api/resources/v2/types/ToolContent.ts b/src/api/resources/v2/types/ToolContent.ts new file mode 100644 index 00000000..e362315a --- /dev/null +++ b/src/api/resources/v2/types/ToolContent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Tool content result object + */ +export interface ToolContent { + output: Record; +} diff --git a/src/api/resources/v2/types/ToolMessage2.ts b/src/api/resources/v2/types/ToolMessage2.ts new file mode 100644 index 00000000..2cbb8464 --- /dev/null +++ b/src/api/resources/v2/types/ToolMessage2.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A message from the system. + */ +export interface ToolMessage2 { + toolCallId: string; + toolContent: Cohere.ToolMessage2ToolContentItem[]; +} diff --git a/src/api/resources/v2/types/ToolMessage2ToolContentItem.ts b/src/api/resources/v2/types/ToolMessage2ToolContentItem.ts new file mode 100644 index 00000000..3ee16e9c --- /dev/null +++ b/src/api/resources/v2/types/ToolMessage2ToolContentItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export type ToolMessage2ToolContentItem = Cohere.ToolMessage2ToolContentItem.ToolResultObject; + +export declare namespace ToolMessage2ToolContentItem { + interface ToolResultObject extends Cohere.ToolContent { + type: "tool_result_object"; + } +} diff --git a/src/api/resources/v2/types/ToolSource.ts b/src/api/resources/v2/types/ToolSource.ts new file mode 100644 index 00000000..1401d64e --- /dev/null +++ b/src/api/resources/v2/types/ToolSource.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ToolSource { + /** The unique identifier of the document */ + id?: string; + toolOutput?: Record; +} diff --git a/src/api/resources/v2/types/Usage.ts b/src/api/resources/v2/types/Usage.ts new file mode 100644 index 00000000..0f7ff860 --- /dev/null +++ b/src/api/resources/v2/types/Usage.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export interface Usage { + billedUnits?: Cohere.UsageBilledUnits; + tokens?: Cohere.UsageTokens; +} diff --git a/src/api/resources/v2/types/UsageBilledUnits.ts b/src/api/resources/v2/types/UsageBilledUnits.ts new file mode 100644 index 00000000..b8c39f80 --- /dev/null +++ b/src/api/resources/v2/types/UsageBilledUnits.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UsageBilledUnits { + /** The number of billed input tokens. */ + inputTokens?: number; + /** The number of billed output tokens. */ + outputTokens?: number; + /** The number of billed search units. */ + searchUnits?: number; + /** The number of billed classifications units. */ + classifications?: number; +} diff --git a/src/api/resources/v2/types/UsageTokens.ts b/src/api/resources/v2/types/UsageTokens.ts new file mode 100644 index 00000000..851e2cac --- /dev/null +++ b/src/api/resources/v2/types/UsageTokens.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UsageTokens { + /** The number of tokens used as input to the model. */ + inputTokens?: number; + /** The number of tokens produced by the model. */ + outputTokens?: number; +} diff --git a/src/api/resources/v2/types/UserMessage.ts b/src/api/resources/v2/types/UserMessage.ts new file mode 100644 index 00000000..d5d6aecf --- /dev/null +++ b/src/api/resources/v2/types/UserMessage.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +/** + * A message from the user. + */ +export interface UserMessage { + content: Cohere.UserMessageContent; +} diff --git a/src/api/resources/v2/types/UserMessageContent.ts b/src/api/resources/v2/types/UserMessageContent.ts new file mode 100644 index 00000000..39091fba --- /dev/null +++ b/src/api/resources/v2/types/UserMessageContent.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../../../index"; + +export type UserMessageContent = string | Cohere.Content[]; diff --git a/src/api/resources/v2/types/V2ChatRequestCitationMode.ts b/src/api/resources/v2/types/V2ChatRequestCitationMode.ts new file mode 100644 index 00000000..768a612a --- /dev/null +++ b/src/api/resources/v2/types/V2ChatRequestCitationMode.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatRequestCitationMode = "FAST" | "ACCURATE"; + +export const V2ChatRequestCitationMode = { + Fast: "FAST", + Accurate: "ACCURATE", +} as const; diff --git a/src/api/resources/v2/types/V2ChatRequestResponseFormat.ts b/src/api/resources/v2/types/V2ChatRequestResponseFormat.ts new file mode 100644 index 00000000..5cb55122 --- /dev/null +++ b/src/api/resources/v2/types/V2ChatRequestResponseFormat.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface V2ChatRequestResponseFormat { + /** When set to JSON, the output will be parse-able valid JSON (or run out of context). */ + type?: "json_object"; + /** A JSON schema object that the output will adhere to. Refer to https://json-schema.org/ for reference about schemas. */ + schema?: Record; +} diff --git a/src/api/resources/v2/types/V2ChatRequestToolChoice.ts b/src/api/resources/v2/types/V2ChatRequestToolChoice.ts new file mode 100644 index 00000000..9f98b4d7 --- /dev/null +++ b/src/api/resources/v2/types/V2ChatRequestToolChoice.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatRequestToolChoice = "AUTO" | "NONE" | "ANY"; + +export const V2ChatRequestToolChoice = { + Auto: "AUTO", + None: "NONE", + Any: "ANY", +} as const; diff --git a/src/api/resources/v2/types/V2ChatRequestTruncationMode.ts b/src/api/resources/v2/types/V2ChatRequestTruncationMode.ts new file mode 100644 index 00000000..fa0d6543 --- /dev/null +++ b/src/api/resources/v2/types/V2ChatRequestTruncationMode.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatRequestTruncationMode = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; + +export const V2ChatRequestTruncationMode = { + Off: "OFF", + Auto: "AUTO", + AutoPreserveOrder: "AUTO_PRESERVE_ORDER", +} as const; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestCitationMode.ts b/src/api/resources/v2/types/V2ChatStreamRequestCitationMode.ts new file mode 100644 index 00000000..b0609b9d --- /dev/null +++ b/src/api/resources/v2/types/V2ChatStreamRequestCitationMode.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatStreamRequestCitationMode = "FAST" | "ACCURATE"; + +export const V2ChatStreamRequestCitationMode = { + Fast: "FAST", + Accurate: "ACCURATE", +} as const; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestResponseFormat.ts b/src/api/resources/v2/types/V2ChatStreamRequestResponseFormat.ts new file mode 100644 index 00000000..b30b96b0 --- /dev/null +++ b/src/api/resources/v2/types/V2ChatStreamRequestResponseFormat.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface V2ChatStreamRequestResponseFormat { + /** When set to JSON, the output will be parse-able valid JSON (or run out of context). */ + type?: "json_object"; + /** A JSON schema object that the output will adhere to. Refer to https://json-schema.org/ for reference about schemas. */ + schema?: Record; +} diff --git a/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts b/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts new file mode 100644 index 00000000..2f017e3f --- /dev/null +++ b/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatStreamRequestToolChoice = "AUTO" | "NONE" | "ANY"; + +export const V2ChatStreamRequestToolChoice = { + Auto: "AUTO", + None: "NONE", + Any: "ANY", +} as const; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestTruncationMode.ts b/src/api/resources/v2/types/V2ChatStreamRequestTruncationMode.ts new file mode 100644 index 00000000..b2535786 --- /dev/null +++ b/src/api/resources/v2/types/V2ChatStreamRequestTruncationMode.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V2ChatStreamRequestTruncationMode = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; + +export const V2ChatStreamRequestTruncationMode = { + Off: "OFF", + Auto: "AUTO", + AutoPreserveOrder: "AUTO_PRESERVE_ORDER", +} as const; diff --git a/src/api/resources/v2/types/index.ts b/src/api/resources/v2/types/index.ts new file mode 100644 index 00000000..05f35529 --- /dev/null +++ b/src/api/resources/v2/types/index.ts @@ -0,0 +1,62 @@ +export * from "./V2ChatStreamRequestToolChoice"; +export * from "./V2ChatStreamRequestCitationMode"; +export * from "./V2ChatStreamRequestTruncationMode"; +export * from "./V2ChatStreamRequestResponseFormat"; +export * from "./V2ChatRequestToolChoice"; +export * from "./V2ChatRequestCitationMode"; +export * from "./V2ChatRequestTruncationMode"; +export * from "./V2ChatRequestResponseFormat"; +export * from "./ToolCall2Function"; +export * from "./ToolCall2"; +export * from "./TextContent"; +export * from "./ToolSource"; +export * from "./DocumentSource"; +export * from "./Source"; +export * from "./Citation"; +export * from "./AssistantMessage"; +export * from "./SystemMessageContentItem"; +export * from "./SystemMessageContent"; +export * from "./SystemMessage"; +export * from "./DocumentContent"; +export * from "./Content"; +export * from "./UserMessageContent"; +export * from "./UserMessage"; +export * from "./ToolContent"; +export * from "./ToolMessage2ToolContentItem"; +export * from "./ToolMessage2"; +export * from "./ChatMessage2"; +export * from "./ChatMessages"; +export * from "./Tool2Function"; +export * from "./Tool2"; +export * from "./ChatFinishReason"; +export * from "./UsageBilledUnits"; +export * from "./UsageTokens"; +export * from "./Usage"; +export * from "./NonStreamedChatResponse2"; +export * from "./ChatStreamEventType"; +export * from "./ChatMessageStartEventDeltaMessage"; +export * from "./ChatMessageStartEventDelta"; +export * from "./ChatMessageStartEvent"; +export * from "./ChatContentStartEventDeltaMessageContent"; +export * from "./ChatContentStartEventDeltaMessage"; +export * from "./ChatContentStartEventDelta"; +export * from "./ChatContentStartEvent"; +export * from "./ChatContentDeltaEventDeltaMessageContent"; +export * from "./ChatContentDeltaEventDeltaMessage"; +export * from "./ChatContentDeltaEventDelta"; +export * from "./ChatContentDeltaEvent"; +export * from "./ChatContentEndEvent"; +export * from "./ChatToolPlanDeltaEventDelta"; +export * from "./ChatToolPlanDeltaEvent"; +export * from "./ChatToolCallStartEventDeltaToolCallFunction"; +export * from "./ChatToolCallStartEventDeltaToolCall"; +export * from "./ChatToolCallStartEventDelta"; +export * from "./ChatToolCallStartEvent"; +export * from "./ChatToolCallDeltaEventDeltaToolCallFunction"; +export * from "./ChatToolCallDeltaEventDeltaToolCall"; +export * from "./ChatToolCallDeltaEventDelta"; +export * from "./ChatToolCallDeltaEvent"; +export * from "./ChatToolCallEndEvent"; +export * from "./ChatMessageEndEventDelta"; +export * from "./ChatMessageEndEvent"; +export * from "./StreamedChatResponse2"; diff --git a/src/environments.ts b/src/environments.ts index fabd1649..2fcb83fe 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -3,7 +3,7 @@ */ export const CohereEnvironment = { - Production: "https://api.cohere.com/v1", + Production: "https://api.cohere.com", } as const; export type CohereEnvironment = typeof CohereEnvironment.Production; diff --git a/src/index.ts b/src/index.ts index d5ab1b2c..a9e05221 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,8 @@ +export * as Cohere from "./api"; export { BedrockClient } from "./BedrockClient"; export { CohereClient } from "./Client"; -export { SagemakerClient } from "./SagemakerClient"; -export * as Cohere from "./api"; +export { CohereClientV2 } from "./ClientV2"; export { CohereEnvironment } from "./environments"; export { CohereError, CohereTimeoutError } from "./errors"; +export { SagemakerClient } from "./SagemakerClient"; + diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts index 4bc4e5d5..8e49e939 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts @@ -7,6 +7,7 @@ import * as Cohere from "../../../../../../api/index"; import * as core from "../../../../../../core"; import { BaseModel } from "./BaseModel"; import { Hyperparameters } from "./Hyperparameters"; +import { WandbConfig } from "./WandbConfig"; export const Settings: core.serialization.ObjectSchema< serializers.finetuning.Settings.Raw, @@ -16,6 +17,7 @@ export const Settings: core.serialization.ObjectSchema< datasetId: core.serialization.property("dataset_id", core.serialization.string()), hyperparameters: Hyperparameters.optional(), multiLabel: core.serialization.property("multi_label", core.serialization.boolean().optional()), + wandb: WandbConfig.optional(), }); export declare namespace Settings { @@ -24,5 +26,6 @@ export declare namespace Settings { dataset_id: string; hyperparameters?: Hyperparameters.Raw | null; multi_label?: boolean | null; + wandb?: WandbConfig.Raw | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts b/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts new file mode 100644 index 00000000..e916ced0 --- /dev/null +++ b/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../index"; +import * as Cohere from "../../../../../../api/index"; +import * as core from "../../../../../../core"; + +export const WandbConfig: core.serialization.ObjectSchema< + serializers.finetuning.WandbConfig.Raw, + Cohere.finetuning.WandbConfig +> = core.serialization.object({ + project: core.serialization.string(), + apiKey: core.serialization.property("api_key", core.serialization.string()), + entity: core.serialization.string().optional(), +}); + +export declare namespace WandbConfig { + interface Raw { + project: string; + api_key: string; + entity?: string | null; + } +} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/index.ts b/src/serialization/resources/finetuning/resources/finetuning/types/index.ts index 94b55ae4..f3727066 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/index.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/index.ts @@ -2,6 +2,7 @@ export * from "./BaseType"; export * from "./Strategy"; export * from "./BaseModel"; export * from "./Hyperparameters"; +export * from "./WandbConfig"; export * from "./Settings"; export * from "./Status"; export * from "./FinetunedModel"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 61cf6f32..4967042c 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,8 +1,11 @@ +export * as v2 from "./v2"; +export * from "./v2/types"; export * as embedJobs from "./embedJobs"; export * from "./embedJobs/types"; export * as datasets from "./datasets"; export * from "./datasets/types"; export * as finetuning from "./finetuning"; +export * from "./v2/client/requests"; export * from "./embedJobs/client/requests"; export * as connectors from "./connectors"; export * from "./connectors/client/requests"; diff --git a/src/serialization/resources/v2/client/index.ts b/src/serialization/resources/v2/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/v2/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/v2/client/requests/V2ChatRequest.ts b/src/serialization/resources/v2/client/requests/V2ChatRequest.ts new file mode 100644 index 00000000..48284ee2 --- /dev/null +++ b/src/serialization/resources/v2/client/requests/V2ChatRequest.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Cohere from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ChatMessages } from "../../types/ChatMessages"; +import { Tool2 } from "../../types/Tool2"; +import { V2ChatRequestToolChoice } from "../../types/V2ChatRequestToolChoice"; +import { V2ChatRequestCitationMode } from "../../types/V2ChatRequestCitationMode"; +import { V2ChatRequestTruncationMode } from "../../types/V2ChatRequestTruncationMode"; +import { V2ChatRequestResponseFormat } from "../../types/V2ChatRequestResponseFormat"; +import { ChatMessage2 } from "../../types/ChatMessage2"; + +export const V2ChatRequest: core.serialization.Schema = + core.serialization.object({ + model: core.serialization.string(), + messages: ChatMessages, + tools: core.serialization.list(Tool2).optional(), + toolChoice: core.serialization.property("tool_choice", V2ChatRequestToolChoice.optional()), + citationMode: core.serialization.property("citation_mode", V2ChatRequestCitationMode.optional()), + truncationMode: core.serialization.property("truncation_mode", V2ChatRequestTruncationMode.optional()), + responseFormat: core.serialization.property("response_format", V2ChatRequestResponseFormat.optional()), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + stopSequences: core.serialization.property( + "stop_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + maxInputTokens: core.serialization.property("max_input_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + seed: core.serialization.number().optional(), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + k: core.serialization.number().optional(), + p: core.serialization.number().optional(), + returnPrompt: core.serialization.property("return_prompt", core.serialization.boolean().optional()), + }); + +export declare namespace V2ChatRequest { + interface Raw { + model: string; + messages: ChatMessages.Raw; + tools?: Tool2.Raw[] | null; + tool_choice?: V2ChatRequestToolChoice.Raw | null; + citation_mode?: V2ChatRequestCitationMode.Raw | null; + truncation_mode?: V2ChatRequestTruncationMode.Raw | null; + response_format?: V2ChatRequestResponseFormat.Raw | null; + max_tokens?: number | null; + stop_sequences?: string[] | null; + max_input_tokens?: number | null; + temperature?: number | null; + seed?: number | null; + frequency_penalty?: number | null; + presence_penalty?: number | null; + k?: number | null; + p?: number | null; + return_prompt?: boolean | null; + } +} diff --git a/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts b/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts new file mode 100644 index 00000000..a2f16445 --- /dev/null +++ b/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Cohere from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ChatMessages } from "../../types/ChatMessages"; +import { Tool2 } from "../../types/Tool2"; +import { V2ChatStreamRequestToolChoice } from "../../types/V2ChatStreamRequestToolChoice"; +import { V2ChatStreamRequestCitationMode } from "../../types/V2ChatStreamRequestCitationMode"; +import { V2ChatStreamRequestTruncationMode } from "../../types/V2ChatStreamRequestTruncationMode"; +import { V2ChatStreamRequestResponseFormat } from "../../types/V2ChatStreamRequestResponseFormat"; +import { ChatMessage2 } from "../../types/ChatMessage2"; + +export const V2ChatStreamRequest: core.serialization.Schema< + serializers.V2ChatStreamRequest.Raw, + Cohere.V2ChatStreamRequest +> = core.serialization.object({ + model: core.serialization.string(), + messages: ChatMessages, + tools: core.serialization.list(Tool2).optional(), + toolChoice: core.serialization.property("tool_choice", V2ChatStreamRequestToolChoice.optional()), + citationMode: core.serialization.property("citation_mode", V2ChatStreamRequestCitationMode.optional()), + truncationMode: core.serialization.property("truncation_mode", V2ChatStreamRequestTruncationMode.optional()), + responseFormat: core.serialization.property("response_format", V2ChatStreamRequestResponseFormat.optional()), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + stopSequences: core.serialization.property( + "stop_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + maxInputTokens: core.serialization.property("max_input_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + seed: core.serialization.number().optional(), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + k: core.serialization.number().optional(), + p: core.serialization.number().optional(), + returnPrompt: core.serialization.property("return_prompt", core.serialization.boolean().optional()), +}); + +export declare namespace V2ChatStreamRequest { + interface Raw { + model: string; + messages: ChatMessages.Raw; + tools?: Tool2.Raw[] | null; + tool_choice?: V2ChatStreamRequestToolChoice.Raw | null; + citation_mode?: V2ChatStreamRequestCitationMode.Raw | null; + truncation_mode?: V2ChatStreamRequestTruncationMode.Raw | null; + response_format?: V2ChatStreamRequestResponseFormat.Raw | null; + max_tokens?: number | null; + stop_sequences?: string[] | null; + max_input_tokens?: number | null; + temperature?: number | null; + seed?: number | null; + frequency_penalty?: number | null; + presence_penalty?: number | null; + k?: number | null; + p?: number | null; + return_prompt?: boolean | null; + } +} diff --git a/src/serialization/resources/v2/client/requests/index.ts b/src/serialization/resources/v2/client/requests/index.ts new file mode 100644 index 00000000..6dd63cf0 --- /dev/null +++ b/src/serialization/resources/v2/client/requests/index.ts @@ -0,0 +1,2 @@ +export { V2ChatStreamRequest } from "./V2ChatStreamRequest"; +export { V2ChatRequest } from "./V2ChatRequest"; diff --git a/src/serialization/resources/v2/index.ts b/src/serialization/resources/v2/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/v2/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/v2/types/AssistantMessage.ts b/src/serialization/resources/v2/types/AssistantMessage.ts new file mode 100644 index 00000000..4ddc6128 --- /dev/null +++ b/src/serialization/resources/v2/types/AssistantMessage.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolCall2 } from "./ToolCall2"; +import { TextContent } from "./TextContent"; +import { Citation } from "./Citation"; + +export const AssistantMessage: core.serialization.ObjectSchema< + serializers.AssistantMessage.Raw, + Cohere.AssistantMessage +> = core.serialization.object({ + toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall2).optional()), + toolPlan: core.serialization.property("tool_plan", core.serialization.string().optional()), + content: core.serialization.list(TextContent).optional(), + citations: core.serialization.list(Citation).optional(), +}); + +export declare namespace AssistantMessage { + interface Raw { + tool_calls?: ToolCall2.Raw[] | null; + tool_plan?: string | null; + content?: TextContent.Raw[] | null; + citations?: Citation.Raw[] | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentDeltaEvent.ts b/src/serialization/resources/v2/types/ChatContentDeltaEvent.ts new file mode 100644 index 00000000..bffe3368 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentDeltaEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentDeltaEventDelta } from "./ChatContentDeltaEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatContentDeltaEvent: core.serialization.ObjectSchema< + serializers.ChatContentDeltaEvent.Raw, + Cohere.ChatContentDeltaEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + delta: ChatContentDeltaEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatContentDeltaEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + delta?: ChatContentDeltaEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentDeltaEventDelta.ts b/src/serialization/resources/v2/types/ChatContentDeltaEventDelta.ts new file mode 100644 index 00000000..cd93ad3f --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentDeltaEventDelta.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentDeltaEventDeltaMessage } from "./ChatContentDeltaEventDeltaMessage"; + +export const ChatContentDeltaEventDelta: core.serialization.ObjectSchema< + serializers.ChatContentDeltaEventDelta.Raw, + Cohere.ChatContentDeltaEventDelta +> = core.serialization.object({ + message: ChatContentDeltaEventDeltaMessage.optional(), +}); + +export declare namespace ChatContentDeltaEventDelta { + interface Raw { + message?: ChatContentDeltaEventDeltaMessage.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts b/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts new file mode 100644 index 00000000..9b9a91e7 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessage.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentDeltaEventDeltaMessageContent } from "./ChatContentDeltaEventDeltaMessageContent"; + +export const ChatContentDeltaEventDeltaMessage: core.serialization.ObjectSchema< + serializers.ChatContentDeltaEventDeltaMessage.Raw, + Cohere.ChatContentDeltaEventDeltaMessage +> = core.serialization.object({ + content: ChatContentDeltaEventDeltaMessageContent.optional(), +}); + +export declare namespace ChatContentDeltaEventDeltaMessage { + interface Raw { + content?: ChatContentDeltaEventDeltaMessageContent.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts b/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts new file mode 100644 index 00000000..010fcef1 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentDeltaEventDeltaMessageContent.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatContentDeltaEventDeltaMessageContent: core.serialization.ObjectSchema< + serializers.ChatContentDeltaEventDeltaMessageContent.Raw, + Cohere.ChatContentDeltaEventDeltaMessageContent +> = core.serialization.object({ + text: core.serialization.string().optional(), +}); + +export declare namespace ChatContentDeltaEventDeltaMessageContent { + interface Raw { + text?: string | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentEndEvent.ts b/src/serialization/resources/v2/types/ChatContentEndEvent.ts new file mode 100644 index 00000000..b381381c --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentEndEvent.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatContentEndEvent: core.serialization.ObjectSchema< + serializers.ChatContentEndEvent.Raw, + Cohere.ChatContentEndEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatContentEndEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentStartEvent.ts b/src/serialization/resources/v2/types/ChatContentStartEvent.ts new file mode 100644 index 00000000..1e58145b --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentStartEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentStartEventDelta } from "./ChatContentStartEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatContentStartEvent: core.serialization.ObjectSchema< + serializers.ChatContentStartEvent.Raw, + Cohere.ChatContentStartEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + delta: ChatContentStartEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatContentStartEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + delta?: ChatContentStartEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentStartEventDelta.ts b/src/serialization/resources/v2/types/ChatContentStartEventDelta.ts new file mode 100644 index 00000000..a8b05d31 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentStartEventDelta.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentStartEventDeltaMessage } from "./ChatContentStartEventDeltaMessage"; + +export const ChatContentStartEventDelta: core.serialization.ObjectSchema< + serializers.ChatContentStartEventDelta.Raw, + Cohere.ChatContentStartEventDelta +> = core.serialization.object({ + message: ChatContentStartEventDeltaMessage.optional(), +}); + +export declare namespace ChatContentStartEventDelta { + interface Raw { + message?: ChatContentStartEventDeltaMessage.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessage.ts b/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessage.ts new file mode 100644 index 00000000..0ff76fa3 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessage.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatContentStartEventDeltaMessageContent } from "./ChatContentStartEventDeltaMessageContent"; + +export const ChatContentStartEventDeltaMessage: core.serialization.ObjectSchema< + serializers.ChatContentStartEventDeltaMessage.Raw, + Cohere.ChatContentStartEventDeltaMessage +> = core.serialization.object({ + content: ChatContentStartEventDeltaMessageContent.optional(), +}); + +export declare namespace ChatContentStartEventDeltaMessage { + interface Raw { + content?: ChatContentStartEventDeltaMessageContent.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts b/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts new file mode 100644 index 00000000..1c0287cf --- /dev/null +++ b/src/serialization/resources/v2/types/ChatContentStartEventDeltaMessageContent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatContentStartEventDeltaMessageContent: core.serialization.ObjectSchema< + serializers.ChatContentStartEventDeltaMessageContent.Raw, + Cohere.ChatContentStartEventDeltaMessageContent +> = core.serialization.object({ + text: core.serialization.string().optional(), + type: core.serialization.stringLiteral("text").optional(), +}); + +export declare namespace ChatContentStartEventDeltaMessageContent { + interface Raw { + text?: string | null; + type?: "text" | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatFinishReason.ts b/src/serialization/resources/v2/types/ChatFinishReason.ts new file mode 100644 index 00000000..e0f4f150 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatFinishReason.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatFinishReason: core.serialization.Schema = + core.serialization.enum_([ + "complete", + "stop_sequence", + "max_tokens", + "tool_call", + "error", + "content_blocked", + "error_limit", + ]); + +export declare namespace ChatFinishReason { + type Raw = "complete" | "stop_sequence" | "max_tokens" | "tool_call" | "error" | "content_blocked" | "error_limit"; +} diff --git a/src/serialization/resources/v2/types/ChatMessage2.ts b/src/serialization/resources/v2/types/ChatMessage2.ts new file mode 100644 index 00000000..9c5ddbf7 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessage2.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { AssistantMessage } from "./AssistantMessage"; +import { SystemMessage } from "./SystemMessage"; +import { UserMessage } from "./UserMessage"; +import { ToolMessage2 } from "./ToolMessage2"; + +export const ChatMessage2: core.serialization.Schema = + core.serialization + .union("role", { + assistant: AssistantMessage, + system: SystemMessage, + user: UserMessage, + tool: ToolMessage2, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace ChatMessage2 { + type Raw = ChatMessage2.Assistant | ChatMessage2.System | ChatMessage2.User | ChatMessage2.Tool; + + interface Assistant extends AssistantMessage.Raw { + role: "assistant"; + } + + interface System extends SystemMessage.Raw { + role: "system"; + } + + interface User extends UserMessage.Raw { + role: "user"; + } + + interface Tool extends ToolMessage2.Raw { + role: "tool"; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessageEndEvent.ts b/src/serialization/resources/v2/types/ChatMessageEndEvent.ts new file mode 100644 index 00000000..ef64618b --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessageEndEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessageEndEventDelta } from "./ChatMessageEndEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatMessageEndEvent: core.serialization.ObjectSchema< + serializers.ChatMessageEndEvent.Raw, + Cohere.ChatMessageEndEvent +> = core.serialization + .object({ + id: core.serialization.string().optional(), + delta: ChatMessageEndEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatMessageEndEvent { + interface Raw extends ChatStreamEventType.Raw { + id?: string | null; + delta?: ChatMessageEndEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessageEndEventDelta.ts b/src/serialization/resources/v2/types/ChatMessageEndEventDelta.ts new file mode 100644 index 00000000..2a5b6036 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessageEndEventDelta.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatFinishReason } from "./ChatFinishReason"; +import { Usage } from "./Usage"; + +export const ChatMessageEndEventDelta: core.serialization.ObjectSchema< + serializers.ChatMessageEndEventDelta.Raw, + Cohere.ChatMessageEndEventDelta +> = core.serialization.object({ + finishReason: core.serialization.property("finish_reason", ChatFinishReason.optional()), + usage: Usage.optional(), +}); + +export declare namespace ChatMessageEndEventDelta { + interface Raw { + finish_reason?: ChatFinishReason.Raw | null; + usage?: Usage.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessageStartEvent.ts b/src/serialization/resources/v2/types/ChatMessageStartEvent.ts new file mode 100644 index 00000000..ae6d6f53 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessageStartEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessageStartEventDelta } from "./ChatMessageStartEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatMessageStartEvent: core.serialization.ObjectSchema< + serializers.ChatMessageStartEvent.Raw, + Cohere.ChatMessageStartEvent +> = core.serialization + .object({ + id: core.serialization.string().optional(), + delta: ChatMessageStartEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatMessageStartEvent { + interface Raw extends ChatStreamEventType.Raw { + id?: string | null; + delta?: ChatMessageStartEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessageStartEventDelta.ts b/src/serialization/resources/v2/types/ChatMessageStartEventDelta.ts new file mode 100644 index 00000000..13979c56 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessageStartEventDelta.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessageStartEventDeltaMessage } from "./ChatMessageStartEventDeltaMessage"; + +export const ChatMessageStartEventDelta: core.serialization.ObjectSchema< + serializers.ChatMessageStartEventDelta.Raw, + Cohere.ChatMessageStartEventDelta +> = core.serialization.object({ + message: ChatMessageStartEventDeltaMessage.optional(), +}); + +export declare namespace ChatMessageStartEventDelta { + interface Raw { + message?: ChatMessageStartEventDeltaMessage.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessageStartEventDeltaMessage.ts b/src/serialization/resources/v2/types/ChatMessageStartEventDeltaMessage.ts new file mode 100644 index 00000000..8a337071 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessageStartEventDeltaMessage.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatMessageStartEventDeltaMessage: core.serialization.ObjectSchema< + serializers.ChatMessageStartEventDeltaMessage.Raw, + Cohere.ChatMessageStartEventDeltaMessage +> = core.serialization.object({ + role: core.serialization.stringLiteral("assistant").optional(), +}); + +export declare namespace ChatMessageStartEventDeltaMessage { + interface Raw { + role?: "assistant" | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatMessages.ts b/src/serialization/resources/v2/types/ChatMessages.ts new file mode 100644 index 00000000..4510b53a --- /dev/null +++ b/src/serialization/resources/v2/types/ChatMessages.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessage2 } from "./ChatMessage2"; + +export const ChatMessages: core.serialization.Schema = + core.serialization.list(ChatMessage2); + +export declare namespace ChatMessages { + type Raw = ChatMessage2.Raw[]; +} diff --git a/src/serialization/resources/v2/types/ChatStreamEventType.ts b/src/serialization/resources/v2/types/ChatStreamEventType.ts new file mode 100644 index 00000000..e4b5c705 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatStreamEventType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatStreamEventType: core.serialization.ObjectSchema< + serializers.ChatStreamEventType.Raw, + Cohere.ChatStreamEventType +> = core.serialization.object({}); + +export declare namespace ChatStreamEventType { + interface Raw {} +} diff --git a/src/serialization/resources/v2/types/ChatToolCallDeltaEvent.ts b/src/serialization/resources/v2/types/ChatToolCallDeltaEvent.ts new file mode 100644 index 00000000..33bb71e6 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallDeltaEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallDeltaEventDelta } from "./ChatToolCallDeltaEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatToolCallDeltaEvent: core.serialization.ObjectSchema< + serializers.ChatToolCallDeltaEvent.Raw, + Cohere.ChatToolCallDeltaEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + delta: ChatToolCallDeltaEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatToolCallDeltaEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + delta?: ChatToolCallDeltaEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallDeltaEventDelta.ts b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDelta.ts new file mode 100644 index 00000000..d857b006 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDelta.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallDeltaEventDeltaToolCall } from "./ChatToolCallDeltaEventDeltaToolCall"; + +export const ChatToolCallDeltaEventDelta: core.serialization.ObjectSchema< + serializers.ChatToolCallDeltaEventDelta.Raw, + Cohere.ChatToolCallDeltaEventDelta +> = core.serialization.object({ + toolCall: core.serialization.property("tool_call", ChatToolCallDeltaEventDeltaToolCall.optional()), +}); + +export declare namespace ChatToolCallDeltaEventDelta { + interface Raw { + tool_call?: ChatToolCallDeltaEventDeltaToolCall.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts new file mode 100644 index 00000000..26dd4961 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCall.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallDeltaEventDeltaToolCallFunction } from "./ChatToolCallDeltaEventDeltaToolCallFunction"; + +export const ChatToolCallDeltaEventDeltaToolCall: core.serialization.ObjectSchema< + serializers.ChatToolCallDeltaEventDeltaToolCall.Raw, + Cohere.ChatToolCallDeltaEventDeltaToolCall +> = core.serialization.object({ + function: ChatToolCallDeltaEventDeltaToolCallFunction.optional(), +}); + +export declare namespace ChatToolCallDeltaEventDeltaToolCall { + interface Raw { + function?: ChatToolCallDeltaEventDeltaToolCallFunction.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts new file mode 100644 index 00000000..fe8a667c --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallDeltaEventDeltaToolCallFunction.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatToolCallDeltaEventDeltaToolCallFunction: core.serialization.ObjectSchema< + serializers.ChatToolCallDeltaEventDeltaToolCallFunction.Raw, + Cohere.ChatToolCallDeltaEventDeltaToolCallFunction +> = core.serialization.object({ + arguments: core.serialization.string().optional(), +}); + +export declare namespace ChatToolCallDeltaEventDeltaToolCallFunction { + interface Raw { + arguments?: string | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallEndEvent.ts b/src/serialization/resources/v2/types/ChatToolCallEndEvent.ts new file mode 100644 index 00000000..34609163 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallEndEvent.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatToolCallEndEvent: core.serialization.ObjectSchema< + serializers.ChatToolCallEndEvent.Raw, + Cohere.ChatToolCallEndEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatToolCallEndEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallStartEvent.ts b/src/serialization/resources/v2/types/ChatToolCallStartEvent.ts new file mode 100644 index 00000000..a8dee8fc --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallStartEvent.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallStartEventDelta } from "./ChatToolCallStartEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatToolCallStartEvent: core.serialization.ObjectSchema< + serializers.ChatToolCallStartEvent.Raw, + Cohere.ChatToolCallStartEvent +> = core.serialization + .object({ + index: core.serialization.number().optional(), + delta: ChatToolCallStartEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatToolCallStartEvent { + interface Raw extends ChatStreamEventType.Raw { + index?: number | null; + delta?: ChatToolCallStartEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallStartEventDelta.ts b/src/serialization/resources/v2/types/ChatToolCallStartEventDelta.ts new file mode 100644 index 00000000..ee014a43 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallStartEventDelta.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallStartEventDeltaToolCall } from "./ChatToolCallStartEventDeltaToolCall"; + +export const ChatToolCallStartEventDelta: core.serialization.ObjectSchema< + serializers.ChatToolCallStartEventDelta.Raw, + Cohere.ChatToolCallStartEventDelta +> = core.serialization.object({ + toolCall: core.serialization.property("tool_call", ChatToolCallStartEventDeltaToolCall.optional()), +}); + +export declare namespace ChatToolCallStartEventDelta { + interface Raw { + tool_call?: ChatToolCallStartEventDeltaToolCall.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts b/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts new file mode 100644 index 00000000..829e591a --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCall.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolCallStartEventDeltaToolCallFunction } from "./ChatToolCallStartEventDeltaToolCallFunction"; + +export const ChatToolCallStartEventDeltaToolCall: core.serialization.ObjectSchema< + serializers.ChatToolCallStartEventDeltaToolCall.Raw, + Cohere.ChatToolCallStartEventDeltaToolCall +> = core.serialization.object({ + id: core.serialization.string().optional(), + type: core.serialization.stringLiteral("function").optional(), + function: ChatToolCallStartEventDeltaToolCallFunction.optional(), +}); + +export declare namespace ChatToolCallStartEventDeltaToolCall { + interface Raw { + id?: string | null; + type?: "function" | null; + function?: ChatToolCallStartEventDeltaToolCallFunction.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts b/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts new file mode 100644 index 00000000..5188f355 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolCallStartEventDeltaToolCallFunction.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatToolCallStartEventDeltaToolCallFunction: core.serialization.ObjectSchema< + serializers.ChatToolCallStartEventDeltaToolCallFunction.Raw, + Cohere.ChatToolCallStartEventDeltaToolCallFunction +> = core.serialization.object({ + name: core.serialization.string().optional(), + arguments: core.serialization.string().optional(), +}); + +export declare namespace ChatToolCallStartEventDeltaToolCallFunction { + interface Raw { + name?: string | null; + arguments?: string | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolPlanDeltaEvent.ts b/src/serialization/resources/v2/types/ChatToolPlanDeltaEvent.ts new file mode 100644 index 00000000..aee0898d --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolPlanDeltaEvent.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatToolPlanDeltaEventDelta } from "./ChatToolPlanDeltaEventDelta"; +import { ChatStreamEventType } from "./ChatStreamEventType"; + +export const ChatToolPlanDeltaEvent: core.serialization.ObjectSchema< + serializers.ChatToolPlanDeltaEvent.Raw, + Cohere.ChatToolPlanDeltaEvent +> = core.serialization + .object({ + delta: ChatToolPlanDeltaEventDelta.optional(), + }) + .extend(ChatStreamEventType); + +export declare namespace ChatToolPlanDeltaEvent { + interface Raw extends ChatStreamEventType.Raw { + delta?: ChatToolPlanDeltaEventDelta.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ChatToolPlanDeltaEventDelta.ts b/src/serialization/resources/v2/types/ChatToolPlanDeltaEventDelta.ts new file mode 100644 index 00000000..742fbdd8 --- /dev/null +++ b/src/serialization/resources/v2/types/ChatToolPlanDeltaEventDelta.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ChatToolPlanDeltaEventDelta: core.serialization.ObjectSchema< + serializers.ChatToolPlanDeltaEventDelta.Raw, + Cohere.ChatToolPlanDeltaEventDelta +> = core.serialization.object({ + toolPlan: core.serialization.property("tool_plan", core.serialization.string().optional()), +}); + +export declare namespace ChatToolPlanDeltaEventDelta { + interface Raw { + tool_plan?: string | null; + } +} diff --git a/src/serialization/resources/v2/types/Citation.ts b/src/serialization/resources/v2/types/Citation.ts new file mode 100644 index 00000000..3b91502e --- /dev/null +++ b/src/serialization/resources/v2/types/Citation.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { Source } from "./Source"; + +export const Citation: core.serialization.ObjectSchema = + core.serialization.object({ + start: core.serialization.string().optional(), + end: core.serialization.string().optional(), + text: core.serialization.string().optional(), + sources: core.serialization.list(Source).optional(), + }); + +export declare namespace Citation { + interface Raw { + start?: string | null; + end?: string | null; + text?: string | null; + sources?: Source.Raw[] | null; + } +} diff --git a/src/serialization/resources/v2/types/Content.ts b/src/serialization/resources/v2/types/Content.ts new file mode 100644 index 00000000..c7f65c92 --- /dev/null +++ b/src/serialization/resources/v2/types/Content.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { TextContent } from "./TextContent"; +import { DocumentContent } from "./DocumentContent"; + +export const Content: core.serialization.Schema = core.serialization + .union("type", { + text: TextContent, + document: DocumentContent, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace Content { + type Raw = Content.Text | Content.Document; + + interface Text extends TextContent.Raw { + type: "text"; + } + + interface Document extends DocumentContent.Raw { + type: "document"; + } +} diff --git a/src/serialization/resources/v2/types/DocumentContent.ts b/src/serialization/resources/v2/types/DocumentContent.ts new file mode 100644 index 00000000..7decbe40 --- /dev/null +++ b/src/serialization/resources/v2/types/DocumentContent.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const DocumentContent: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + document: core.serialization.record(core.serialization.string(), core.serialization.unknown()), + }); + +export declare namespace DocumentContent { + interface Raw { + id: string; + document: Record; + } +} diff --git a/src/serialization/resources/v2/types/DocumentSource.ts b/src/serialization/resources/v2/types/DocumentSource.ts new file mode 100644 index 00000000..19f86dd2 --- /dev/null +++ b/src/serialization/resources/v2/types/DocumentSource.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const DocumentSource: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + document: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace DocumentSource { + interface Raw { + id?: string | null; + document?: Record | null; + } +} diff --git a/src/serialization/resources/v2/types/NonStreamedChatResponse2.ts b/src/serialization/resources/v2/types/NonStreamedChatResponse2.ts new file mode 100644 index 00000000..0584e070 --- /dev/null +++ b/src/serialization/resources/v2/types/NonStreamedChatResponse2.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatFinishReason } from "./ChatFinishReason"; +import { AssistantMessage } from "./AssistantMessage"; +import { Usage } from "./Usage"; + +export const NonStreamedChatResponse2: core.serialization.ObjectSchema< + serializers.NonStreamedChatResponse2.Raw, + Cohere.NonStreamedChatResponse2 +> = core.serialization.object({ + id: core.serialization.string(), + finishReason: core.serialization.property("finish_reason", ChatFinishReason), + prompt: core.serialization.string().optional(), + message: AssistantMessage.optional(), + usage: Usage.optional(), +}); + +export declare namespace NonStreamedChatResponse2 { + interface Raw { + id: string; + finish_reason: ChatFinishReason.Raw; + prompt?: string | null; + message?: AssistantMessage.Raw | null; + usage?: Usage.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/Source.ts b/src/serialization/resources/v2/types/Source.ts new file mode 100644 index 00000000..bcac067d --- /dev/null +++ b/src/serialization/resources/v2/types/Source.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolSource } from "./ToolSource"; +import { DocumentSource } from "./DocumentSource"; + +export const Source: core.serialization.Schema = core.serialization + .union("type", { + tool: ToolSource, + document: DocumentSource, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace Source { + type Raw = Source.Tool | Source.Document; + + interface Tool extends ToolSource.Raw { + type: "tool"; + } + + interface Document extends DocumentSource.Raw { + type: "document"; + } +} diff --git a/src/serialization/resources/v2/types/StreamedChatResponse2.ts b/src/serialization/resources/v2/types/StreamedChatResponse2.ts new file mode 100644 index 00000000..eb2f3a47 --- /dev/null +++ b/src/serialization/resources/v2/types/StreamedChatResponse2.ts @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessageStartEvent } from "./ChatMessageStartEvent"; +import { ChatContentStartEvent } from "./ChatContentStartEvent"; +import { ChatContentDeltaEvent } from "./ChatContentDeltaEvent"; +import { ChatContentEndEvent } from "./ChatContentEndEvent"; +import { ChatToolPlanDeltaEvent } from "./ChatToolPlanDeltaEvent"; +import { ChatToolCallStartEvent } from "./ChatToolCallStartEvent"; +import { ChatToolCallDeltaEvent } from "./ChatToolCallDeltaEvent"; +import { ChatToolCallEndEvent } from "./ChatToolCallEndEvent"; +import { ChatMessageEndEvent } from "./ChatMessageEndEvent"; + +export const StreamedChatResponse2: core.serialization.Schema< + serializers.StreamedChatResponse2.Raw, + Cohere.StreamedChatResponse2 +> = core.serialization + .union("type", { + "message-start": ChatMessageStartEvent, + "content-start": ChatContentStartEvent, + "content-delta": ChatContentDeltaEvent, + "content-end": ChatContentEndEvent, + "tool-plan-delta": ChatToolPlanDeltaEvent, + "tool-call-start": ChatToolCallStartEvent, + "tool-call-delta": ChatToolCallDeltaEvent, + "tool-call-end": ChatToolCallEndEvent, + "message-end": ChatMessageEndEvent, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace StreamedChatResponse2 { + type Raw = + | StreamedChatResponse2.MessageStart + | StreamedChatResponse2.ContentStart + | StreamedChatResponse2.ContentDelta + | StreamedChatResponse2.ContentEnd + | StreamedChatResponse2.ToolPlanDelta + | StreamedChatResponse2.ToolCallStart + | StreamedChatResponse2.ToolCallDelta + | StreamedChatResponse2.ToolCallEnd + | StreamedChatResponse2.MessageEnd; + + interface MessageStart extends ChatMessageStartEvent.Raw { + type: "message-start"; + } + + interface ContentStart extends ChatContentStartEvent.Raw { + type: "content-start"; + } + + interface ContentDelta extends ChatContentDeltaEvent.Raw { + type: "content-delta"; + } + + interface ContentEnd extends ChatContentEndEvent.Raw { + type: "content-end"; + } + + interface ToolPlanDelta extends ChatToolPlanDeltaEvent.Raw { + type: "tool-plan-delta"; + } + + interface ToolCallStart extends ChatToolCallStartEvent.Raw { + type: "tool-call-start"; + } + + interface ToolCallDelta extends ChatToolCallDeltaEvent.Raw { + type: "tool-call-delta"; + } + + interface ToolCallEnd extends ChatToolCallEndEvent.Raw { + type: "tool-call-end"; + } + + interface MessageEnd extends ChatMessageEndEvent.Raw { + type: "message-end"; + } +} diff --git a/src/serialization/resources/v2/types/SystemMessage.ts b/src/serialization/resources/v2/types/SystemMessage.ts new file mode 100644 index 00000000..2c945340 --- /dev/null +++ b/src/serialization/resources/v2/types/SystemMessage.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { SystemMessageContent } from "./SystemMessageContent"; + +export const SystemMessage: core.serialization.ObjectSchema = + core.serialization.object({ + content: SystemMessageContent, + }); + +export declare namespace SystemMessage { + interface Raw { + content: SystemMessageContent.Raw; + } +} diff --git a/src/serialization/resources/v2/types/SystemMessageContent.ts b/src/serialization/resources/v2/types/SystemMessageContent.ts new file mode 100644 index 00000000..f3263124 --- /dev/null +++ b/src/serialization/resources/v2/types/SystemMessageContent.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { SystemMessageContentItem } from "./SystemMessageContentItem"; + +export const SystemMessageContent: core.serialization.Schema< + serializers.SystemMessageContent.Raw, + Cohere.SystemMessageContent +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(SystemMessageContentItem), +]); + +export declare namespace SystemMessageContent { + type Raw = string | SystemMessageContentItem.Raw[]; +} diff --git a/src/serialization/resources/v2/types/SystemMessageContentItem.ts b/src/serialization/resources/v2/types/SystemMessageContentItem.ts new file mode 100644 index 00000000..f8898f4f --- /dev/null +++ b/src/serialization/resources/v2/types/SystemMessageContentItem.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { TextContent } from "./TextContent"; + +export const SystemMessageContentItem: core.serialization.Schema< + serializers.SystemMessageContentItem.Raw, + Cohere.SystemMessageContentItem +> = core.serialization + .union("type", { + text: TextContent, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace SystemMessageContentItem { + type Raw = SystemMessageContentItem.Text; + + interface Text extends TextContent.Raw { + type: "text"; + } +} diff --git a/src/serialization/resources/v2/types/TextContent.ts b/src/serialization/resources/v2/types/TextContent.ts new file mode 100644 index 00000000..98616015 --- /dev/null +++ b/src/serialization/resources/v2/types/TextContent.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const TextContent: core.serialization.ObjectSchema = + core.serialization.object({ + text: core.serialization.string(), + }); + +export declare namespace TextContent { + interface Raw { + text: string; + } +} diff --git a/src/serialization/resources/v2/types/Tool2.ts b/src/serialization/resources/v2/types/Tool2.ts new file mode 100644 index 00000000..6fbd7cb0 --- /dev/null +++ b/src/serialization/resources/v2/types/Tool2.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tool2Function } from "./Tool2Function"; + +export const Tool2: core.serialization.ObjectSchema = core.serialization.object({ + type: core.serialization.stringLiteral("function").optional(), + function: Tool2Function.optional(), +}); + +export declare namespace Tool2 { + interface Raw { + type?: "function" | null; + function?: Tool2Function.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/Tool2Function.ts b/src/serialization/resources/v2/types/Tool2Function.ts new file mode 100644 index 00000000..6dfc516d --- /dev/null +++ b/src/serialization/resources/v2/types/Tool2Function.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const Tool2Function: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace Tool2Function { + interface Raw { + name?: string | null; + description?: string | null; + parameters?: Record | null; + } +} diff --git a/src/serialization/resources/v2/types/ToolCall2.ts b/src/serialization/resources/v2/types/ToolCall2.ts new file mode 100644 index 00000000..03a00d5c --- /dev/null +++ b/src/serialization/resources/v2/types/ToolCall2.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolCall2Function } from "./ToolCall2Function"; + +export const ToolCall2: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + type: core.serialization.stringLiteral("function").optional(), + function: ToolCall2Function.optional(), + }); + +export declare namespace ToolCall2 { + interface Raw { + id?: string | null; + type?: "function" | null; + function?: ToolCall2Function.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/ToolCall2Function.ts b/src/serialization/resources/v2/types/ToolCall2Function.ts new file mode 100644 index 00000000..b117cfeb --- /dev/null +++ b/src/serialization/resources/v2/types/ToolCall2Function.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ToolCall2Function: core.serialization.ObjectSchema< + serializers.ToolCall2Function.Raw, + Cohere.ToolCall2Function +> = core.serialization.object({ + name: core.serialization.string().optional(), + arguments: core.serialization.string().optional(), +}); + +export declare namespace ToolCall2Function { + interface Raw { + name?: string | null; + arguments?: string | null; + } +} diff --git a/src/serialization/resources/v2/types/ToolContent.ts b/src/serialization/resources/v2/types/ToolContent.ts new file mode 100644 index 00000000..2adaf7e1 --- /dev/null +++ b/src/serialization/resources/v2/types/ToolContent.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ToolContent: core.serialization.ObjectSchema = + core.serialization.object({ + output: core.serialization.record(core.serialization.string(), core.serialization.unknown()), + }); + +export declare namespace ToolContent { + interface Raw { + output: Record; + } +} diff --git a/src/serialization/resources/v2/types/ToolMessage2.ts b/src/serialization/resources/v2/types/ToolMessage2.ts new file mode 100644 index 00000000..bf8eb39f --- /dev/null +++ b/src/serialization/resources/v2/types/ToolMessage2.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolMessage2ToolContentItem } from "./ToolMessage2ToolContentItem"; + +export const ToolMessage2: core.serialization.ObjectSchema = + core.serialization.object({ + toolCallId: core.serialization.property("tool_call_id", core.serialization.string()), + toolContent: core.serialization.property("tool_content", core.serialization.list(ToolMessage2ToolContentItem)), + }); + +export declare namespace ToolMessage2 { + interface Raw { + tool_call_id: string; + tool_content: ToolMessage2ToolContentItem.Raw[]; + } +} diff --git a/src/serialization/resources/v2/types/ToolMessage2ToolContentItem.ts b/src/serialization/resources/v2/types/ToolMessage2ToolContentItem.ts new file mode 100644 index 00000000..5acef46b --- /dev/null +++ b/src/serialization/resources/v2/types/ToolMessage2ToolContentItem.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolContent } from "./ToolContent"; + +export const ToolMessage2ToolContentItem: core.serialization.Schema< + serializers.ToolMessage2ToolContentItem.Raw, + Cohere.ToolMessage2ToolContentItem +> = core.serialization + .union("type", { + tool_result_object: ToolContent, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace ToolMessage2ToolContentItem { + type Raw = ToolMessage2ToolContentItem.ToolResultObject; + + interface ToolResultObject extends ToolContent.Raw { + type: "tool_result_object"; + } +} diff --git a/src/serialization/resources/v2/types/ToolSource.ts b/src/serialization/resources/v2/types/ToolSource.ts new file mode 100644 index 00000000..aa74ed23 --- /dev/null +++ b/src/serialization/resources/v2/types/ToolSource.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const ToolSource: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + toolOutput: core.serialization.property( + "tool_output", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + }); + +export declare namespace ToolSource { + interface Raw { + id?: string | null; + tool_output?: Record | null; + } +} diff --git a/src/serialization/resources/v2/types/Usage.ts b/src/serialization/resources/v2/types/Usage.ts new file mode 100644 index 00000000..3bb3aa24 --- /dev/null +++ b/src/serialization/resources/v2/types/Usage.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { UsageBilledUnits } from "./UsageBilledUnits"; +import { UsageTokens } from "./UsageTokens"; + +export const Usage: core.serialization.ObjectSchema = core.serialization.object({ + billedUnits: core.serialization.property("billed_units", UsageBilledUnits.optional()), + tokens: UsageTokens.optional(), +}); + +export declare namespace Usage { + interface Raw { + billed_units?: UsageBilledUnits.Raw | null; + tokens?: UsageTokens.Raw | null; + } +} diff --git a/src/serialization/resources/v2/types/UsageBilledUnits.ts b/src/serialization/resources/v2/types/UsageBilledUnits.ts new file mode 100644 index 00000000..68c8bdea --- /dev/null +++ b/src/serialization/resources/v2/types/UsageBilledUnits.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const UsageBilledUnits: core.serialization.ObjectSchema< + serializers.UsageBilledUnits.Raw, + Cohere.UsageBilledUnits +> = core.serialization.object({ + inputTokens: core.serialization.property("input_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + searchUnits: core.serialization.property("search_units", core.serialization.number().optional()), + classifications: core.serialization.number().optional(), +}); + +export declare namespace UsageBilledUnits { + interface Raw { + input_tokens?: number | null; + output_tokens?: number | null; + search_units?: number | null; + classifications?: number | null; + } +} diff --git a/src/serialization/resources/v2/types/UsageTokens.ts b/src/serialization/resources/v2/types/UsageTokens.ts new file mode 100644 index 00000000..a414e98d --- /dev/null +++ b/src/serialization/resources/v2/types/UsageTokens.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const UsageTokens: core.serialization.ObjectSchema = + core.serialization.object({ + inputTokens: core.serialization.property("input_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + }); + +export declare namespace UsageTokens { + interface Raw { + input_tokens?: number | null; + output_tokens?: number | null; + } +} diff --git a/src/serialization/resources/v2/types/UserMessage.ts b/src/serialization/resources/v2/types/UserMessage.ts new file mode 100644 index 00000000..d2708326 --- /dev/null +++ b/src/serialization/resources/v2/types/UserMessage.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { UserMessageContent } from "./UserMessageContent"; + +export const UserMessage: core.serialization.ObjectSchema = + core.serialization.object({ + content: UserMessageContent, + }); + +export declare namespace UserMessage { + interface Raw { + content: UserMessageContent.Raw; + } +} diff --git a/src/serialization/resources/v2/types/UserMessageContent.ts b/src/serialization/resources/v2/types/UserMessageContent.ts new file mode 100644 index 00000000..c03d2228 --- /dev/null +++ b/src/serialization/resources/v2/types/UserMessageContent.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; +import { Content } from "./Content"; + +export const UserMessageContent: core.serialization.Schema< + serializers.UserMessageContent.Raw, + Cohere.UserMessageContent +> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(Content)]); + +export declare namespace UserMessageContent { + type Raw = string | Content.Raw[]; +} diff --git a/src/serialization/resources/v2/types/V2ChatRequestCitationMode.ts b/src/serialization/resources/v2/types/V2ChatRequestCitationMode.ts new file mode 100644 index 00000000..f3e0216d --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatRequestCitationMode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatRequestCitationMode: core.serialization.Schema< + serializers.V2ChatRequestCitationMode.Raw, + Cohere.V2ChatRequestCitationMode +> = core.serialization.enum_(["FAST", "ACCURATE"]); + +export declare namespace V2ChatRequestCitationMode { + type Raw = "FAST" | "ACCURATE"; +} diff --git a/src/serialization/resources/v2/types/V2ChatRequestResponseFormat.ts b/src/serialization/resources/v2/types/V2ChatRequestResponseFormat.ts new file mode 100644 index 00000000..040fe215 --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatRequestResponseFormat.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatRequestResponseFormat: core.serialization.ObjectSchema< + serializers.V2ChatRequestResponseFormat.Raw, + Cohere.V2ChatRequestResponseFormat +> = core.serialization.object({ + type: core.serialization.stringLiteral("json_object").optional(), + schema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace V2ChatRequestResponseFormat { + interface Raw { + type?: "json_object" | null; + schema?: Record | null; + } +} diff --git a/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts b/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts new file mode 100644 index 00000000..74938399 --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatRequestToolChoice: core.serialization.Schema< + serializers.V2ChatRequestToolChoice.Raw, + Cohere.V2ChatRequestToolChoice +> = core.serialization.enum_(["AUTO", "NONE", "ANY"]); + +export declare namespace V2ChatRequestToolChoice { + type Raw = "AUTO" | "NONE" | "ANY"; +} diff --git a/src/serialization/resources/v2/types/V2ChatRequestTruncationMode.ts b/src/serialization/resources/v2/types/V2ChatRequestTruncationMode.ts new file mode 100644 index 00000000..0532c07a --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatRequestTruncationMode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatRequestTruncationMode: core.serialization.Schema< + serializers.V2ChatRequestTruncationMode.Raw, + Cohere.V2ChatRequestTruncationMode +> = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); + +export declare namespace V2ChatRequestTruncationMode { + type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; +} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestCitationMode.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestCitationMode.ts new file mode 100644 index 00000000..1a1b4b63 --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatStreamRequestCitationMode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatStreamRequestCitationMode: core.serialization.Schema< + serializers.V2ChatStreamRequestCitationMode.Raw, + Cohere.V2ChatStreamRequestCitationMode +> = core.serialization.enum_(["FAST", "ACCURATE"]); + +export declare namespace V2ChatStreamRequestCitationMode { + type Raw = "FAST" | "ACCURATE"; +} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestResponseFormat.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestResponseFormat.ts new file mode 100644 index 00000000..3b8432ad --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatStreamRequestResponseFormat.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatStreamRequestResponseFormat: core.serialization.ObjectSchema< + serializers.V2ChatStreamRequestResponseFormat.Raw, + Cohere.V2ChatStreamRequestResponseFormat +> = core.serialization.object({ + type: core.serialization.stringLiteral("json_object").optional(), + schema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace V2ChatStreamRequestResponseFormat { + interface Raw { + type?: "json_object" | null; + schema?: Record | null; + } +} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts new file mode 100644 index 00000000..dda6df06 --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatStreamRequestToolChoice: core.serialization.Schema< + serializers.V2ChatStreamRequestToolChoice.Raw, + Cohere.V2ChatStreamRequestToolChoice +> = core.serialization.enum_(["AUTO", "NONE", "ANY"]); + +export declare namespace V2ChatStreamRequestToolChoice { + type Raw = "AUTO" | "NONE" | "ANY"; +} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestTruncationMode.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestTruncationMode.ts new file mode 100644 index 00000000..3975bf5f --- /dev/null +++ b/src/serialization/resources/v2/types/V2ChatStreamRequestTruncationMode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Cohere from "../../../../api/index"; +import * as core from "../../../../core"; + +export const V2ChatStreamRequestTruncationMode: core.serialization.Schema< + serializers.V2ChatStreamRequestTruncationMode.Raw, + Cohere.V2ChatStreamRequestTruncationMode +> = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); + +export declare namespace V2ChatStreamRequestTruncationMode { + type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; +} diff --git a/src/serialization/resources/v2/types/index.ts b/src/serialization/resources/v2/types/index.ts new file mode 100644 index 00000000..05f35529 --- /dev/null +++ b/src/serialization/resources/v2/types/index.ts @@ -0,0 +1,62 @@ +export * from "./V2ChatStreamRequestToolChoice"; +export * from "./V2ChatStreamRequestCitationMode"; +export * from "./V2ChatStreamRequestTruncationMode"; +export * from "./V2ChatStreamRequestResponseFormat"; +export * from "./V2ChatRequestToolChoice"; +export * from "./V2ChatRequestCitationMode"; +export * from "./V2ChatRequestTruncationMode"; +export * from "./V2ChatRequestResponseFormat"; +export * from "./ToolCall2Function"; +export * from "./ToolCall2"; +export * from "./TextContent"; +export * from "./ToolSource"; +export * from "./DocumentSource"; +export * from "./Source"; +export * from "./Citation"; +export * from "./AssistantMessage"; +export * from "./SystemMessageContentItem"; +export * from "./SystemMessageContent"; +export * from "./SystemMessage"; +export * from "./DocumentContent"; +export * from "./Content"; +export * from "./UserMessageContent"; +export * from "./UserMessage"; +export * from "./ToolContent"; +export * from "./ToolMessage2ToolContentItem"; +export * from "./ToolMessage2"; +export * from "./ChatMessage2"; +export * from "./ChatMessages"; +export * from "./Tool2Function"; +export * from "./Tool2"; +export * from "./ChatFinishReason"; +export * from "./UsageBilledUnits"; +export * from "./UsageTokens"; +export * from "./Usage"; +export * from "./NonStreamedChatResponse2"; +export * from "./ChatStreamEventType"; +export * from "./ChatMessageStartEventDeltaMessage"; +export * from "./ChatMessageStartEventDelta"; +export * from "./ChatMessageStartEvent"; +export * from "./ChatContentStartEventDeltaMessageContent"; +export * from "./ChatContentStartEventDeltaMessage"; +export * from "./ChatContentStartEventDelta"; +export * from "./ChatContentStartEvent"; +export * from "./ChatContentDeltaEventDeltaMessageContent"; +export * from "./ChatContentDeltaEventDeltaMessage"; +export * from "./ChatContentDeltaEventDelta"; +export * from "./ChatContentDeltaEvent"; +export * from "./ChatContentEndEvent"; +export * from "./ChatToolPlanDeltaEventDelta"; +export * from "./ChatToolPlanDeltaEvent"; +export * from "./ChatToolCallStartEventDeltaToolCallFunction"; +export * from "./ChatToolCallStartEventDeltaToolCall"; +export * from "./ChatToolCallStartEventDelta"; +export * from "./ChatToolCallStartEvent"; +export * from "./ChatToolCallDeltaEventDeltaToolCallFunction"; +export * from "./ChatToolCallDeltaEventDeltaToolCall"; +export * from "./ChatToolCallDeltaEventDelta"; +export * from "./ChatToolCallDeltaEvent"; +export * from "./ChatToolCallEndEvent"; +export * from "./ChatMessageEndEventDelta"; +export * from "./ChatMessageEndEvent"; +export * from "./StreamedChatResponse2"; diff --git a/src/test/testsV2.test.ts b/src/test/testsV2.test.ts new file mode 100644 index 00000000..efe7f825 --- /dev/null +++ b/src/test/testsV2.test.ts @@ -0,0 +1,51 @@ +import { describe } from "@jest/globals"; +import { CohereClientV2 } from "../ClientV2"; + +const cohere = new CohereClientV2({ + token: process.env.COHERE_API_KEY!, + clientName: "typescript-e2e", +}); + +describe("test sdk", () => { + it("chat", async () => { + const response = await cohere.chat({ + model: "command-r-plus", + messages: [ + { + role: "user", + content: "hello world!", + }, + ], + }); + console.log(response.message); + }); + + it("chatStream", async () => { + const stream = await cohere.chatStream({ + model: "command-r-plus", + messages: [ + { + role: "user", + content: "hello world!", + }, + ], + }); + + const events = new Set(); + + for await (const chatEvent of stream) { + if (chatEvent) { + events.add(chatEvent.type); + if (chatEvent.type === "content-delta") { + console.log(chatEvent.delta?.message); + } + } + } + + expect(events.has("message-start")).toBeTruthy(); + expect(events.has("content-start")).toBeTruthy(); + expect(events.has("content-delta")).toBeTruthy(); + expect(events.has("content-end")).toBeTruthy(); + expect(events.has("message-end")).toBeTruthy(); + }); +}); diff --git a/yarn.lock b/yarn.lock index 3e51381d..8a974292 100644 --- a/yarn.lock +++ b/yarn.lock @@ -66,17 +66,17 @@ "@smithy/util-utf8" "^2.0.0" tslib "^2.6.2" -"@aws-sdk/client-cognito-identity@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.621.0.tgz#b772e4bcea1a953b351011aeedbb2922b673539d" - integrity sha512-FpXia5qFf6ijcNDWenVq+mP9r1LbiW/+52i9wrv2+Afi6Nn1ROf8W7St8WvE9TEZ3t78y+vis4CwqfGts+uiKA== +"@aws-sdk/client-cognito-identity@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.624.0.tgz#c5f6e29d7b4b531d25f45b255f8aebb0db8fac22" + integrity sha512-imw3bNptHdhcogU3lwSVlQJsRpTxnkT4bQbchS/qX6+fF0Pk6ERZ+Q0YjzitPqTjkeyAWecUT4riyqv2djo+5w== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/client-sso-oidc" "3.621.0" - "@aws-sdk/client-sts" "3.621.0" - "@aws-sdk/core" "3.621.0" - "@aws-sdk/credential-provider-node" "3.621.0" + "@aws-sdk/client-sso-oidc" "3.624.0" + "@aws-sdk/client-sts" "3.624.0" + "@aws-sdk/core" "3.624.0" + "@aws-sdk/credential-provider-node" "3.624.0" "@aws-sdk/middleware-host-header" "3.620.0" "@aws-sdk/middleware-logger" "3.609.0" "@aws-sdk/middleware-recursion-detection" "3.620.0" @@ -87,26 +87,26 @@ "@aws-sdk/util-user-agent-browser" "3.609.0" "@aws-sdk/util-user-agent-node" "3.614.0" "@smithy/config-resolver" "^3.0.5" - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/hash-node" "^3.0.3" "@smithy/invalid-dependency" "^3.0.3" "@smithy/middleware-content-length" "^3.0.5" "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/middleware-stack" "^3.0.3" "@smithy/node-config-provider" "^3.1.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/url-parser" "^3.0.3" "@smithy/util-base64" "^3.0.0" "@smithy/util-body-length-browser" "^3.0.0" "@smithy/util-body-length-node" "^3.0.0" - "@smithy/util-defaults-mode-browser" "^3.0.13" - "@smithy/util-defaults-mode-node" "^3.0.13" + "@smithy/util-defaults-mode-browser" "^3.0.14" + "@smithy/util-defaults-mode-node" "^3.0.14" "@smithy/util-endpoints" "^2.0.5" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" @@ -114,16 +114,16 @@ tslib "^2.6.2" "@aws-sdk/client-sagemaker@^3.583.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sagemaker/-/client-sagemaker-3.621.0.tgz#a2f0c950dea72180a56d6420c57affebe44b972e" - integrity sha512-dm/BxGt+XlCqhDvex0487umiQJpUM8B3Ls9MbEoZZaf0Q+IJnOnZmtigd72YziXH5BxdoNOJxD2sERVki+XQNQ== + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sagemaker/-/client-sagemaker-3.624.0.tgz#63c76175b0454abba63e4b8625c58b492ccfc816" + integrity sha512-J04HAxGhC3dQRn43aPcPL6C+uW0wd0gR/dehFqJJA+XvSNLxa9HEiTjYUHCHUY+iaLQn5QCk7ICKRosynhQkxw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/client-sso-oidc" "3.621.0" - "@aws-sdk/client-sts" "3.621.0" - "@aws-sdk/core" "3.621.0" - "@aws-sdk/credential-provider-node" "3.621.0" + "@aws-sdk/client-sso-oidc" "3.624.0" + "@aws-sdk/client-sts" "3.624.0" + "@aws-sdk/core" "3.624.0" + "@aws-sdk/credential-provider-node" "3.624.0" "@aws-sdk/middleware-host-header" "3.620.0" "@aws-sdk/middleware-logger" "3.609.0" "@aws-sdk/middleware-recursion-detection" "3.620.0" @@ -134,26 +134,26 @@ "@aws-sdk/util-user-agent-browser" "3.609.0" "@aws-sdk/util-user-agent-node" "3.614.0" "@smithy/config-resolver" "^3.0.5" - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/hash-node" "^3.0.3" "@smithy/invalid-dependency" "^3.0.3" "@smithy/middleware-content-length" "^3.0.5" "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/middleware-stack" "^3.0.3" "@smithy/node-config-provider" "^3.1.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/url-parser" "^3.0.3" "@smithy/util-base64" "^3.0.0" "@smithy/util-body-length-browser" "^3.0.0" "@smithy/util-body-length-node" "^3.0.0" - "@smithy/util-defaults-mode-browser" "^3.0.13" - "@smithy/util-defaults-mode-node" "^3.0.13" + "@smithy/util-defaults-mode-browser" "^3.0.14" + "@smithy/util-defaults-mode-node" "^3.0.14" "@smithy/util-endpoints" "^2.0.5" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" @@ -162,15 +162,15 @@ tslib "^2.6.2" uuid "^9.0.1" -"@aws-sdk/client-sso-oidc@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.621.0.tgz#3fa3d468fbebbd93a5f75c1d51b63cc7af3ef17b" - integrity sha512-mMjk3mFUwV2Y68POf1BQMTF+F6qxt5tPu6daEUCNGC9Cenk3h2YXQQoS4/eSyYzuBiYk3vx49VgleRvdvkg8rg== +"@aws-sdk/client-sso-oidc@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.624.0.tgz#33d0927519de333387ee07cb7f6483b0bd4db2f2" + integrity sha512-Ki2uKYJKKtfHxxZsiMTOvJoVRP6b2pZ1u3rcUb2m/nVgBPUfLdl8ZkGpqE29I+t5/QaS/sEdbn6cgMUZwl+3Dg== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.621.0" - "@aws-sdk/credential-provider-node" "3.621.0" + "@aws-sdk/core" "3.624.0" + "@aws-sdk/credential-provider-node" "3.624.0" "@aws-sdk/middleware-host-header" "3.620.0" "@aws-sdk/middleware-logger" "3.609.0" "@aws-sdk/middleware-recursion-detection" "3.620.0" @@ -181,40 +181,40 @@ "@aws-sdk/util-user-agent-browser" "3.609.0" "@aws-sdk/util-user-agent-node" "3.614.0" "@smithy/config-resolver" "^3.0.5" - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/hash-node" "^3.0.3" "@smithy/invalid-dependency" "^3.0.3" "@smithy/middleware-content-length" "^3.0.5" "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/middleware-stack" "^3.0.3" "@smithy/node-config-provider" "^3.1.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/url-parser" "^3.0.3" "@smithy/util-base64" "^3.0.0" "@smithy/util-body-length-browser" "^3.0.0" "@smithy/util-body-length-node" "^3.0.0" - "@smithy/util-defaults-mode-browser" "^3.0.13" - "@smithy/util-defaults-mode-node" "^3.0.13" + "@smithy/util-defaults-mode-browser" "^3.0.14" + "@smithy/util-defaults-mode-node" "^3.0.14" "@smithy/util-endpoints" "^2.0.5" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" "@smithy/util-utf8" "^3.0.0" tslib "^2.6.2" -"@aws-sdk/client-sso@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.621.0.tgz#c0eefeb9adcbc6bb7c91c32070404c8c91846825" - integrity sha512-xpKfikN4u0BaUYZA9FGUMkkDmfoIP0Q03+A86WjqDWhcOoqNA1DkHsE4kZ+r064ifkPUfcNuUvlkVTEoBZoFjA== +"@aws-sdk/client-sso@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.624.0.tgz#5d6bd308c1a6bb876c0bffc369c31a4916271219" + integrity sha512-EX6EF+rJzMPC5dcdsu40xSi2To7GSvdGQNIpe97pD9WvZwM9tRNQnNM4T6HA4gjV1L6Jwk8rBlG/CnveXtLEMw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.621.0" + "@aws-sdk/core" "3.624.0" "@aws-sdk/middleware-host-header" "3.620.0" "@aws-sdk/middleware-logger" "3.609.0" "@aws-sdk/middleware-recursion-detection" "3.620.0" @@ -225,42 +225,42 @@ "@aws-sdk/util-user-agent-browser" "3.609.0" "@aws-sdk/util-user-agent-node" "3.614.0" "@smithy/config-resolver" "^3.0.5" - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/hash-node" "^3.0.3" "@smithy/invalid-dependency" "^3.0.3" "@smithy/middleware-content-length" "^3.0.5" "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/middleware-stack" "^3.0.3" "@smithy/node-config-provider" "^3.1.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/url-parser" "^3.0.3" "@smithy/util-base64" "^3.0.0" "@smithy/util-body-length-browser" "^3.0.0" "@smithy/util-body-length-node" "^3.0.0" - "@smithy/util-defaults-mode-browser" "^3.0.13" - "@smithy/util-defaults-mode-node" "^3.0.13" + "@smithy/util-defaults-mode-browser" "^3.0.14" + "@smithy/util-defaults-mode-node" "^3.0.14" "@smithy/util-endpoints" "^2.0.5" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" "@smithy/util-utf8" "^3.0.0" tslib "^2.6.2" -"@aws-sdk/client-sts@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.621.0.tgz#2994f601790893901704c5df56c837e89f279952" - integrity sha512-707uiuReSt+nAx6d0c21xLjLm2lxeKc7padxjv92CIrIocnQSlJPxSCM7r5zBhwiahJA6MNQwmTl2xznU67KgA== +"@aws-sdk/client-sts@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.624.0.tgz#ee19e08835a04d173f4997285e26558ac431d938" + integrity sha512-k36fLZCb2nfoV/DKK3jbRgO/Yf7/R80pgYfMiotkGjnZwDmRvNN08z4l06L9C+CieazzkgRxNUzyppsYcYsQaw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/client-sso-oidc" "3.621.0" - "@aws-sdk/core" "3.621.0" - "@aws-sdk/credential-provider-node" "3.621.0" + "@aws-sdk/client-sso-oidc" "3.624.0" + "@aws-sdk/core" "3.624.0" + "@aws-sdk/credential-provider-node" "3.624.0" "@aws-sdk/middleware-host-header" "3.620.0" "@aws-sdk/middleware-logger" "3.609.0" "@aws-sdk/middleware-recursion-detection" "3.620.0" @@ -271,53 +271,53 @@ "@aws-sdk/util-user-agent-browser" "3.609.0" "@aws-sdk/util-user-agent-node" "3.614.0" "@smithy/config-resolver" "^3.0.5" - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/hash-node" "^3.0.3" "@smithy/invalid-dependency" "^3.0.3" "@smithy/middleware-content-length" "^3.0.5" "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/middleware-stack" "^3.0.3" "@smithy/node-config-provider" "^3.1.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/url-parser" "^3.0.3" "@smithy/util-base64" "^3.0.0" "@smithy/util-body-length-browser" "^3.0.0" "@smithy/util-body-length-node" "^3.0.0" - "@smithy/util-defaults-mode-browser" "^3.0.13" - "@smithy/util-defaults-mode-node" "^3.0.13" + "@smithy/util-defaults-mode-browser" "^3.0.14" + "@smithy/util-defaults-mode-node" "^3.0.14" "@smithy/util-endpoints" "^2.0.5" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" "@smithy/util-utf8" "^3.0.0" tslib "^2.6.2" -"@aws-sdk/core@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.621.0.tgz#e38c56c3ce0c819ca1185eaabcb98412429aaca3" - integrity sha512-CtOwWmDdEiINkGXD93iGfXjN0WmCp9l45cDWHHGa8lRgEDyhuL7bwd/pH5aSzj0j8SiQBG2k0S7DHbd5RaqvbQ== +"@aws-sdk/core@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.624.0.tgz#ff0d7745bd662f53d99dbb7293416a45ddde5aa6" + integrity sha512-WyFmPbhRIvtWi7hBp8uSFy+iPpj8ccNV/eX86hwF4irMjfc/FtsGVIAeBXxXM/vGCjkdfEzOnl+tJ2XACD4OXg== dependencies: - "@smithy/core" "^2.3.1" + "@smithy/core" "^2.3.2" "@smithy/node-config-provider" "^3.1.4" "@smithy/protocol-http" "^4.1.0" "@smithy/signature-v4" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/util-middleware" "^3.0.3" fast-xml-parser "4.4.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-cognito-identity@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.621.0.tgz#063804386a97088a2d9849a318ed0275f25d0d73" - integrity sha512-Q+3awvTVJSqIGRjCUQflRwKPKlZ0TfmL3EQHgFLhZZrToeBapEA62+FY+T70aTKAZZZZprlvYeFPtBloNd5ziA== +"@aws-sdk/credential-provider-cognito-identity@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.624.0.tgz#dbcbf6b92b7844e70c2d2999ce6da78e48f538bf" + integrity sha512-gbXaxZP29yzMmEUzsGqUrHpKBnfMBtemvrlufJbaz/MGJNIa5qtJQp7n1LMI5R49DBVUN9s/e9Rf5liyMvlHiw== dependencies: - "@aws-sdk/client-cognito-identity" "3.621.0" + "@aws-sdk/client-cognito-identity" "3.624.0" "@aws-sdk/types" "3.609.0" "@smithy/property-provider" "^3.1.3" "@smithy/types" "^3.3.0" @@ -333,30 +333,30 @@ "@smithy/types" "^3.3.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-http@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.621.0.tgz#5f944bf548f203d842cf71a5792f73c205544627" - integrity sha512-/jc2tEsdkT1QQAI5Dvoci50DbSxtJrevemwFsm0B73pwCcOQZ5ZwwSdVqGsPutzYzUVx3bcXg3LRL7jLACqRIg== +"@aws-sdk/credential-provider-http@3.622.0": + version "3.622.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.622.0.tgz#db481fdef859849d07dd5870894f45df2debab3d" + integrity sha512-VUHbr24Oll1RK3WR8XLUugLpgK9ZuxEm/NVeVqyFts1Ck9gsKpRg1x4eH7L7tW3SJ4TDEQNMbD7/7J+eoL2svg== dependencies: "@aws-sdk/types" "3.609.0" "@smithy/fetch-http-handler" "^3.2.4" "@smithy/node-http-handler" "^3.1.4" "@smithy/property-provider" "^3.1.3" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/util-stream" "^3.1.3" tslib "^2.6.2" -"@aws-sdk/credential-provider-ini@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.621.0.tgz#bda2365f88fee40e3ae067b08bf484106c339222" - integrity sha512-0EWVnSc+JQn5HLnF5Xv405M8n4zfdx9gyGdpnCmAmFqEDHA8LmBdxJdpUk1Ovp/I5oPANhjojxabIW5f1uU0RA== +"@aws-sdk/credential-provider-ini@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.624.0.tgz#af4b485e9ceeca97e1681b2402c50dc192c1dc06" + integrity sha512-mMoNIy7MO2WTBbdqMyLpbt6SZpthE6e0GkRYpsd0yozPt0RZopcBhEh+HG1U9Y1PVODo+jcMk353vAi61CfnhQ== dependencies: "@aws-sdk/credential-provider-env" "3.620.1" - "@aws-sdk/credential-provider-http" "3.621.0" + "@aws-sdk/credential-provider-http" "3.622.0" "@aws-sdk/credential-provider-process" "3.620.1" - "@aws-sdk/credential-provider-sso" "3.621.0" + "@aws-sdk/credential-provider-sso" "3.624.0" "@aws-sdk/credential-provider-web-identity" "3.621.0" "@aws-sdk/types" "3.609.0" "@smithy/credential-provider-imds" "^3.2.0" @@ -365,16 +365,16 @@ "@smithy/types" "^3.3.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-node@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.621.0.tgz#9cc5052760a9f9d70d70f12ddbdbf0d59bf13a47" - integrity sha512-4JqpccUgz5Snanpt2+53hbOBbJQrSFq7E1sAAbgY6BKVQUsW5qyXqnjvSF32kDeKa5JpBl3bBWLZl04IadcPHw== +"@aws-sdk/credential-provider-node@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.624.0.tgz#d7ebe191194eb09764b313c1f4e259cb42795079" + integrity sha512-vYyGK7oNpd81BdbH5IlmQ6zfaQqU+rPwsKTDDBeLRjshtrGXOEpfoahVpG9PX0ibu32IOWp4ZyXBNyVrnvcMOw== dependencies: "@aws-sdk/credential-provider-env" "3.620.1" - "@aws-sdk/credential-provider-http" "3.621.0" - "@aws-sdk/credential-provider-ini" "3.621.0" + "@aws-sdk/credential-provider-http" "3.622.0" + "@aws-sdk/credential-provider-ini" "3.624.0" "@aws-sdk/credential-provider-process" "3.620.1" - "@aws-sdk/credential-provider-sso" "3.621.0" + "@aws-sdk/credential-provider-sso" "3.624.0" "@aws-sdk/credential-provider-web-identity" "3.621.0" "@aws-sdk/types" "3.609.0" "@smithy/credential-provider-imds" "^3.2.0" @@ -394,12 +394,12 @@ "@smithy/types" "^3.3.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-sso@3.621.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.621.0.tgz#710f413708cb372f9f94e8eb9726cf263ffd83e3" - integrity sha512-Kza0jcFeA/GEL6xJlzR2KFf1PfZKMFnxfGzJzl5yN7EjoGdMijl34KaRyVnfRjnCWcsUpBWKNIDk9WZVMY9yiw== +"@aws-sdk/credential-provider-sso@3.624.0": + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.624.0.tgz#4a617577d04b23f80e86e1f76cc15dc3e9895c21" + integrity sha512-A02bayIjU9APEPKr3HudrFHEx0WfghoSPsPopckDkW7VBqO4wizzcxr75Q9A3vNX+cwg0wCN6UitTNe6pVlRaQ== dependencies: - "@aws-sdk/client-sso" "3.621.0" + "@aws-sdk/client-sso" "3.624.0" "@aws-sdk/token-providers" "3.614.0" "@aws-sdk/types" "3.609.0" "@smithy/property-provider" "^3.1.3" @@ -418,20 +418,20 @@ tslib "^2.6.2" "@aws-sdk/credential-providers@^3.583.0": - version "3.621.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-providers/-/credential-providers-3.621.0.tgz#ee0117a9ab37c56a80544862498e5d9667753dfa" - integrity sha512-FQbC7I8ae/72ZekLBa45jWJ+Q3d+YPhc3bW/rCks6RrldM6RgLTGr8pTOPCxHl828ky10RjkBiBmVU818rliyw== - dependencies: - "@aws-sdk/client-cognito-identity" "3.621.0" - "@aws-sdk/client-sso" "3.621.0" - "@aws-sdk/client-sts" "3.621.0" - "@aws-sdk/credential-provider-cognito-identity" "3.621.0" + version "3.624.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-providers/-/credential-providers-3.624.0.tgz#d6e23e3a535ae74c6a7138e693aa002c42680d7f" + integrity sha512-SX+F5x/w8laQkhXLd1oww2lTuBDJSxzXWyxuOi25a9s4bMDs0V/wOj885Vr6h8QEGi3F8jZ8aWLwpsm2yuk9BA== + dependencies: + "@aws-sdk/client-cognito-identity" "3.624.0" + "@aws-sdk/client-sso" "3.624.0" + "@aws-sdk/client-sts" "3.624.0" + "@aws-sdk/credential-provider-cognito-identity" "3.624.0" "@aws-sdk/credential-provider-env" "3.620.1" - "@aws-sdk/credential-provider-http" "3.621.0" - "@aws-sdk/credential-provider-ini" "3.621.0" - "@aws-sdk/credential-provider-node" "3.621.0" + "@aws-sdk/credential-provider-http" "3.622.0" + "@aws-sdk/credential-provider-ini" "3.624.0" + "@aws-sdk/credential-provider-node" "3.624.0" "@aws-sdk/credential-provider-process" "3.620.1" - "@aws-sdk/credential-provider-sso" "3.621.0" + "@aws-sdk/credential-provider-sso" "3.624.0" "@aws-sdk/credential-provider-web-identity" "3.621.0" "@aws-sdk/types" "3.609.0" "@smithy/credential-provider-imds" "^3.2.0" @@ -1116,16 +1116,16 @@ "@smithy/util-middleware" "^3.0.3" tslib "^2.6.2" -"@smithy/core@^2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@smithy/core/-/core-2.3.1.tgz#99cb8eda23009fd7df736c82072dafcf4eb4ff5d" - integrity sha512-BC7VMXx/1BCmRPCVzzn4HGWAtsrb7/0758EtwOGFJQrlSwJBEjCcDLNZLFoL/68JexYa2s+KmgL/UfmXdG6v1w== +"@smithy/core@^2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@smithy/core/-/core-2.3.2.tgz#4a1e3da41d2a3a494cbc6bd1fc6eeb26b2e27184" + integrity sha512-in5wwt6chDBcUv1Lw1+QzZxN9fBffi+qOixfb65yK4sDuKG7zAUO9HAFqmVzsZM3N+3tTyvZjtnDXePpvp007Q== dependencies: "@smithy/middleware-endpoint" "^3.1.0" - "@smithy/middleware-retry" "^3.0.13" + "@smithy/middleware-retry" "^3.0.14" "@smithy/middleware-serde" "^3.0.3" "@smithy/protocol-http" "^4.1.0" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/util-middleware" "^3.0.3" tslib "^2.6.2" @@ -1223,15 +1223,15 @@ "@smithy/util-middleware" "^3.0.3" tslib "^2.6.2" -"@smithy/middleware-retry@^3.0.13": - version "3.0.13" - resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-3.0.13.tgz#3bdd662aff01f360fcbaa166500bbc575dc9d1d0" - integrity sha512-zvCLfaRYCaUmjbF2yxShGZdolSHft7NNCTA28HVN9hKcEbOH+g5irr1X9s+in8EpambclGnevZY4A3lYpvDCFw== +"@smithy/middleware-retry@^3.0.14": + version "3.0.14" + resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-3.0.14.tgz#739e8bac6e465e0cda26446999db614418e79da3" + integrity sha512-7ZaWZJOjUxa5hgmuMspyt8v/zVsh0GXYuF7OvCmdcbVa/xbnKQoYC+uYKunAqRGTkxjOyuOCw9rmFUFOqqC0eQ== dependencies: "@smithy/node-config-provider" "^3.1.4" "@smithy/protocol-http" "^4.1.0" "@smithy/service-error-classification" "^3.0.3" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" "@smithy/util-middleware" "^3.0.3" "@smithy/util-retry" "^3.0.3" @@ -1359,10 +1359,10 @@ "@smithy/util-utf8" "^3.0.0" tslib "^2.6.2" -"@smithy/smithy-client@^3.1.11": - version "3.1.11" - resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-3.1.11.tgz#f12a7a0acaa7db3ead488ddf12ef4681daec11a7" - integrity sha512-l0BpyYkciNyMaS+PnFFz4aO5sBcXvGLoJd7mX9xrMBIm2nIQBVvYgp2ZpPDMzwjKCavsXu06iuCm0F6ZJZc6yQ== +"@smithy/smithy-client@^3.1.12": + version "3.1.12" + resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-3.1.12.tgz#fb6386816ff8a5c50eab7503d4ee3ba2e4ebac63" + integrity sha512-wtm8JtsycthkHy1YA4zjIh2thJgIQ9vGkoR639DBx5lLlLNU0v4GARpQZkr2WjXue74nZ7MiTSWfVrLkyD8RkA== dependencies: "@smithy/middleware-endpoint" "^3.1.0" "@smithy/middleware-stack" "^3.0.3" @@ -1448,27 +1448,27 @@ dependencies: tslib "^2.6.2" -"@smithy/util-defaults-mode-browser@^3.0.13": - version "3.0.13" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.13.tgz#f574bbb89d60f5dcc443f106087d317b370634d0" - integrity sha512-ZIRSUsnnMRStOP6OKtW+gCSiVFkwnfQF2xtf32QKAbHR6ACjhbAybDvry+3L5qQYdh3H6+7yD/AiUE45n8mTTw== +"@smithy/util-defaults-mode-browser@^3.0.14": + version "3.0.14" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.14.tgz#21f3ebcb07b9d6ae1274b9d655c38bdac59e5c06" + integrity sha512-0iwTgKKmAIf+vFLV8fji21Jb2px11ktKVxbX6LIDPAUJyWQqGqBVfwba7xwa1f2FZUoolYQgLvxQEpJycXuQ5w== dependencies: "@smithy/property-provider" "^3.1.3" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" bowser "^2.11.0" tslib "^2.6.2" -"@smithy/util-defaults-mode-node@^3.0.13": - version "3.0.13" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.13.tgz#cdd3a08bb5af4d17c2b0a951af9936ce7f3bae93" - integrity sha512-voUa8TFJGfD+U12tlNNLCDlXibt9vRdNzRX45Onk/WxZe7TS+hTOZouEZRa7oARGicdgeXvt1A0W45qLGYdy+g== +"@smithy/util-defaults-mode-node@^3.0.14": + version "3.0.14" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.14.tgz#6bb9e837282e84bbf5093dbcd120fcd296593f7a" + integrity sha512-e9uQarJKfXApkTMMruIdxHprhcXivH1flYCe8JRDTzkkLx8dA3V5J8GZlST9yfDiRWkJpZJlUXGN9Rc9Ade3OQ== dependencies: "@smithy/config-resolver" "^3.0.5" "@smithy/credential-provider-imds" "^3.2.0" "@smithy/node-config-provider" "^3.1.4" "@smithy/property-provider" "^3.1.3" - "@smithy/smithy-client" "^3.1.11" + "@smithy/smithy-client" "^3.1.12" "@smithy/types" "^3.3.0" tslib "^2.6.2" @@ -1696,11 +1696,11 @@ form-data "^4.0.0" "@types/node@*": - version "22.0.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.0.2.tgz#9fb1a2b31970871e8bf696f0e8a40d2e6d2bd04e" - integrity sha512-yPL6DyFwY5PiMVEwymNeqUTKsDczQBJ/5T7W/46RwLU/VH+AA8aT5TZkvBviLKLbbm0hlfftEkGrNzfRk/fofQ== + version "22.1.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.1.0.tgz#6d6adc648b5e03f0e83c78dc788c2b037d0ad94b" + integrity sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw== dependencies: - undici-types "~6.11.1" + undici-types "~6.13.0" "@types/node@17.0.33": version "17.0.33" @@ -1741,9 +1741,9 @@ integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== "@types/yargs@^17.0.8": - version "17.0.32" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" - integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== dependencies: "@types/yargs-parser" "*" @@ -2091,13 +2091,13 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.21.10, browserslist@^4.23.1: - version "4.23.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.2.tgz#244fe803641f1c19c28c48c4b6ec9736eb3d32ed" - integrity sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA== + version "4.23.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" + integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== dependencies: - caniuse-lite "^1.0.30001640" - electron-to-chromium "^1.4.820" - node-releases "^2.0.14" + caniuse-lite "^1.0.30001646" + electron-to-chromium "^1.5.4" + node-releases "^2.0.18" update-browserslist-db "^1.1.0" bs-logger@0.x: @@ -2153,10 +2153,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001640: - version "1.0.30001646" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001646.tgz#d472f2882259ba032dd73ee069ff01bfd059b25d" - integrity sha512-dRg00gudiBDDTmUhClSdv3hqRfpbOnU28IpI1T6PBTLWa+kOj0681C8uML3PifYfREuBrVjDGhL3adYpBT6spw== +caniuse-lite@^1.0.30001646: + version "1.0.30001651" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" + integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== chalk@^2.4.2: version "2.4.2" @@ -2368,10 +2368,10 @@ ejs@^3.1.10: dependencies: jake "^10.8.5" -electron-to-chromium@^1.4.820: - version "1.5.4" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.4.tgz#cd477c830dd6fca41fbd5465c1ff6ce08ac22343" - integrity sha512-orzA81VqLyIGUEA77YkVA1D+N+nNfl2isJVjjmOyrlxuooZ19ynb+dOlaDTqd/idKRS9lDCSBmtzM+kyCsMnkA== +electron-to-chromium@^1.5.4: + version "1.5.5" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.5.tgz#03bfdf422bdd2c05ee2657efedde21264a1a566b" + integrity sha512-QR7/A7ZkMS8tZuoftC/jfqNkZLQO779SSW3YuZHP4eXpj3EffGLFcB/Xu9AAZQzLccTiCV+EmUo3ha4mQ9wnlA== emittery@^0.13.1: version "0.13.1" @@ -3458,7 +3458,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.14: +node-releases@^2.0.18: version "2.0.18" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== @@ -3931,9 +3931,9 @@ terser-webpack-plugin@^5.3.10: terser "^5.26.0" terser@^5.26.0: - version "5.31.3" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.3.tgz#b24b7beb46062f4653f049eea4f0cd165d0f0c38" - integrity sha512-pAfYn3NIZLyZpa83ZKigvj6Rn9c/vd5KfYGX7cN1mnzqgDcxWvrU5ZtAfIKhEXz9nRecw4z3LXkjaq96/qZqAA== + version "5.31.5" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.5.tgz#e48b7c65f32d2808e7dad803e4586a0bc3829b87" + integrity sha512-YPmas0L0rE1UyLL/llTWA0SiDOqIcAQYLeUj7cJYzXHlRTAnMSg9pPe4VJ5PlKvTrPQsdVFuiRiwyeNlYgwh2Q== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -4039,10 +4039,10 @@ typescript@4.6.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== -undici-types@~6.11.1: - version "6.11.1" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.11.1.tgz#432ea6e8efd54a48569705a699e62d8f4981b197" - integrity sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ== +undici-types@~6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.13.0.tgz#e3e79220ab8c81ed1496b5812471afd7cf075ea5" + integrity sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg== universalify@^0.2.0: version "0.2.0"