diff --git a/jest.config.mjs b/jest.config.mjs new file mode 100644 index 00000000..c7248211 --- /dev/null +++ b/jest.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('jest').Config} */ +export default { + preset: "ts-jest", + testEnvironment: "node", + moduleNameMapper: { + "(.+)\.js$": "$1", + }, +}; diff --git a/package.json b/package.json index b6f73089..5988c406 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,46 @@ { "name": "cohere-ai", - "version": "7.17.1", + "version": "7.18.0", "private": false, "repository": "https://github.com/cohere-ai/cohere-typescript", - "main": "./index.js", - "types": "./index.d.ts", + "type": "commonjs", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.mjs", + "types": "./dist/cjs/index.d.ts", + "exports": { + ".": { + "types": "./dist/cjs/index.d.ts", + "import": { + "types": "./dist/esm/index.d.mts", + "default": "./dist/esm/index.mjs" + }, + "require": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + }, + "default": "./dist/cjs/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist", + "reference.md" + ], "scripts": { "format": "prettier . --write --ignore-unknown", - "build": "tsc", - "prepack": "cp -rv dist/. .", + "build": "yarn build:cjs && yarn build:esm", + "build:cjs": "tsc --project ./tsconfig.cjs.json", + "build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm", "test": "jest" }, "dependencies": { "url-join": "4.0.1", "form-data": "^4.0.0", "formdata-node": "^6.0.3", - "node-fetch": "2.7.0", - "qs": "6.11.2", + "node-fetch": "^2.7.0", + "qs": "^6.13.1", "readable-stream": "^4.5.2", - "js-base64": "3.7.2", + "js-base64": "3.7.7", "form-data-encoder": "^4.0.2", "@aws-sdk/client-sagemaker": "^3.583.0", "@aws-sdk/credential-providers": "^3.583.0", @@ -28,23 +50,24 @@ }, "devDependencies": { "@types/url-join": "4.0.1", - "@types/qs": "6.9.8", - "@types/node-fetch": "2.6.9", + "@types/qs": "^6.9.17", + "@types/node-fetch": "^2.6.12", "@types/readable-stream": "^4.0.14", "webpack": "^5.91.0", "ts-loader": "^9.5.1", "jest": "^29.7.0", - "@types/jest": "29.5.5", + "@types/jest": "^29.5.14", "ts-jest": "^29.1.2", - "jest-environment-jsdom": "29.7.0", - "@types/node": "17.0.33", - "prettier": "2.7.1", - "typescript": "4.6.4", + "jest-environment-jsdom": "^29.7.0", + "@types/node": "^18.19.70", + "prettier": "^3.4.2", + "typescript": "~5.7.2", "@types/convict": "^6.1.6" }, "browser": { "fs": false, "os": false, "path": false - } + }, + "packageManager": "yarn@1.22.22" } diff --git a/reference.md b/reference.md index 26969785..1f3e87cf 100644 --- a/reference.md +++ b/reference.md @@ -90,12 +90,11 @@ Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) ```typescript const response = await client.v2.chatStream({ - model: "model", + model: "command-r", messages: [ { - role: "tool", - toolCallId: "messages", - content: "messages", + role: "user", + content: "Hello!", }, ], }); @@ -167,12 +166,11 @@ Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) ```typescript await client.v2.chat({ - model: "model", + model: "command-a-03-2025", messages: [ { - role: "tool", - toolCallId: "messages", - content: "messages", + role: "user", + content: "Tell me about LLMs", }, ], }); @@ -243,9 +241,10 @@ If you want to learn more how to use the embedding model, have a look at the [Se ```typescript await client.v2.embed({ - model: "model", - inputType: "search_document", - embeddingTypes: ["float"], + texts: ["hello", "goodbye"], + model: "embed-v4.0", + input_type: "classification", + embedding_types: ["float"], }); ``` @@ -310,9 +309,16 @@ This endpoint takes in a query and a list of texts and produces an ordered array ```typescript await client.v2.rerank({ - model: "model", - query: "query", - documents: ["documents"], + documents: [ + "Carson City is the capital city of the American state of Nevada.", + "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", + "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", + "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", + "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.", + ], + query: "What is the capital of the United States?", + top_n: 3, + model: "rerank-v3.5", }); ``` @@ -435,8 +441,8 @@ This API launches an async Embed job for a [Dataset](https://docs.cohere.com/doc ```typescript await client.embedJobs.create({ model: "model", - datasetId: "dataset_id", - inputType: "search_document", + dataset_id: "dataset_id", + input_type: "search_document", }); ``` @@ -663,7 +669,7 @@ await client.datasets.list(); -
client.datasets.create(data, evalData, { ...params }) -> Cohere.DatasetsCreateResponse +
client.datasets.create({ ...params }) -> Cohere.DatasetsCreateResponse
@@ -691,7 +697,8 @@ Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohe
```typescript -await client.datasets.create(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), { +await client.datasets.create({ + data: fs.createReadStream("/path/to/your/file"), name: "name", type: "embed-input", }); @@ -710,22 +717,6 @@ await client.datasets.create(fs.createReadStream("/path/to/your/file"), fs.creat
-**data:** `File | fs.ReadStream | Blob` - -
-
- -
-
- -**evalData:** `File | fs.ReadStream | Blob | undefined` - -
-
- -
-
- **request:** `Cohere.DatasetsCreateRequest`
@@ -1519,10 +1510,10 @@ await client.finetuning.listFinetunedModels(); await client.finetuning.createFinetunedModel({ name: "api-test", settings: { - baseModel: { - baseType: "BASE_TYPE_CHAT", + base_model: { + base_type: "BASE_TYPE_CHAT", }, - datasetId: "my-dataset-id", + dataset_id: "my-dataset-id", }, }); ``` @@ -1671,10 +1662,10 @@ await client.finetuning.deleteFinetunedModel("id"); await client.finetuning.updateFinetunedModel("id", { name: "name", settings: { - baseModel: { - baseType: "BASE_TYPE_UNSPECIFIED", + base_model: { + base_type: "BASE_TYPE_UNSPECIFIED", }, - datasetId: "dataset_id", + dataset_id: "dataset_id", }, }); ``` diff --git a/scripts/rename-to-esm-files.js b/scripts/rename-to-esm-files.js new file mode 100644 index 00000000..81dac6a7 --- /dev/null +++ b/scripts/rename-to-esm-files.js @@ -0,0 +1,115 @@ +#!/usr/bin/env node + +const fs = require("fs").promises; +const path = require("path"); + +const extensionMap = { + ".js": ".mjs", + ".d.ts": ".d.mts", +}; +const oldExtensions = Object.keys(extensionMap); + +async function findFiles(rootPath) { + const files = []; + + async function scan(directory) { + const entries = await fs.readdir(directory, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(directory, entry.name); + + if (entry.isDirectory()) { + if (entry.name !== "node_modules" && !entry.name.startsWith(".")) { + await scan(fullPath); + } + } else if (entry.isFile()) { + if (oldExtensions.some((ext) => entry.name.endsWith(ext))) { + files.push(fullPath); + } + } + } + } + + await scan(rootPath); + return files; +} + +async function updateFiles(files) { + const updatedFiles = []; + for (const file of files) { + const updated = await updateFileContents(file); + updatedFiles.push(updated); + } + + console.log(`Updated imports in ${updatedFiles.length} files.`); +} + +async function updateFileContents(file) { + const content = await fs.readFile(file, "utf8"); + + let newContent = content; + // Update each extension type defined in the map + for (const [oldExt, newExt] of Object.entries(extensionMap)) { + const regex = new RegExp(`(import|export)(.+from\\s+['"])(\\.\\.?\\/[^'"]+)(\\${oldExt})(['"])`, "g"); + newContent = newContent.replace(regex, `$1$2$3${newExt}$5`); + } + + if (content !== newContent) { + await fs.writeFile(file, newContent, "utf8"); + return true; + } + return false; +} + +async function renameFiles(files) { + let counter = 0; + for (const file of files) { + const ext = oldExtensions.find((ext) => file.endsWith(ext)); + const newExt = extensionMap[ext]; + + if (newExt) { + const newPath = file.slice(0, -ext.length) + newExt; + await fs.rename(file, newPath); + counter++; + } + } + + console.log(`Renamed ${counter} files.`); +} + +async function main() { + try { + const targetDir = process.argv[2]; + if (!targetDir) { + console.error("Please provide a target directory"); + process.exit(1); + } + + const targetPath = path.resolve(targetDir); + const targetStats = await fs.stat(targetPath); + + if (!targetStats.isDirectory()) { + console.error("The provided path is not a directory"); + process.exit(1); + } + + console.log(`Scanning directory: ${targetDir}`); + + const files = await findFiles(targetDir); + + if (files.length === 0) { + console.log("No matching files found."); + process.exit(0); + } + + console.log(`Found ${files.length} files.`); + await updateFiles(files); + await renameFiles(files); + console.log("\nDone!"); + } catch (error) { + console.error("An error occurred:", error.message); + process.exit(1); + } +} + +main(); diff --git a/src/Client.ts b/src/Client.ts index 7584905d..a58c8c7a 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -2,30 +2,31 @@ * 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 "./api/index"; -import * as serializers from "./serialization/index"; +import * as environments from "./environments.js"; +import * as core from "./core/index.js"; +import * as Cohere from "./api/index.js"; import urlJoin from "url-join"; import * as stream from "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"; -import { Models } from "./api/resources/models/client/Client"; -import { Finetuning } from "./api/resources/finetuning/client/Client"; +import * as errors from "./errors/index.js"; +import { V2 } from "./api/resources/v2/client/Client.js"; +import { EmbedJobs } from "./api/resources/embedJobs/client/Client.js"; +import { Datasets } from "./api/resources/datasets/client/Client.js"; +import { Connectors } from "./api/resources/connectors/client/Client.js"; +import { Models } from "./api/resources/models/client/Client.js"; +import { Finetuning } from "./api/resources/finetuning/client/Client.js"; export declare namespace CohereClient { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -78,15 +79,24 @@ export class CohereClient { * * To learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api). */ - public async chatStream( + public chatStream( request: Cohere.ChatStreamRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise> { - const { accepts, ..._body } = request; + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise> { + return core.HttpResponsePromise.fromPromise(this.__chatStream(request, requestOptions)); + } + + private async __chatStream( + request: Cohere.ChatStreamRequest, + requestOptions?: CohereClient.RequestOptions, + ): Promise>> { + const { Accepts: accepts, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/chat" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/chat", ), method: "POST", headers: { @@ -97,8 +107,8 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, Accepts: accepts != null ? accepts : undefined, @@ -106,69 +116,58 @@ export class CohereClient { }, contentType: "application/json", requestType: "json", - body: { - ...serializers.ChatStreamRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: true, - }, + body: { ..._body, 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.StreamedChatResponse.parseOrThrow(data, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - }, - signal: requestOptions?.abortSignal, - eventShape: { - type: "json", - messageTerminator: "\n", - }, - }); + return { + data: new core.Stream({ + stream: _response.body, + parse: (data) => data as any, + signal: requestOptions?.abortSignal, + eventShape: { + type: "json", + messageTerminator: "\n", + }, + }), + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -178,12 +177,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -210,25 +211,81 @@ export class CohereClient { * * @example * await client.chat({ - * message: "Can you give me a global market overview of solar panels?", - * chatHistory: [{ - * role: "TOOL" + * chat_history: [{ + * role: "USER", + * message: "Who discovered gravity?" * }, { - * role: "TOOL" + * role: "CHATBOT", + * message: "The man who is widely credited with discovering gravity is Sir Isaac Newton" * }], - * promptTruncation: "OFF", - * temperature: 0.3 + * message: "What year was he born?", + * connectors: [{ + * id: "web-search" + * }] + * }) + * + * @example + * await client.chat({ + * message: "Who is more popular: Nsync or Backstreet Boys?", + * documents: [{ + * "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak." + * }, { + * "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold." + * }, { + * "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers." + * }, { + * "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures." + * }] + * }) + * + * @example + * await client.chat({ + * message: "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?", + * tools: [{ + * name: "query_daily_sales_report", + * description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.", + * parameter_definitions: { + * "day": { + * description: "Retrieves sales data for this day, formatted as YYYY-MM-DD.", + * type: "str", + * required: true + * } + * } + * }, { + * name: "query_product_catalog", + * description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", + * parameter_definitions: { + * "category": { + * description: "Retrieves product information data for all products in this category.", + * type: "str", + * required: true + * } + * } + * }] * }) */ - public async chat( + public chat( + request: Cohere.ChatRequest, + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__chat(request, requestOptions)); + } + + private async __chat( request: Cohere.ChatRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { - const { accepts, ..._body } = request; + requestOptions?: CohereClient.RequestOptions, + ): Promise> { + const { Accepts: accepts, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/chat" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/chat", ), method: "POST", headers: { @@ -239,8 +296,8 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, Accepts: accepts != null ? accepts : undefined, @@ -248,58 +305,46 @@ export class CohereClient { }, contentType: "application/json", requestType: "json", - body: { - ...serializers.ChatRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: false, - }, + body: { ..._body, stream: false }, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.NonStreamedChatResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.NonStreamedChatResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -309,12 +354,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -325,14 +372,23 @@ export class CohereClient { * * Generates realistic text conditioned on a given input. */ - public async generateStream( + public generateStream( request: Cohere.GenerateStreamRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise> { + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise> { + return core.HttpResponsePromise.fromPromise(this.__generateStream(request, requestOptions)); + } + + private async __generateStream( + request: Cohere.GenerateStreamRequest, + requestOptions?: CohereClient.RequestOptions, + ): Promise>> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/generate" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/generate", ), method: "POST", headers: { @@ -343,77 +399,66 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: { - ...serializers.GenerateStreamRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: true, - }, + body: { ...request, 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.GenerateStreamedResponse.parseOrThrow(data, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - }, - signal: requestOptions?.abortSignal, - eventShape: { - type: "json", - messageTerminator: "\n", - }, - }); + return { + data: new core.Stream({ + stream: _response.body, + parse: (data) => data as any, + signal: requestOptions?.abortSignal, + eventShape: { + type: "json", + messageTerminator: "\n", + }, + }), + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -423,12 +468,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -460,14 +507,23 @@ export class CohereClient { * prompt: "Please explain to me how LLMs work" * }) */ - public async generate( + public generate( + request: Cohere.GenerateRequest, + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__generate(request, requestOptions)); + } + + private async __generate( request: Cohere.GenerateRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/generate" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/generate", ), method: "POST", headers: { @@ -478,66 +534,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: { - ...serializers.GenerateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: false, - }, + body: { ...request, stream: false }, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.Generation.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.Generation, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -547,12 +591,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -581,16 +627,37 @@ export class CohereClient { * @throws {@link Cohere.GatewayTimeoutError} * * @example - * await client.embed() + * await client.embed({ + * texts: ["hello", "goodbye"], + * model: "embed-v4.0", + * input_type: "classification" + * }) + * + * @example + * await client.embed({ + * model: "embed-v4.0", + * input_type: "image", + * embedding_types: ["float"], + * images: ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gAfQ29tcHJlc3NlZCBieSBqcGVnLXJlY29tcHJlc3P/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIAZABkAMBIgACEQEDEQH/xAAdAAEAAQQDAQAAAAAAAAAAAAAABwEFBggCAwQJ/9oACAEBAAAAAN/gAAAAAAAAAAAAAAAAAAAAAAAAAAHTg9j6agAAp23/ADjsAAAPFrlAUYeagAAArdZ12uzcAAKax6jWUAAAAO/bna+oAC1aBxAAAAAAbM7rVABYvnRgYAAAAAbwbIABw+cMYAAAAAAvH1CuwA091RAAAAAAbpbPAGJfMXzAAAAAAJk+hdQGlmsQAAAAABk31JqBx+V1iAAAAAALp9W6gRp826AAAAAAGS/UqoGuGjwAAAAAAl76I1A1K1EAAAAAAG5G1ADUHU0AAAAAAu/1Cu4DVbTgAAAAAA3n2JAIG0IAAAAAArt3toAMV+XfEAAAAAL1uzPlQBT5qR2AAAAAenZDbm/AAa06SgAAAAerYra/LQADp+YmIAAAAC77J7Q5KAACIPnjwAAAAzbZzY24gAAGq+m4AAA7Zo2cmaoAAANWdOOAAAMl2N2TysAAAApEOj2HgAOyYtl5w5jw4zZPJyuGQ5H2AAAdes+suDUAVyfYbZTLajG8HxjgD153n3IAABH8QxxiVo4XPKpGlyTKjowvCbUAF4mD3AAACgqCzYPiPQAA900XAACmN4favRk+a9wB0xdiNAAAvU1cgAxeDcUoPdL0s1B44atQAACSs8AEewD0gM72I5jjDFiAAAPfO1QGL6z9IAlGdRgkaAAABMmRANZsSADls7k6kFW8AAAJIz4DHtW6AAk+d1jhUAAAGdyWBFcGgAX/AGnYZFgAAAM4k4CF4hAA9u3FcKi4AAAEiSEBCsRgAe3biuGxWAAACXsoAiKFgALttgs0J0AAAHpnvkBhOt4AGebE1pBtsAAAGeySA4an2wAGwEjGFxaAAAe+c+wAjKBgAyfZ3kUh3HAAAO6Yb+AKQLGgBctmb2HXDNjAAD1yzkQAENRF1gyvYG9AcI2wjgAByyuSveAAWWMcQtnoyOQs8qAPFhVh8HADt999y65gAAKKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAEFBgIEA//aAAgBAhAAAAAAAAAAAAABEAAJkBEAAB0CIAABMhyAAA6EQAAA6EQAABMiIAAAmREAAAmQiAABMgOQAEyAHIATIACIBMu7H3fT419eACEnps7DoPFQch889Wd3V2TeWIBV0o+eF8I0OrXVoAIyvBm8uDe2Wp6ADO+Mw9WDV6rSgAzvjMNWA1Op1AARlvmZbOA3NnpfSAK6iHnwfnFttZ9Wh7AeXPcB5cxWd3Wk7Pvb+uR8q+rgAAAAAAAAP//EABsBAQABBQEAAAAAAAAAAAAAAAAEAQIDBQYH/9oACAEDEAAAAAAAAAC20AL6gCNDxAArnn3gpro4AAv2l4QIgAAJWwGLVAAAX7cQYYAAFdyNZgAAAy7UazAAABsZI18UAAE6YEfWgACRNygavCACsmZkALNZjAMkqVcAC2FFoKyJWe+fMyYoMAAUw2L8t0jYzqhE0dAzd70eHj+PK7mcAa7UDN7VvBwXmDb7EAU5uw9C9KCnh2n6WoAaKIey9ODy/jN+ADRRD2fpQeY8P0QAU5zGel+gg8V53oc4AgaYTfcJ45Tx5I31wCPobQ2PpPRYuP8APMZm2kqoxQddQAAAAAAAAP/EAFMQAAEDAgIDCQkMBwUIAwAAAAECAwQFEQAGBzFREhMhMEBBYXGBCBQYIjJCRlDSFSBSVGJygpGTobHREDRDc6LBwiMzU3CyFiQlNVVkdISSlLP/2gAIAQEAAT8A/wAo74nVaBAb32bNYitfDfcS2PrURiZpU0dwVFMjN1OVY8O8u7//APkFYc076LmfSVSvmQpB/ox4QGjH/r7v/wBGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0Y89fd7IMj2cN6e9GDpCTmRaOuFI9nEDSlo9qakpj5upoJNgH3d4+50JxGlxpbSH4r7bzSvJW0sLSeop5NWsw0fL8RU2rVGPDjJ4C6+4EAnYnaegYzV3StDhFcfK1LdqDuoSZBLDHWlPlqxXtNmkOulaVVxcFg3/sYA73A+kLrxKnTJrpfmSXX3jrcdWVqPWVYudvJ7nbil16s0R7vikVSVDduCVR3lNk9e5IvjKfdG5rpKmo+Yo7NXi8ALlgxJH0kiysZL0l5Uzsz/AMFn2l7m7kJ8BuSj6PnAbU8ieeZitOPPuoQ22krWtZCUpSkXJJOoDGkHui4MBT1MyW2ibITdJnuA97o/dJ1uHFczFXMyzV1Gu1N+bJV57yr7kbEjUkdA5dGlSYb7UqJIcZfaUFtuNLKFoUNRSocIONF3dBb6tih58eSCQEM1PUOqT7eELS4lK0KCkkAgg3BB4/M2Z6NlKlSKtWJiI8VoWueFS1nUhA85ZxpJ0v13Pj7kNorg0NC7tw0K4XNi3yPKPRqHqLQnpkeoD8XKmZZJVSHCG4klw/qijqQs/wCF/pwDfjc1ZqpOUKNLrVXf3qMyLJSLFbrh8ltA51qxn7P9az9V1z6istxWypMSIhRLbCD+Kj5yvUYJHCMdz7pLXWoByfWJBXUILV4bizwvRk+Z0qa4yoTodKgyZ859DEWO0t11xZslCEC5UrGlHSNOz/XVvBa26RFKkQY+xHO4v5a/UtArU3LlZptbpzm4lQ30ut7DbWk9ChwHGXq5EzHQ6ZWoCv8AdpsdDyRrIKtaFdKTwHi+6I0hrffGRKU/ZloodqSkngW5rQz1I1n1P3M2ZzJpFYyvIXdUJ0SowP8AhP8AAtI6AvitIWbWclZVqlbWElxpvcRmz+0kOcDaf5nEyXJnypM2Y8p2Q+6t11xRupa1m6lHpJ9T6B6uaVpHo7alEMz0PQnepxN0/wASRgauJ7pTNZmVynZTjuXZpzYkSRtkPDgB6UI9UZMlrgZsy1MQqxZqkRy/QHRfA4iZIaiRX5D6ghpptTi1bEIFycZmrL2YcwVitvk7ubLdfsfNClcCewcHqiiX91qbbX3yz/rGBxGmKse4ujnMz6F2dfjiGj/2VBs/ccE3J9UZOirm5ry3EQm5eqkRu3Qp0YHEd01PLGUqPT0mxk1QLV0oZaPteqdBtKNV0kUIkXah77Md6mkcH8RGBq4jupH7JyXG/wDPcP1tj1T3MuWVMQK5mt9FjJWmDGO1tHjuHqJ4nupEnvrJa+beZ4/jR6ooNGnZhrFOotNa3yXMeS02OvWo9CRwk4ytQIeWKDS6HC/V4TCWgq1itWtSz0rPCeJ7qKNenZSl2/upEtonpcShXqcC+NA+jFeW4H+1NbYKatOaswysWMaOrbscc4rujaYZuj/vzccMCpR3yehwFn+r1MAVGwGNDOhVbK4ubc4xLLFnYMB1PCNjrw/BHF58opzDk7MlHSndOSID28ja6gbtH3jChZRHqShZerOZag1S6JT3pcpzUhsahtUTwJTtJxow0G0vKRYreYS1PrIAUhNrx4yvkA+WsfCONXFnGlTLZytnqvU5KLRlvmTG2Fl/xwB0J1eookOXPkNRYUZ1991W5baaQVrWdiUi5JxkbudKzVCzOzg+abE196NWXKWOnWlvGW8p0DKMEU6g01qKzwFe5F1uEDynFnhUeO7pTJ5n0aBmyK3d+mneJVtZjOnxVfQX6ghwZtRktQ4EV6RJcNkNMoK1qOwJTcnGTe5yr9V3qXmuSKXFNj3uizkpY/0oxlbIOVslRt6oVKaZdIst9XjyHPnOK4ezkFVgw6vAmU2ewHYsllbDiFaloWNyoYz1lKZknMtRoEu6gyvdMO8zrC/IXy2j0Cs5glpg0WmyJkk+YwgrIG1WwdJxk7uap75amZyqQit6zChkLe6lueSnGWcl5ayjGEegUliKCAFuAbp5z57irqPI9NOjVOdqB31T2x7tU5KlxNryNa2CenWnDra2XFtOoUhaFFKkqFiCOAgg8qyro7zdnJwCh0Z5xi9lSVje46etarA22DGUe5spEPe5ebqgue78Ui3aj9Sl+WvFIodHoMREGj02PDjJ1NMNhAJ2m2s8m07aIHJi5WdMsxSZFiuoxG08LoGt9sDz/hjGrkzLD0hxDLDSluLISlKQSpRPMAMZU0C54zFvcidHTR4Sv2k24dI+SyPG+u2MqaBskZc3qRLimrzEftZoBaB+S0PFw0y2y2hppCUIQAEpSAAAOYAauU6XtBJmuycy5LjASVXcl05sWDu1bGxe1GHWnGXFtOoUhxCilSVAghSTYgg6iOR5eyfmXNT/AHvQKNJmKBspTaLNo+es2SntOMq9zNIc3uTm+sBoazEgWWvtdWLDGWchZTyk2E0KiR4zlrKkEbt9XW4u6uW6SNDNAzwHZ7BTTq3YkSm0XS7sS+ka/na8ZuyJmbJMwxK9T1NJJs1IR47D3S2vj2mXXlobabUtaiAlKRcknUAMZV0F56zJvT8iEKVCVY77PuhZHyWvLxlTuesl0Te3qqlysy08JMnxI4PQ0n+onEWDFhMNxokdphhsWQ20gIQkbEpFgPeyqnBg/rMhCCBfc3ur6hw4lZ1hNbpMdlbpGokhKT+OHs7zVf3EdpHzgVfzGDnGqnnbHUkYGcqqOZo/OT+VsMZ5eBG/w0K2lJKPaxDzfTJBCXFLZUTbxk3+q2GJTEhAcYdQtB1KSoEckqdLp1ThvQqnEZkxXU7lbLyAtCusKxnPubKVNU9NyhOMB03Pekm7kfsXwqRjM+jfOWUVLNZochEcapLY31gj56LgduLHZxNjjL+TM0ZpcDdCokuWL2LiEWaSflOKskYyt3M8t0tSM31hLCNZiwbLc7XVCwxljR9lHKDaRQ6Kww6BZUlQ32Qr6a7nAAHvFLSkEqUAAMT81UyGClDm/r2N6u1WKhm2oywpDKt4bPMjX/8ALC3HHCVLWSSbm+338adLhuB2O+tChzg4pOdOFDVRRbm31A/EflhiQ1IbS6y4laFaik3HJCkKBBAII4RjMOibIOYCtc/LkZD6tb0W8Zy+0luwVisdzDRX925RMyS4uxMtlD46gUFGKj3NWdY11wajSpbf71bS/qUnErQTpPjXIy2Xk7WZLCv68L0R6R2/KylO+ikK/A4Tom0jL1ZRqHa3bEXQjpPlkBGVXkDa48yj8V4p/c358lEGW/TIaOcOSCtfYG0qxSO5gp6AldczQ+9tbhsBr+NwqxRNDWjygFDjGXmpL4N99nEyVH6K/FGGmGY7SGm20oQgAJSkAJAHMAPeyJ8WEjfJD6EX1XP4DWTioZ1ZRdEBndnmWvgT2DE6tVCoE98SFFPMgGyR2DBN+E8XSq3MpToUyu7ZIK0HUcUmsRapGK46wlfBuknWnk5AOsY3I2YsNmLAagPf1HMFNp+6S68FOD9mjhV+QxUM5THrohJDKNutWHpL8halvOqWo6yokk8fT58inSESI6ylST2EbDtGKRU49VitvtkJI8tOsg7OOJA1nFSzhQKaVIkT21OA23DV3Fdu51Yk6VICCREpzznS4pKPw3WDpXk34KOgD9+fZwxpWB4JNIIG1D1/xTinaSMvylJDy3YyjwDfUXH1pviFPhTGw/FkNuoOpbagofdxU2fHhMqekOBDadus4q+bJcwqahkssfxnrOFKKjckk8iodWcpUxDySS2rgcTfWMMPtvstvNKCkLSFJI5weMzFm6mZfQUvL32UQCiOg+N1q2DFbzlWa2paXHyzGOplolKbfKOtWLnb72FUp9NeD8GU4y4OdBtfr2jGW9JTbqm4tdQlCr2D6fIPzxzYadbdQhxpYUlQBBBuCD7+pVKPTIq5D6uAcCUjWpWwYqtWlVV9Tr6yE6kIHkpHJcl1cqS5TXjfc+O3f7xxedc6IoqTAgEKnqHCdYZB5ztVsGH5D0p5x+Q6px1ZKlKUbknico5zk0J5EWWtTtPWeFOstdKejaMR5TMxhuQw4lbTiQpKkm4UD7151thtbriwlCElSidQAxXaw7VZalXsyglLadg/M8mpstcKbHko1oWDbb0duGXEOtIcQbpUkKB2g8Tm3MSMv0xbySDJduhhB+FtPQMSJD0p5yRIcK3XFFSlK1kni9HealU+UijzFjvZ5X9iVHyHDzdSve5yqqm2kU5pViuynCNnMOUZVld80lgKsVNEtns4QPqPEKNgTjOdbVWq0+tC7xmCWmRzWTrV2njEqUhQUkkEG4Ixk6ue7dFjPuuXeau08Plp5+0cP6VrS22pSiAACSdgGKpMXPnSJK/PWSBsHMOzlGRX/EmsW8koWOs3B4jONTNNoNQkIUUr3ve27awpzxb4PCTxujGpKYqkinKV4klvdJ+e3+nMkjvakS1DWtIb7FcB+7BNyTyjI67S5CDzsqP1EcRpUkqRTqfFBtvr6l9iE2/nx2V5XeeYKS9/3CEdizuD+OEm4/RnVak0+OhJtd256gm38+U5JTeY+rYyofeniNKyjv8AR0c24f8AxTx1NJTUYKhrD7Z/iGEeSP0Z63Pe8Xc6hur9dxynI7JtNeOqyAO0m/EaVv1mj/Mf/FPHU7/mEL98j8cI8gfozq2pdOZWnmdseopJ5TlKIWKShZFi8tSz2eL/AC4jSsx/Y0qR8FbqD9IA8dQmFSK1S2UjypTQ7N0L4SLJ/RmOOJVIloSk+Ijdjb4nCcEWJB5PDjrlSWWGxdS1hI7TiHHRGjsso8htCUDqSLcRpDppl5ckLABXHUl8DYBwH7jx2juAZeYmXyk7iM2t07L23I/HA/QtIWkpULggjFXgqp8+RHINkrO5O0axyfJlLK3l1F1Pit3S3cecRr7BxMqM3IjusOpCkOoKVjakixGKzTXaTU5cB4HdNOEAnzk6we0cbo3o5g0hU91FnZhCh+7T5PvM6UjfWkTmE3W0LObSnmPZyanQHqjKajMjhUeE2uANpxAhNQYzTDabNtpsOk85PXxWkjLJmRk1mGjdPR0WdA85rb9HjMqUByv1Rtgg97N2W+vYjZ1qww02y2htCQlCEhKUjUAPeLQlxCkLAUlQsQdRBxmKiOUqWopSox1m6FHht0HkjDDsl1DLKCpajYAYoFFRSYw3dlSF8K1bPkji1JCgUkXBxnjJTlJecqVOZvCWbrQn9kT/AEniqVSplYmNQoTRW4s9iRzqUeYDGXaBFoFPbiMC6/KdctYrVt/Ie+qECNMjKjyE7oLHaOkYrVEkUl8hQKmVE7hY1HkUOFInPoYjtla1bMUDLzNKb3xyy5KvKXzDoTxrjaHEKQ4gKSoWIIuCDzYzTo5WlTk2ggEG6lxr6vmH+WHmXWHFtPNqQ4k2UlQIIOwg+/y/lCq19xKm2yzFv4z7g8X6I844oOXoFBiiPDb4TYuOny1kbTxEmOxKaVHebS4hXlA4rWTpEdSnqfdxu5JR5w6tuFtONKKXEFJBsQeOShSzZIvilZTnTShySCwyfhDxj1DFPpcSmtBuM0B8JR4VK6zyCr5apFaQROiJWsCwdT4qx1KGKloseG7XSp4UnmQ+LfxJxJyLmaMoj3OU4n4TakqwrLVfSbGjy/sV4ZyhmN/yKRI+kncf6rYhaM64+QZa2YyOk7tQ7E4o+jyiU0h2SgzHhzu+R2I/PCEIbASgAJAsAOLqFFp84HvphKlkCyhwK4OnZiXkcElUKV9Fz2hh/KdZataPuwfOSoEYXQqog2MJ49Taj/LHuNVPiEj7Jf5Y9xqp8QkfZL/LHuNVPiEj7Jf5Y9xqp8QkfZL/ACx7jVT4hI+yX+WPcaqfEJH2S/yx7jVT4hI+yX+WEUCquaoTw+chQ/EYYyjWHQSpgN9K1C33XOIuR0+VMlfRbH8ziFRKdTwksRkhY89XjK+/VyWwxYf5ef/EADgRAAIBAgMDCQUHBQAAAAAAAAECAwQRAAUgMUFhEhMhIjBAUXGREDJQU6EGFDNCYoGSUnKiwdH/2gAIAQIBAT8A+L37e/wE9zHfj3k90Gk90Gk9ztqPcbd3t3e3b2129qRySGyIScRZY56ZXtwGFoKZfyX8zj7rT/JX0w+X0zbFKngcTZdLHdozyx9cbOg9pbFtENJPNYqlh4nEOWxJYykufQYVFQWRQBw1VVGk4LKAJPHxwysjFWFiNUsscKGSVwqjecVOfgErSxX/AFNhs5r2P4oHkoxHndchHKZXHFf+YpM7gnISYc0/+J0KpYhVFycUtCkQDygM/huHZZjThl59R1l97iNMsqQxvLIbKoucV1dLWykkkRg9VdOUZmyOtLO10PQhO4+Hty6mCrz7jpPu+XZsoZSp2EEYkQxyOh/KSNGf1JAipVO3rNq2EHGW1P3mkikJ6w6reYxGpd0QbyBhVCqFGwC3aV4tUycbHRnLFq+UeAUfTX9nmJhqE3BwfUYoxeqi8+1ryDVPwA0ZwCMwm4hT9Nf2eB5qobcWUfTFM3Inib9Q7QkAEnYMSvzkrv4knRn8BEkVQB0Ecg+Y15RTmCij5Qsz9c/v7KWYTQo28dDefZ5hUBI+aU9Z9vAaamnSqheF9jD0OKmmlpZWilFiNh3Eacqy9quUSSLaFDc8T4YAt7KWpNPJfap94YR1kUOhuD2NTVJTr4vuGHdpHZ3NydVVSQVaciZfIjaMVOR1URJhtKvocNSVSmzU8gP9pxHQVkhASnf9xbFJkJuHq2Fv6F/2cIiRoqIoVQLADRBUSwG6Ho3g7DiLMYX6Huh9RgTwtslT1GOdi+YnqMc7F8xP5DHOxfMT+Qxz0XzE9Rh6ymTbKD5dOJsyY3WFbcThmZiWYkk7z8W//8QAOREAAgECAgYHBwMDBQAAAAAAAQIDAAQFERITICExkQYwQVFSYXEQFCJAQlOBMlChI4KSYnJzsbL/2gAIAQMBAT8A/YCyjiwFa2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8YoMp4EHq5LlV3LvNPNI/FuXW5kcDUdw6cd4pJFkGanbJABJqacvmq7l+RR2Rgy0jiRQw2rmXM6CncOPydq+T6B4HZmfQjJ7eA+UQ6LqfMbN229V/Pyg4j1GzcnOVvlIV0pFH52bgZSt8pbRaC6TcTs3YycHvHyQBJAFQ2+WTyfgbVymlHmOI+Rjt3fe3wio4kj4Df39RNGY38jw60AscgMzSWrHe5yFJEkfBd/f1UiLIpU1JG0ZyPVJE7/pWktRxc/gUqKgyVQOtZVcZMMxUlqw3pvHdRBU5EEbIBO4CktpG3t8IpLeNOzM+fsSN5DkikmosPY75Wy8hS2duv0Z+te7wfaXlT2Nu3BSvoalsJE3xnTH81vG49UVVtzAGjbRH6cq90TxGvdE8RoW0Q7M6Cqu5VA9kVrNLvC5DvNRWEa75CWPIUqqgyVQB5bVzarMCy7n7++mUoxVhkRtW9tPdypBbRNJI3BVFYf0FdlWTErnQP24uP5JqLojgUYyNqznvZ2q46GYLKDq0khPejk/8ArOsU6HX1irTWre8xDeQBk4/FHduPtALEKozJq3skjAaQaT/wOqv4NJdco3jj6bNtby3c8VtAulJIwVRWCYJb4PbKqqGnYDWSdpPcPLZ6V9HEmikxOxjAlQaUqL9Q7x5+2xgCrrmG8/p9OrIDAg8CKkTQd07iRsdBcPV3ucSkX9H9KP1O8naIBBBG410gsBh2K3MCDKNjrE/2tSLpuqDtIFKAqhRwA6y9GVw/mAdjohEEwK2I4u0jH/Lb6exgXljL2tEwP9pq0GdzF69bfHO4fyAGx0ScPgVpl9JkB/yO309cG6w9O0ROeZq3bQnib/UOsJyBJqV9ZI7952Ogl8DDdYezfEra1B5HcdvpTfC+xicoc44QIl/t4/z7LaUTRK3bwPr1d9PoJqlPxN/A2cOvpsNvIbyA/Eh3jvHaDWHYjbYnapdWzgg/qHap7js9JseTDLZreBwbuVSAB9AP1GiSSSeJ9ltcGB8/pPEUjq6hlOYPU3FykC97dgp3aRi7HMnaw3FbzCptdaSZeJDvVh5isO6aYdcqq3gNvJ25705ikxXDJAGS/gI/5FqfHMIt10pb+H0DBjyGdYr03XRaLCojnw1sg/6FTTSzyPNNIXkc5szHMnYhuJIDmh3doPCo7+F9z5oaE0R4SrzrWR/cXnWsj+4vOtZH9xeYrWx/cXmKe6gTjID6b6lxAnMQrl5mmYsSzEkn92//2Q=="] + * }) */ - public async embed( + public embed( request: Cohere.EmbedRequest = {}, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__embed(request, requestOptions)); + } + + private async __embed( + request: Cohere.EmbedRequest = {}, + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/embed" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/embed", ), method: "POST", headers: { @@ -601,63 +668,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.EmbedRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.EmbedResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.EmbedResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -667,12 +725,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -698,18 +758,39 @@ export class CohereClient { * * @example * await client.rerank({ - * query: "query", - * documents: ["documents"] + * documents: [{ + * "text": "Carson City is the capital city of the American state of Nevada." + * }, { + * "text": "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan." + * }, { + * "text": "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages." + * }, { + * "text": "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district." + * }, { + * "text": "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states." + * }], + * query: "What is the capital of the United States?", + * top_n: 3, + * model: "rerank-v3.5" * }) */ - public async rerank( + public rerank( + request: Cohere.RerankRequest, + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__rerank(request, requestOptions)); + } + + private async __rerank( request: Cohere.RerankRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/rerank" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/rerank", ), method: "POST", headers: { @@ -720,63 +801,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.RerankRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.RerankResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.RerankResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -786,12 +858,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/rerank."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -818,17 +892,58 @@ export class CohereClient { * * @example * await client.classify({ - * inputs: ["inputs"] + * examples: [{ + * text: "Dermatologists don't like her!", + * label: "Spam" + * }, { + * text: "'Hello, open to this?'", + * label: "Spam" + * }, { + * text: "I need help please wire me $1000 right now", + * label: "Spam" + * }, { + * text: "Nice to know you ;)", + * label: "Spam" + * }, { + * text: "Please help me?", + * label: "Spam" + * }, { + * text: "Your parcel will be delivered today", + * label: "Not spam" + * }, { + * text: "Review changes to our Terms and Conditions", + * label: "Not spam" + * }, { + * text: "Weekly sync notes", + * label: "Not spam" + * }, { + * text: "'Re: Follow up from today's meeting'", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * model: "YOUR-FINE-TUNED-MODEL-ID" * }) */ - public async classify( + public classify( + request: Cohere.ClassifyRequest, + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__classify(request, requestOptions)); + } + + private async __classify( request: Cohere.ClassifyRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/classify" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/classify", ), method: "POST", headers: { @@ -839,63 +954,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.ClassifyRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.ClassifyResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.ClassifyResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -905,12 +1011,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/classify."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -939,17 +1047,26 @@ export class CohereClient { * * @example * await client.summarize({ - * text: "text" + * text: "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. It may be made from milk or cream and is flavoured with a sweetener, either sugar or an alternative, and a spice, such as cocoa or vanilla, or with fruit such as strawberries or peaches. It can also be made by whisking a flavored cream base and liquid nitrogen together. Food coloring is sometimes added, in addition to stabilizers. The mixture is cooled below the freezing point of water and stirred to incorporate air spaces and to prevent detectable ice crystals from forming. The result is a smooth, semi-solid foam that is solid at very low temperatures (below 2 \u00B0C or 35 \u00B0F). It becomes more malleable as its temperature increases.\n\nThe meaning of the name \"ice cream\" varies from one country to another. In some countries, such as the United States, \"ice cream\" applies only to a specific variety, and most governments regulate the commercial use of the various terms according to the relative quantities of the main ingredients, notably the amount of cream. Products that do not meet the criteria to be called ice cream are sometimes labelled \"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, one word is used fo\r all variants. Analogues made from dairy alternatives, such as goat's or sheep's milk, or milk substitutes (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are lactose intolerant, allergic to dairy protein or vegan." * }) */ - public async summarize( + public summarize( request: Cohere.SummarizeRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__summarize(request, requestOptions)); + } + + private async __summarize( + request: Cohere.SummarizeRequest, + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/summarize" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/summarize", ), method: "POST", headers: { @@ -960,63 +1077,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.SummarizeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.SummarizeResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.SummarizeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -1026,12 +1134,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/summarize."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -1061,14 +1171,23 @@ export class CohereClient { * model: "command" * }) */ - public async tokenize( + public tokenize( request: Cohere.TokenizeRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__tokenize(request, requestOptions)); + } + + private async __tokenize( + request: Cohere.TokenizeRequest, + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/tokenize" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/tokenize", ), method: "POST", headers: { @@ -1079,63 +1198,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.TokenizeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.TokenizeResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.TokenizeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -1145,12 +1255,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/tokenize."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -1176,18 +1288,27 @@ export class CohereClient { * * @example * await client.detokenize({ - * tokens: [1], - * model: "model" + * tokens: [10002, 2261, 2012, 8, 2792, 43], + * model: "command" * }) */ - public async detokenize( + public detokenize( + request: Cohere.DetokenizeRequest, + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__detokenize(request, requestOptions)); + } + + private async __detokenize( request: Cohere.DetokenizeRequest, - requestOptions?: CohereClient.RequestOptions - ): Promise { + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/detokenize" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/detokenize", ), method: "POST", headers: { @@ -1198,63 +1319,54 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.DetokenizeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DetokenizeResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DetokenizeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -1264,12 +1376,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/detokenize."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -1295,11 +1409,21 @@ export class CohereClient { * @example * await client.checkApiKey() */ - public async checkApiKey(requestOptions?: CohereClient.RequestOptions): Promise { + public checkApiKey( + requestOptions?: CohereClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__checkApiKey(requestOptions)); + } + + private async __checkApiKey( + requestOptions?: CohereClient.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/check-api-key" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/check-api-key", ), method: "POST", headers: { @@ -1310,8 +1434,8 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -1323,45 +1447,40 @@ export class CohereClient { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CheckApiKeyResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.CheckApiKeyResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -1371,12 +1490,14 @@ export class CohereClient { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/check-api-key."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -1385,7 +1506,8 @@ export class CohereClient { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/client/index.ts b/src/api/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/client/index.ts +++ b/src/api/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/client/requests/ChatRequest.ts b/src/api/client/requests/ChatRequest.ts index ad16e2de..87e0e48f 100644 --- a/src/api/client/requests/ChatRequest.ts +++ b/src/api/client/requests/ChatRequest.ts @@ -2,38 +2,83 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; +import * as Cohere from "../../index.js"; /** * @example * { - * message: "Can you give me a global market overview of solar panels?", - * chatHistory: [{ - * role: "TOOL" + * chat_history: [{ + * role: "USER", + * message: "Who discovered gravity?" * }, { - * role: "TOOL" + * role: "CHATBOT", + * message: "The man who is widely credited with discovering gravity is Sir Isaac Newton" * }], - * promptTruncation: "OFF", - * temperature: 0.3 + * message: "What year was he born?", + * connectors: [{ + * id: "web-search" + * }] + * } + * + * @example + * { + * message: "Who is more popular: Nsync or Backstreet Boys?", + * documents: [{ + * "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak." + * }, { + * "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold." + * }, { + * "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers." + * }, { + * "title": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures." + * }] + * } + * + * @example + * { + * message: "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?", + * tools: [{ + * name: "query_daily_sales_report", + * description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.", + * parameter_definitions: { + * "day": { + * description: "Retrieves sales data for this day, formatted as YYYY-MM-DD.", + * type: "str", + * required: true + * } + * } + * }, { + * name: "query_product_catalog", + * description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", + * parameter_definitions: { + * "category": { + * description: "Retrieves product information data for all products in this category.", + * type: "str", + * required: true + * } + * } + * }] * } */ export interface ChatRequest { /** * Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. */ - accepts?: "text/event-stream"; + Accepts?: "text/event-stream"; /** * Text input for the model to respond to. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ message: string; /** * The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. * * Compatible Deployments: Cohere Platform, Private Deployments - * */ model?: string; /** @@ -42,7 +87,6 @@ export interface ChatRequest { * The `SYSTEM` role is also used for the contents of the optional `chat_history=` parameter. When used with the `chat_history=` parameter it adds content throughout a conversation. Conversely, when used with the `preamble=` parameter it adds content at the start of the conversation only. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ preamble?: string; /** @@ -53,18 +97,16 @@ export interface ChatRequest { * The chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - chatHistory?: Cohere.Message[]; + chat_history?: Cohere.Message[]; /** * An alternative to `chat_history`. * * Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string. * * Compatible Deployments: Cohere Platform - * */ - conversationId?: string; + conversation_id?: string; /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. * @@ -79,16 +121,14 @@ export interface ChatRequest { * Compatible Deployments: * - AUTO: Cohere Platform Only * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - promptTruncation?: Cohere.ChatRequestPromptTruncation; + prompt_truncation?: ChatRequest.PromptTruncation; /** * Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one. * * When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG). * * Compatible Deployments: Cohere Platform - * */ connectors?: Cohere.ChatConnector[]; /** @@ -97,9 +137,8 @@ export interface ChatRequest { * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - searchQueriesOnly?: boolean; + search_queries_only?: boolean; /** * A list of relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary. * @@ -122,7 +161,6 @@ export interface ChatRequest { * See ['Document Mode'](https://docs.cohere.com/docs/retrieval-augmented-generation-rag#document-mode) in the guide for more information. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ documents?: Cohere.ChatDocument[]; /** @@ -131,9 +169,8 @@ export interface ChatRequest { * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - citationQuality?: Cohere.ChatRequestCitationQuality; + citation_quality?: ChatRequest.CitationQuality; /** * Defaults to `0.3`. * @@ -142,31 +179,27 @@ export interface ChatRequest { * Randomness can be further maximized by increasing the value of the `p` parameter. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ temperature?: number; /** * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - maxTokens?: number; + max_tokens?: number; /** * The maximum number of input tokens to send to the model. If not specified, `max_input_tokens` is the model's context length limit minus a small buffer. * * Input will be truncated according to the `prompt_truncation` parameter. * * Compatible Deployments: Cohere Platform - * */ - maxInputTokens?: number; + max_input_tokens?: number; /** * Ensures only the top `k` most likely tokens are considered for generation at each step. * Defaults to `0`, min value of `0`, max value of `500`. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ k?: number; /** @@ -174,7 +207,6 @@ export interface ChatRequest { * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ p?: number; /** @@ -184,51 +216,36 @@ export interface ChatRequest { * determinism cannot be totally guaranteed. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ seed?: number; /** * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - stopSequences?: string[]; + stop_sequences?: string[]; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - presencePenalty?: number; - /** - * When enabled, the user's prompt will be sent to the model without - * any pre-processing. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * - */ - rawPrompting?: boolean; - /** The prompt is returned in the `prompt` response field when this is enabled. */ - returnPrompt?: boolean; + presence_penalty?: number; /** * A list of available tools (functions) that the model may suggest invoking before producing a text response. * * When `tools` is passed (without `tool_results`), the `text` field in the response will be `""` and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ tools?: Cohere.Tool[]; /** @@ -255,12 +272,11 @@ export interface ChatRequest { * **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - toolResults?: Cohere.ToolResult[]; + tool_results?: Cohere.ToolResult[]; /** Forces the chat to be single step. Defaults to `false`. */ - forceSingleStep?: boolean; - responseFormat?: Cohere.ResponseFormat; + force_single_step?: boolean; + response_format?: Cohere.ResponseFormat; /** * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. * When `NONE` is specified, the safety instruction will be omitted. @@ -272,7 +288,61 @@ export interface ChatRequest { * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + safety_mode?: ChatRequest.SafetyMode; +} + +export namespace ChatRequest { + /** + * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * + * Dictates how the prompt will be constructed. + * + * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance. * + * With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API. + * + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. + * + * Compatible Deployments: + * - AUTO: Cohere Platform Only + * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + export type PromptTruncation = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; + export const PromptTruncation = { + Off: "OFF", + Auto: "AUTO", + AutoPreserveOrder: "AUTO_PRESERVE_ORDER", + } as const; + /** + * Defaults to `"accurate"`. + * + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. + * + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + export type CitationQuality = "fast" | "accurate" | "off"; + export const CitationQuality = { + Fast: "fast", + Accurate: "accurate", + Off: "off", + } as const; + /** + * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. + * When `NONE` is specified, the safety instruction will be omitted. + * + * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. + * + * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). + * + * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. + * + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments */ - safetyMode?: Cohere.ChatRequestSafetyMode; + export type SafetyMode = "CONTEXTUAL" | "STRICT" | "NONE"; + export const SafetyMode = { + Contextual: "CONTEXTUAL", + Strict: "STRICT", + None: "NONE", + } as const; } diff --git a/src/api/client/requests/ChatStreamRequest.ts b/src/api/client/requests/ChatStreamRequest.ts index d2b95372..9bd5ab08 100644 --- a/src/api/client/requests/ChatStreamRequest.ts +++ b/src/api/client/requests/ChatStreamRequest.ts @@ -2,38 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; +import * as Cohere from "../../index.js"; /** * @example * { - * message: "Can you give me a global market overview of solar panels?", - * chatHistory: [{ - * role: "TOOL" - * }, { - * role: "TOOL" - * }], - * promptTruncation: "OFF", - * temperature: 0.3 + * message: "hello world!" * } */ export interface ChatStreamRequest { /** * Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. */ - accepts?: "text/event-stream"; + Accepts?: "text/event-stream"; /** * Text input for the model to respond to. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ message: string; /** * The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. * * Compatible Deployments: Cohere Platform, Private Deployments - * */ model?: string; /** @@ -42,7 +33,6 @@ export interface ChatStreamRequest { * The `SYSTEM` role is also used for the contents of the optional `chat_history=` parameter. When used with the `chat_history=` parameter it adds content throughout a conversation. Conversely, when used with the `preamble=` parameter it adds content at the start of the conversation only. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ preamble?: string; /** @@ -53,18 +43,16 @@ export interface ChatStreamRequest { * The chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - chatHistory?: Cohere.Message[]; + chat_history?: Cohere.Message[]; /** * An alternative to `chat_history`. * * Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string. * * Compatible Deployments: Cohere Platform - * */ - conversationId?: string; + conversation_id?: string; /** * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. * @@ -79,16 +67,14 @@ export interface ChatStreamRequest { * Compatible Deployments: * - AUTO: Cohere Platform Only * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - promptTruncation?: Cohere.ChatStreamRequestPromptTruncation; + prompt_truncation?: ChatStreamRequest.PromptTruncation; /** * Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one. * * When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG). * * Compatible Deployments: Cohere Platform - * */ connectors?: Cohere.ChatConnector[]; /** @@ -97,9 +83,8 @@ export interface ChatStreamRequest { * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - searchQueriesOnly?: boolean; + search_queries_only?: boolean; /** * A list of relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary. * @@ -122,7 +107,6 @@ export interface ChatStreamRequest { * See ['Document Mode'](https://docs.cohere.com/docs/retrieval-augmented-generation-rag#document-mode) in the guide for more information. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ documents?: Cohere.ChatDocument[]; /** @@ -131,9 +115,8 @@ export interface ChatStreamRequest { * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - citationQuality?: Cohere.ChatStreamRequestCitationQuality; + citation_quality?: ChatStreamRequest.CitationQuality; /** * Defaults to `0.3`. * @@ -142,31 +125,27 @@ export interface ChatStreamRequest { * Randomness can be further maximized by increasing the value of the `p` parameter. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ temperature?: number; /** * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - maxTokens?: number; + max_tokens?: number; /** * The maximum number of input tokens to send to the model. If not specified, `max_input_tokens` is the model's context length limit minus a small buffer. * * Input will be truncated according to the `prompt_truncation` parameter. * * Compatible Deployments: Cohere Platform - * */ - maxInputTokens?: number; + max_input_tokens?: number; /** * Ensures only the top `k` most likely tokens are considered for generation at each step. * Defaults to `0`, min value of `0`, max value of `500`. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ k?: number; /** @@ -174,7 +153,6 @@ export interface ChatStreamRequest { * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ p?: number; /** @@ -184,51 +162,36 @@ export interface ChatStreamRequest { * determinism cannot be totally guaranteed. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ seed?: number; /** * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - stopSequences?: string[]; + stop_sequences?: string[]; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * - */ - presencePenalty?: number; - /** - * When enabled, the user's prompt will be sent to the model without - * any pre-processing. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - rawPrompting?: boolean; - /** The prompt is returned in the `prompt` response field when this is enabled. */ - returnPrompt?: boolean; + presence_penalty?: number; /** * A list of available tools (functions) that the model may suggest invoking before producing a text response. * * When `tools` is passed (without `tool_results`), the `text` field in the response will be `""` and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ tools?: Cohere.Tool[]; /** @@ -255,12 +218,11 @@ export interface ChatStreamRequest { * **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ - toolResults?: Cohere.ToolResult[]; + tool_results?: Cohere.ToolResult[]; /** Forces the chat to be single step. Defaults to `false`. */ - forceSingleStep?: boolean; - responseFormat?: Cohere.ResponseFormat; + force_single_step?: boolean; + response_format?: Cohere.ResponseFormat; /** * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. * When `NONE` is specified, the safety instruction will be omitted. @@ -272,7 +234,61 @@ export interface ChatStreamRequest { * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. * * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + safety_mode?: ChatStreamRequest.SafetyMode; +} + +export namespace ChatStreamRequest { + /** + * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. * + * Dictates how the prompt will be constructed. + * + * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance. + * + * With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API. + * + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. + * + * Compatible Deployments: + * - AUTO: Cohere Platform Only + * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + export type PromptTruncation = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; + export const PromptTruncation = { + Off: "OFF", + Auto: "AUTO", + AutoPreserveOrder: "AUTO_PRESERVE_ORDER", + } as const; + /** + * Defaults to `"accurate"`. + * + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. + * + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + */ + export type CitationQuality = "fast" | "accurate" | "off"; + export const CitationQuality = { + Fast: "fast", + Accurate: "accurate", + Off: "off", + } as const; + /** + * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. + * When `NONE` is specified, the safety instruction will be omitted. + * + * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. + * + * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). + * + * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. + * + * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments */ - safetyMode?: Cohere.ChatStreamRequestSafetyMode; + export type SafetyMode = "CONTEXTUAL" | "STRICT" | "NONE"; + export const SafetyMode = { + Contextual: "CONTEXTUAL", + Strict: "STRICT", + None: "NONE", + } as const; } diff --git a/src/api/client/requests/ClassifyRequest.ts b/src/api/client/requests/ClassifyRequest.ts index a7fd35d4..b52cd388 100644 --- a/src/api/client/requests/ClassifyRequest.ts +++ b/src/api/client/requests/ClassifyRequest.ts @@ -2,12 +2,44 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; +import * as Cohere from "../../index.js"; /** * @example * { - * inputs: ["inputs"] + * examples: [{ + * text: "Dermatologists don't like her!", + * label: "Spam" + * }, { + * text: "'Hello, open to this?'", + * label: "Spam" + * }, { + * text: "I need help please wire me $1000 right now", + * label: "Spam" + * }, { + * text: "Nice to know you ;)", + * label: "Spam" + * }, { + * text: "Please help me?", + * label: "Spam" + * }, { + * text: "Your parcel will be delivered today", + * label: "Not spam" + * }, { + * text: "Review changes to our Terms and Conditions", + * label: "Not spam" + * }, { + * text: "Weekly sync notes", + * label: "Not spam" + * }, { + * text: "'Re: Follow up from today's meeting'", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * model: "YOUR-FINE-TUNED-MODEL-ID" * } */ export interface ClassifyRequest { @@ -31,5 +63,19 @@ export interface ClassifyRequest { * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - truncate?: Cohere.ClassifyRequestTruncate; + truncate?: ClassifyRequest.Truncate; +} + +export namespace ClassifyRequest { + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + export type Truncate = "NONE" | "START" | "END"; + export const Truncate = { + None: "NONE", + Start: "START", + End: "END", + } as const; } diff --git a/src/api/client/requests/DetokenizeRequest.ts b/src/api/client/requests/DetokenizeRequest.ts index 9bc622e6..2b1a2def 100644 --- a/src/api/client/requests/DetokenizeRequest.ts +++ b/src/api/client/requests/DetokenizeRequest.ts @@ -5,8 +5,8 @@ /** * @example * { - * tokens: [1], - * model: "model" + * tokens: [10002, 2261, 2012, 8, 2792, 43], + * model: "command" * } */ export interface DetokenizeRequest { diff --git a/src/api/client/requests/EmbedRequest.ts b/src/api/client/requests/EmbedRequest.ts index 0868472e..ad394330 100644 --- a/src/api/client/requests/EmbedRequest.ts +++ b/src/api/client/requests/EmbedRequest.ts @@ -2,49 +2,59 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; +import * as Cohere from "../../index.js"; /** * @example - * {} + * { + * texts: ["hello", "goodbye"], + * model: "embed-v4.0", + * input_type: "classification" + * } + * + * @example + * { + * model: "embed-v4.0", + * input_type: "image", + * embedding_types: ["float"], + * images: ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gAfQ29tcHJlc3NlZCBieSBqcGVnLXJlY29tcHJlc3P/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIAZABkAMBIgACEQEDEQH/xAAdAAEAAQQDAQAAAAAAAAAAAAAABwEFBggCAwQJ/9oACAEBAAAAAN/gAAAAAAAAAAAAAAAAAAAAAAAAAAHTg9j6agAAp23/ADjsAAAPFrlAUYeagAAArdZ12uzcAAKax6jWUAAAAO/bna+oAC1aBxAAAAAAbM7rVABYvnRgYAAAAAbwbIABw+cMYAAAAAAvH1CuwA091RAAAAAAbpbPAGJfMXzAAAAAAJk+hdQGlmsQAAAAABk31JqBx+V1iAAAAAALp9W6gRp826AAAAAAGS/UqoGuGjwAAAAAAl76I1A1K1EAAAAAAG5G1ADUHU0AAAAAAu/1Cu4DVbTgAAAAAA3n2JAIG0IAAAAAArt3toAMV+XfEAAAAAL1uzPlQBT5qR2AAAAAenZDbm/AAa06SgAAAAerYra/LQADp+YmIAAAAC77J7Q5KAACIPnjwAAAAzbZzY24gAAGq+m4AAA7Zo2cmaoAAANWdOOAAAMl2N2TysAAAApEOj2HgAOyYtl5w5jw4zZPJyuGQ5H2AAAdes+suDUAVyfYbZTLajG8HxjgD153n3IAABH8QxxiVo4XPKpGlyTKjowvCbUAF4mD3AAACgqCzYPiPQAA900XAACmN4favRk+a9wB0xdiNAAAvU1cgAxeDcUoPdL0s1B44atQAACSs8AEewD0gM72I5jjDFiAAAPfO1QGL6z9IAlGdRgkaAAABMmRANZsSADls7k6kFW8AAAJIz4DHtW6AAk+d1jhUAAAGdyWBFcGgAX/AGnYZFgAAAM4k4CF4hAA9u3FcKi4AAAEiSEBCsRgAe3biuGxWAAACXsoAiKFgALttgs0J0AAAHpnvkBhOt4AGebE1pBtsAAAGeySA4an2wAGwEjGFxaAAAe+c+wAjKBgAyfZ3kUh3HAAAO6Yb+AKQLGgBctmb2HXDNjAAD1yzkQAENRF1gyvYG9AcI2wjgAByyuSveAAWWMcQtnoyOQs8qAPFhVh8HADt999y65gAAKKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAEFBgIEA//aAAgBAhAAAAAAAAAAAAABEAAJkBEAAB0CIAABMhyAAA6EQAAA6EQAABMiIAAAmREAAAmQiAABMgOQAEyAHIATIACIBMu7H3fT419eACEnps7DoPFQch889Wd3V2TeWIBV0o+eF8I0OrXVoAIyvBm8uDe2Wp6ADO+Mw9WDV6rSgAzvjMNWA1Op1AARlvmZbOA3NnpfSAK6iHnwfnFttZ9Wh7AeXPcB5cxWd3Wk7Pvb+uR8q+rgAAAAAAAAP//EABsBAQABBQEAAAAAAAAAAAAAAAAEAQIDBQYH/9oACAEDEAAAAAAAAAC20AL6gCNDxAArnn3gpro4AAv2l4QIgAAJWwGLVAAAX7cQYYAAFdyNZgAAAy7UazAAABsZI18UAAE6YEfWgACRNygavCACsmZkALNZjAMkqVcAC2FFoKyJWe+fMyYoMAAUw2L8t0jYzqhE0dAzd70eHj+PK7mcAa7UDN7VvBwXmDb7EAU5uw9C9KCnh2n6WoAaKIey9ODy/jN+ADRRD2fpQeY8P0QAU5zGel+gg8V53oc4AgaYTfcJ45Tx5I31wCPobQ2PpPRYuP8APMZm2kqoxQddQAAAAAAAAP/EAFMQAAEDAgIDCQkMBwUIAwAAAAECAwQFEQAGBzFREhMhMEBBYXGBCBQYIjJCRlDSFSBSVGJygpGTobHREDRDc6LBwiMzU3CyFiQlNVVkdISSlLP/2gAIAQEAAT8A/wAo74nVaBAb32bNYitfDfcS2PrURiZpU0dwVFMjN1OVY8O8u7//APkFYc076LmfSVSvmQpB/ox4QGjH/r7v/wBGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0Y89fd7IMj2cN6e9GDpCTmRaOuFI9nEDSlo9qakpj5upoJNgH3d4+50JxGlxpbSH4r7bzSvJW0sLSeop5NWsw0fL8RU2rVGPDjJ4C6+4EAnYnaegYzV3StDhFcfK1LdqDuoSZBLDHWlPlqxXtNmkOulaVVxcFg3/sYA73A+kLrxKnTJrpfmSXX3jrcdWVqPWVYudvJ7nbil16s0R7vikVSVDduCVR3lNk9e5IvjKfdG5rpKmo+Yo7NXi8ALlgxJH0kiysZL0l5Uzsz/AMFn2l7m7kJ8BuSj6PnAbU8ieeZitOPPuoQ22krWtZCUpSkXJJOoDGkHui4MBT1MyW2ibITdJnuA97o/dJ1uHFczFXMyzV1Gu1N+bJV57yr7kbEjUkdA5dGlSYb7UqJIcZfaUFtuNLKFoUNRSocIONF3dBb6tih58eSCQEM1PUOqT7eELS4lK0KCkkAgg3BB4/M2Z6NlKlSKtWJiI8VoWueFS1nUhA85ZxpJ0v13Pj7kNorg0NC7tw0K4XNi3yPKPRqHqLQnpkeoD8XKmZZJVSHCG4klw/qijqQs/wCF/pwDfjc1ZqpOUKNLrVXf3qMyLJSLFbrh8ltA51qxn7P9az9V1z6istxWypMSIhRLbCD+Kj5yvUYJHCMdz7pLXWoByfWJBXUILV4bizwvRk+Z0qa4yoTodKgyZ859DEWO0t11xZslCEC5UrGlHSNOz/XVvBa26RFKkQY+xHO4v5a/UtArU3LlZptbpzm4lQ30ut7DbWk9ChwHGXq5EzHQ6ZWoCv8AdpsdDyRrIKtaFdKTwHi+6I0hrffGRKU/ZloodqSkngW5rQz1I1n1P3M2ZzJpFYyvIXdUJ0SowP8AhP8AAtI6AvitIWbWclZVqlbWElxpvcRmz+0kOcDaf5nEyXJnypM2Y8p2Q+6t11xRupa1m6lHpJ9T6B6uaVpHo7alEMz0PQnepxN0/wASRgauJ7pTNZmVynZTjuXZpzYkSRtkPDgB6UI9UZMlrgZsy1MQqxZqkRy/QHRfA4iZIaiRX5D6ghpptTi1bEIFycZmrL2YcwVitvk7ubLdfsfNClcCewcHqiiX91qbbX3yz/rGBxGmKse4ujnMz6F2dfjiGj/2VBs/ccE3J9UZOirm5ry3EQm5eqkRu3Qp0YHEd01PLGUqPT0mxk1QLV0oZaPteqdBtKNV0kUIkXah77Md6mkcH8RGBq4jupH7JyXG/wDPcP1tj1T3MuWVMQK5mt9FjJWmDGO1tHjuHqJ4nupEnvrJa+beZ4/jR6ooNGnZhrFOotNa3yXMeS02OvWo9CRwk4ytQIeWKDS6HC/V4TCWgq1itWtSz0rPCeJ7qKNenZSl2/upEtonpcShXqcC+NA+jFeW4H+1NbYKatOaswysWMaOrbscc4rujaYZuj/vzccMCpR3yehwFn+r1MAVGwGNDOhVbK4ubc4xLLFnYMB1PCNjrw/BHF58opzDk7MlHSndOSID28ja6gbtH3jChZRHqShZerOZag1S6JT3pcpzUhsahtUTwJTtJxow0G0vKRYreYS1PrIAUhNrx4yvkA+WsfCONXFnGlTLZytnqvU5KLRlvmTG2Fl/xwB0J1eookOXPkNRYUZ1991W5baaQVrWdiUi5JxkbudKzVCzOzg+abE196NWXKWOnWlvGW8p0DKMEU6g01qKzwFe5F1uEDynFnhUeO7pTJ5n0aBmyK3d+mneJVtZjOnxVfQX6ghwZtRktQ4EV6RJcNkNMoK1qOwJTcnGTe5yr9V3qXmuSKXFNj3uizkpY/0oxlbIOVslRt6oVKaZdIst9XjyHPnOK4ezkFVgw6vAmU2ewHYsllbDiFaloWNyoYz1lKZknMtRoEu6gyvdMO8zrC/IXy2j0Cs5glpg0WmyJkk+YwgrIG1WwdJxk7uap75amZyqQit6zChkLe6lueSnGWcl5ayjGEegUliKCAFuAbp5z57irqPI9NOjVOdqB31T2x7tU5KlxNryNa2CenWnDra2XFtOoUhaFFKkqFiCOAgg8qyro7zdnJwCh0Z5xi9lSVje46etarA22DGUe5spEPe5ebqgue78Ui3aj9Sl+WvFIodHoMREGj02PDjJ1NMNhAJ2m2s8m07aIHJi5WdMsxSZFiuoxG08LoGt9sDz/hjGrkzLD0hxDLDSluLISlKQSpRPMAMZU0C54zFvcidHTR4Sv2k24dI+SyPG+u2MqaBskZc3qRLimrzEftZoBaB+S0PFw0y2y2hppCUIQAEpSAAAOYAauU6XtBJmuycy5LjASVXcl05sWDu1bGxe1GHWnGXFtOoUhxCilSVAghSTYgg6iOR5eyfmXNT/AHvQKNJmKBspTaLNo+es2SntOMq9zNIc3uTm+sBoazEgWWvtdWLDGWchZTyk2E0KiR4zlrKkEbt9XW4u6uW6SNDNAzwHZ7BTTq3YkSm0XS7sS+ka/na8ZuyJmbJMwxK9T1NJJs1IR47D3S2vj2mXXlobabUtaiAlKRcknUAMZV0F56zJvT8iEKVCVY77PuhZHyWvLxlTuesl0Te3qqlysy08JMnxI4PQ0n+onEWDFhMNxokdphhsWQ20gIQkbEpFgPeyqnBg/rMhCCBfc3ur6hw4lZ1hNbpMdlbpGokhKT+OHs7zVf3EdpHzgVfzGDnGqnnbHUkYGcqqOZo/OT+VsMZ5eBG/w0K2lJKPaxDzfTJBCXFLZUTbxk3+q2GJTEhAcYdQtB1KSoEckqdLp1ThvQqnEZkxXU7lbLyAtCusKxnPubKVNU9NyhOMB03Pekm7kfsXwqRjM+jfOWUVLNZochEcapLY31gj56LgduLHZxNjjL+TM0ZpcDdCokuWL2LiEWaSflOKskYyt3M8t0tSM31hLCNZiwbLc7XVCwxljR9lHKDaRQ6Kww6BZUlQ32Qr6a7nAAHvFLSkEqUAAMT81UyGClDm/r2N6u1WKhm2oywpDKt4bPMjX/8ALC3HHCVLWSSbm+338adLhuB2O+tChzg4pOdOFDVRRbm31A/EflhiQ1IbS6y4laFaik3HJCkKBBAII4RjMOibIOYCtc/LkZD6tb0W8Zy+0luwVisdzDRX925RMyS4uxMtlD46gUFGKj3NWdY11wajSpbf71bS/qUnErQTpPjXIy2Xk7WZLCv68L0R6R2/KylO+ikK/A4Tom0jL1ZRqHa3bEXQjpPlkBGVXkDa48yj8V4p/c358lEGW/TIaOcOSCtfYG0qxSO5gp6AldczQ+9tbhsBr+NwqxRNDWjygFDjGXmpL4N99nEyVH6K/FGGmGY7SGm20oQgAJSkAJAHMAPeyJ8WEjfJD6EX1XP4DWTioZ1ZRdEBndnmWvgT2DE6tVCoE98SFFPMgGyR2DBN+E8XSq3MpToUyu7ZIK0HUcUmsRapGK46wlfBuknWnk5AOsY3I2YsNmLAagPf1HMFNp+6S68FOD9mjhV+QxUM5THrohJDKNutWHpL8halvOqWo6yokk8fT58inSESI6ylST2EbDtGKRU49VitvtkJI8tOsg7OOJA1nFSzhQKaVIkT21OA23DV3Fdu51Yk6VICCREpzznS4pKPw3WDpXk34KOgD9+fZwxpWB4JNIIG1D1/xTinaSMvylJDy3YyjwDfUXH1pviFPhTGw/FkNuoOpbagofdxU2fHhMqekOBDadus4q+bJcwqahkssfxnrOFKKjckk8iodWcpUxDySS2rgcTfWMMPtvstvNKCkLSFJI5weMzFm6mZfQUvL32UQCiOg+N1q2DFbzlWa2paXHyzGOplolKbfKOtWLnb72FUp9NeD8GU4y4OdBtfr2jGW9JTbqm4tdQlCr2D6fIPzxzYadbdQhxpYUlQBBBuCD7+pVKPTIq5D6uAcCUjWpWwYqtWlVV9Tr6yE6kIHkpHJcl1cqS5TXjfc+O3f7xxedc6IoqTAgEKnqHCdYZB5ztVsGH5D0p5x+Q6px1ZKlKUbknico5zk0J5EWWtTtPWeFOstdKejaMR5TMxhuQw4lbTiQpKkm4UD7151thtbriwlCElSidQAxXaw7VZalXsyglLadg/M8mpstcKbHko1oWDbb0duGXEOtIcQbpUkKB2g8Tm3MSMv0xbySDJduhhB+FtPQMSJD0p5yRIcK3XFFSlK1kni9HealU+UijzFjvZ5X9iVHyHDzdSve5yqqm2kU5pViuynCNnMOUZVld80lgKsVNEtns4QPqPEKNgTjOdbVWq0+tC7xmCWmRzWTrV2njEqUhQUkkEG4Ixk6ue7dFjPuuXeau08Plp5+0cP6VrS22pSiAACSdgGKpMXPnSJK/PWSBsHMOzlGRX/EmsW8koWOs3B4jONTNNoNQkIUUr3ve27awpzxb4PCTxujGpKYqkinKV4klvdJ+e3+nMkjvakS1DWtIb7FcB+7BNyTyjI67S5CDzsqP1EcRpUkqRTqfFBtvr6l9iE2/nx2V5XeeYKS9/3CEdizuD+OEm4/RnVak0+OhJtd256gm38+U5JTeY+rYyofeniNKyjv8AR0c24f8AxTx1NJTUYKhrD7Z/iGEeSP0Z63Pe8Xc6hur9dxynI7JtNeOqyAO0m/EaVv1mj/Mf/FPHU7/mEL98j8cI8gfozq2pdOZWnmdseopJ5TlKIWKShZFi8tSz2eL/AC4jSsx/Y0qR8FbqD9IA8dQmFSK1S2UjypTQ7N0L4SLJ/RmOOJVIloSk+Ijdjb4nCcEWJB5PDjrlSWWGxdS1hI7TiHHRGjsso8htCUDqSLcRpDppl5ckLABXHUl8DYBwH7jx2juAZeYmXyk7iM2t07L23I/HA/QtIWkpULggjFXgqp8+RHINkrO5O0axyfJlLK3l1F1Pit3S3cecRr7BxMqM3IjusOpCkOoKVjakixGKzTXaTU5cB4HdNOEAnzk6we0cbo3o5g0hU91FnZhCh+7T5PvM6UjfWkTmE3W0LObSnmPZyanQHqjKajMjhUeE2uANpxAhNQYzTDabNtpsOk85PXxWkjLJmRk1mGjdPR0WdA85rb9HjMqUByv1Rtgg97N2W+vYjZ1qww02y2htCQlCEhKUjUAPeLQlxCkLAUlQsQdRBxmKiOUqWopSox1m6FHht0HkjDDsl1DLKCpajYAYoFFRSYw3dlSF8K1bPkji1JCgUkXBxnjJTlJecqVOZvCWbrQn9kT/AEniqVSplYmNQoTRW4s9iRzqUeYDGXaBFoFPbiMC6/KdctYrVt/Ie+qECNMjKjyE7oLHaOkYrVEkUl8hQKmVE7hY1HkUOFInPoYjtla1bMUDLzNKb3xyy5KvKXzDoTxrjaHEKQ4gKSoWIIuCDzYzTo5WlTk2ggEG6lxr6vmH+WHmXWHFtPNqQ4k2UlQIIOwg+/y/lCq19xKm2yzFv4z7g8X6I844oOXoFBiiPDb4TYuOny1kbTxEmOxKaVHebS4hXlA4rWTpEdSnqfdxu5JR5w6tuFtONKKXEFJBsQeOShSzZIvilZTnTShySCwyfhDxj1DFPpcSmtBuM0B8JR4VK6zyCr5apFaQROiJWsCwdT4qx1KGKloseG7XSp4UnmQ+LfxJxJyLmaMoj3OU4n4TakqwrLVfSbGjy/sV4ZyhmN/yKRI+kncf6rYhaM64+QZa2YyOk7tQ7E4o+jyiU0h2SgzHhzu+R2I/PCEIbASgAJAsAOLqFFp84HvphKlkCyhwK4OnZiXkcElUKV9Fz2hh/KdZataPuwfOSoEYXQqog2MJ49Taj/LHuNVPiEj7Jf5Y9xqp8QkfZL/LHuNVPiEj7Jf5Y9xqp8QkfZL/ACx7jVT4hI+yX+WPcaqfEJH2S/yx7jVT4hI+yX+WEUCquaoTw+chQ/EYYyjWHQSpgN9K1C33XOIuR0+VMlfRbH8ziFRKdTwksRkhY89XjK+/VyWwxYf5ef/EADgRAAIBAgMDCQUHBQAAAAAAAAECAwQRAAUgMUFhEhMhIjBAUXGREDJQU6EGFDNCYoGSUnKiwdH/2gAIAQIBAT8A+L37e/wE9zHfj3k90Gk90Gk9ztqPcbd3t3e3b2129qRySGyIScRZY56ZXtwGFoKZfyX8zj7rT/JX0w+X0zbFKngcTZdLHdozyx9cbOg9pbFtENJPNYqlh4nEOWxJYykufQYVFQWRQBw1VVGk4LKAJPHxwysjFWFiNUsscKGSVwqjecVOfgErSxX/AFNhs5r2P4oHkoxHndchHKZXHFf+YpM7gnISYc0/+J0KpYhVFycUtCkQDygM/huHZZjThl59R1l97iNMsqQxvLIbKoucV1dLWykkkRg9VdOUZmyOtLO10PQhO4+Hty6mCrz7jpPu+XZsoZSp2EEYkQxyOh/KSNGf1JAipVO3rNq2EHGW1P3mkikJ6w6reYxGpd0QbyBhVCqFGwC3aV4tUycbHRnLFq+UeAUfTX9nmJhqE3BwfUYoxeqi8+1ryDVPwA0ZwCMwm4hT9Nf2eB5qobcWUfTFM3Inib9Q7QkAEnYMSvzkrv4knRn8BEkVQB0Ecg+Y15RTmCij5Qsz9c/v7KWYTQo28dDefZ5hUBI+aU9Z9vAaamnSqheF9jD0OKmmlpZWilFiNh3Eacqy9quUSSLaFDc8T4YAt7KWpNPJfap94YR1kUOhuD2NTVJTr4vuGHdpHZ3NydVVSQVaciZfIjaMVOR1URJhtKvocNSVSmzU8gP9pxHQVkhASnf9xbFJkJuHq2Fv6F/2cIiRoqIoVQLADRBUSwG6Ho3g7DiLMYX6Huh9RgTwtslT1GOdi+YnqMc7F8xP5DHOxfMT+Qxz0XzE9Rh6ymTbKD5dOJsyY3WFbcThmZiWYkk7z8W//8QAOREAAgECAgYHBwMDBQAAAAAAAQIDAAQFERITICExkQYwQVFSYXEQFCJAQlOBMlChI4KSYnJzsbL/2gAIAQMBAT8A/YCyjiwFa2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8YoMp4EHq5LlV3LvNPNI/FuXW5kcDUdw6cd4pJFkGanbJABJqacvmq7l+RR2Rgy0jiRQw2rmXM6CncOPydq+T6B4HZmfQjJ7eA+UQ6LqfMbN229V/Pyg4j1GzcnOVvlIV0pFH52bgZSt8pbRaC6TcTs3YycHvHyQBJAFQ2+WTyfgbVymlHmOI+Rjt3fe3wio4kj4Df39RNGY38jw60AscgMzSWrHe5yFJEkfBd/f1UiLIpU1JG0ZyPVJE7/pWktRxc/gUqKgyVQOtZVcZMMxUlqw3pvHdRBU5EEbIBO4CktpG3t8IpLeNOzM+fsSN5DkikmosPY75Wy8hS2duv0Z+te7wfaXlT2Nu3BSvoalsJE3xnTH81vG49UVVtzAGjbRH6cq90TxGvdE8RoW0Q7M6Cqu5VA9kVrNLvC5DvNRWEa75CWPIUqqgyVQB5bVzarMCy7n7++mUoxVhkRtW9tPdypBbRNJI3BVFYf0FdlWTErnQP24uP5JqLojgUYyNqznvZ2q46GYLKDq0khPejk/8ArOsU6HX1irTWre8xDeQBk4/FHduPtALEKozJq3skjAaQaT/wOqv4NJdco3jj6bNtby3c8VtAulJIwVRWCYJb4PbKqqGnYDWSdpPcPLZ6V9HEmikxOxjAlQaUqL9Q7x5+2xgCrrmG8/p9OrIDAg8CKkTQd07iRsdBcPV3ucSkX9H9KP1O8naIBBBG410gsBh2K3MCDKNjrE/2tSLpuqDtIFKAqhRwA6y9GVw/mAdjohEEwK2I4u0jH/Lb6exgXljL2tEwP9pq0GdzF69bfHO4fyAGx0ScPgVpl9JkB/yO309cG6w9O0ROeZq3bQnib/UOsJyBJqV9ZI7952Ogl8DDdYezfEra1B5HcdvpTfC+xicoc44QIl/t4/z7LaUTRK3bwPr1d9PoJqlPxN/A2cOvpsNvIbyA/Eh3jvHaDWHYjbYnapdWzgg/qHap7js9JseTDLZreBwbuVSAB9AP1GiSSSeJ9ltcGB8/pPEUjq6hlOYPU3FykC97dgp3aRi7HMnaw3FbzCptdaSZeJDvVh5isO6aYdcqq3gNvJ25705ikxXDJAGS/gI/5FqfHMIt10pb+H0DBjyGdYr03XRaLCojnw1sg/6FTTSzyPNNIXkc5szHMnYhuJIDmh3doPCo7+F9z5oaE0R4SrzrWR/cXnWsj+4vOtZH9xeYrWx/cXmKe6gTjID6b6lxAnMQrl5mmYsSzEkn92//2Q=="] + * } */ export interface EmbedRequest { - /** An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality. */ + /** An array of strings for the model to embed. Maximum number of texts per call is `96`. */ texts?: string[]; /** * An array of image data URIs for the model to embed. Maximum number of images per call is `1`. * * The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB. + * + * Images are only supported with Embed v3.0 and newer models. */ images?: string[]; + /** ID of one of the available [Embedding models](https://docs.cohere.com/docs/cohere-embed). */ + model?: string; + input_type?: Cohere.EmbedInputType; /** - * Defaults to embed-english-v2.0 - * - * The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID. - * - * Available models and corresponding embedding dimensions: - * - * * `embed-english-v3.0` 1024 - * * `embed-multilingual-v3.0` 1024 - * * `embed-english-light-v3.0` 384 - * * `embed-multilingual-light-v3.0` 384 + * Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. * - * * `embed-english-v2.0` 4096 - * * `embed-english-light-v2.0` 1024 - * * `embed-multilingual-v2.0` 768 + * * `"float"`: Use this when you want to get back the default float embeddings. Supported with all Embed models. + * * `"int8"`: Use this when you want to get back signed int8 embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models. */ - model?: string; - inputType?: Cohere.EmbedInputType; + embedding_types?: Cohere.EmbeddingType[]; /** - * Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. * - * * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - embeddingTypes?: Cohere.EmbeddingType[]; + truncate?: EmbedRequest.Truncate; +} + +export namespace EmbedRequest { /** * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. * @@ -52,5 +62,10 @@ export interface EmbedRequest { * * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - truncate?: Cohere.EmbedRequestTruncate; + export type Truncate = "NONE" | "START" | "END"; + export const Truncate = { + None: "NONE", + Start: "START", + End: "END", + } as const; } diff --git a/src/api/client/requests/GenerateRequest.ts b/src/api/client/requests/GenerateRequest.ts index a73c8416..1bfeb095 100644 --- a/src/api/client/requests/GenerateRequest.ts +++ b/src/api/client/requests/GenerateRequest.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; - /** * @example * { @@ -14,7 +12,6 @@ export interface GenerateRequest { /** * The input text that serves as the starting point for generating the response. * Note: The prompt will be pre-processed and modified before reaching the model. - * */ prompt: string; /** @@ -22,20 +19,16 @@ export interface GenerateRequest { * Smaller, "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID. */ model?: string; - /** - * The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. - * - */ - numGenerations?: number; + /** The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. */ + num_generations?: number; /** * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. * * This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details. * * Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt. - * */ - maxTokens?: number; + max_tokens?: number; /** * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. * @@ -43,11 +36,10 @@ export interface GenerateRequest { * * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - truncate?: Cohere.GenerateRequestTruncate; + truncate?: GenerateRequest.Truncate; /** * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details. * Defaults to `0.75`, min value of `0.0`, max value of `5.0`. - * */ temperature?: number; /** @@ -56,47 +48,41 @@ export interface GenerateRequest { * seed and parameters should return the same result. However, * determinism cannot be totally guaranteed. * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ seed?: number; /** * Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate). * When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. - * */ preset?: string; /** The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text. */ - endSequences?: string[]; + end_sequences?: string[]; /** The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text. */ - stopSequences?: string[]; + stop_sequences?: string[]; /** * Ensures only the top `k` most likely tokens are considered for generation at each step. * Defaults to `0`, min value of `0`, max value of `500`. - * */ k?: number; /** * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - * */ p?: number; /** * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. * * Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. * * Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - * */ - presencePenalty?: number; + presence_penalty?: number; /** * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. * @@ -104,7 +90,36 @@ export interface GenerateRequest { * * WARNING: `ALL` is deprecated, and will be removed in a future release. */ - returnLikelihoods?: Cohere.GenerateRequestReturnLikelihoods; + return_likelihoods?: GenerateRequest.ReturnLikelihoods; /** When enabled, the user's prompt will be sent to the model without any pre-processing. */ - rawPrompting?: boolean; + raw_prompting?: boolean; +} + +export namespace GenerateRequest { + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + export type Truncate = "NONE" | "START" | "END"; + export const Truncate = { + None: "NONE", + Start: "START", + End: "END", + } as const; + /** + * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * WARNING: `ALL` is deprecated, and will be removed in a future release. + */ + export type ReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; + export const ReturnLikelihoods = { + Generation: "GENERATION", + All: "ALL", + None: "NONE", + } as const; } diff --git a/src/api/client/requests/GenerateStreamRequest.ts b/src/api/client/requests/GenerateStreamRequest.ts index 4d2b3f97..638d6692 100644 --- a/src/api/client/requests/GenerateStreamRequest.ts +++ b/src/api/client/requests/GenerateStreamRequest.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; - /** * @example * { @@ -14,7 +12,6 @@ export interface GenerateStreamRequest { /** * The input text that serves as the starting point for generating the response. * Note: The prompt will be pre-processed and modified before reaching the model. - * */ prompt: string; /** @@ -22,20 +19,16 @@ export interface GenerateStreamRequest { * Smaller, "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID. */ model?: string; - /** - * The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. - * - */ - numGenerations?: number; + /** The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. */ + num_generations?: number; /** * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. * * This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See [BPE Tokens](/bpe-tokens-wiki) for more details. * * Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt. - * */ - maxTokens?: number; + max_tokens?: number; /** * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. * @@ -43,11 +36,10 @@ export interface GenerateStreamRequest { * * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - truncate?: Cohere.GenerateStreamRequestTruncate; + truncate?: GenerateStreamRequest.Truncate; /** * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details. * Defaults to `0.75`, min value of `0.0`, max value of `5.0`. - * */ temperature?: number; /** @@ -56,47 +48,41 @@ export interface GenerateStreamRequest { * seed and parameters should return the same result. However, * determinism cannot be totally guaranteed. * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - * */ seed?: number; /** * Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate). * When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. - * */ preset?: string; /** The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text. */ - endSequences?: string[]; + end_sequences?: string[]; /** The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text. */ - stopSequences?: string[]; + stop_sequences?: string[]; /** * Ensures only the top `k` most likely tokens are considered for generation at each step. * Defaults to `0`, min value of `0`, max value of `500`. - * */ k?: number; /** * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - * */ p?: number; /** * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. * * Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * * Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. * * Using `frequency_penalty` in combination with `presence_penalty` is not supported on newer models. - * */ - presencePenalty?: number; + presence_penalty?: number; /** * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. * @@ -104,7 +90,36 @@ export interface GenerateStreamRequest { * * WARNING: `ALL` is deprecated, and will be removed in a future release. */ - returnLikelihoods?: Cohere.GenerateStreamRequestReturnLikelihoods; + return_likelihoods?: GenerateStreamRequest.ReturnLikelihoods; /** When enabled, the user's prompt will be sent to the model without any pre-processing. */ - rawPrompting?: boolean; + raw_prompting?: boolean; +} + +export namespace GenerateStreamRequest { + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + export type Truncate = "NONE" | "START" | "END"; + export const Truncate = { + None: "NONE", + Start: "START", + End: "END", + } as const; + /** + * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * WARNING: `ALL` is deprecated, and will be removed in a future release. + */ + export type ReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; + export const ReturnLikelihoods = { + Generation: "GENERATION", + All: "ALL", + None: "NONE", + } as const; } diff --git a/src/api/client/requests/RerankRequest.ts b/src/api/client/requests/RerankRequest.ts index 92e36c54..cdb53fd8 100644 --- a/src/api/client/requests/RerankRequest.ts +++ b/src/api/client/requests/RerankRequest.ts @@ -2,13 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; +import * as Cohere from "../../index.js"; /** * @example * { - * query: "query", - * documents: ["documents"] + * documents: [{ + * "text": "Carson City is the capital city of the American state of Nevada." + * }, { + * "text": "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan." + * }, { + * "text": "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages." + * }, { + * "text": "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district." + * }, { + * "text": "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states." + * }], + * query: "What is the capital of the United States?", + * top_n: 3, + * model: "rerank-v3.5" * } */ export interface RerankRequest { @@ -24,16 +36,24 @@ export interface RerankRequest { * * We recommend a maximum of 1,000 documents for optimal endpoint performance. */ - documents: Cohere.RerankRequestDocumentsItem[]; + documents: RerankRequest.Documents.Item[]; /** The number of most relevant documents or indices to return, defaults to the length of the documents */ - topN?: number; + top_n?: number; /** If a JSON object is provided, you can specify which keys you would like to have considered for reranking. The model will rerank based on order of the fields passed in (i.e. rank_fields=['title','author','text'] will rerank using the values in title, author, text sequentially. If the length of title, author, and text exceeds the context length of the model, the chunking will not re-consider earlier fields). If not provided, the model will use the default text field for ranking. */ - rankFields?: string[]; + rank_fields?: string[]; /** * - If false, returns results without the doc text - the api will return a list of {index, relevance score} where index is inferred from the list passed into the request. * - If true, returns results with the doc text passed in - the api will return an ordered list of {index, text, relevance score} where index + text refers to the list passed into the request. */ - returnDocuments?: boolean; + return_documents?: boolean; /** The maximum number of chunks to produce internally from a document */ - maxChunksPerDoc?: number; + max_chunks_per_doc?: number; +} + +export namespace RerankRequest { + export type Documents = Documents.Item[]; + + export namespace Documents { + export type Item = string | Cohere.RerankDocument; + } } diff --git a/src/api/client/requests/SummarizeRequest.ts b/src/api/client/requests/SummarizeRequest.ts index ac448421..3c35ae48 100644 --- a/src/api/client/requests/SummarizeRequest.ts +++ b/src/api/client/requests/SummarizeRequest.ts @@ -2,27 +2,54 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../index"; - /** * @example * { - * text: "text" + * text: "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. It may be made from milk or cream and is flavoured with a sweetener, either sugar or an alternative, and a spice, such as cocoa or vanilla, or with fruit such as strawberries or peaches. It can also be made by whisking a flavored cream base and liquid nitrogen together. Food coloring is sometimes added, in addition to stabilizers. The mixture is cooled below the freezing point of water and stirred to incorporate air spaces and to prevent detectable ice crystals from forming. The result is a smooth, semi-solid foam that is solid at very low temperatures (below 2 \u00B0C or 35 \u00B0F). It becomes more malleable as its temperature increases.\n\nThe meaning of the name \"ice cream\" varies from one country to another. In some countries, such as the United States, \"ice cream\" applies only to a specific variety, and most governments regulate the commercial use of the various terms according to the relative quantities of the main ingredients, notably the amount of cream. Products that do not meet the criteria to be called ice cream are sometimes labelled \"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, one word is used fo\r all variants. Analogues made from dairy alternatives, such as goat's or sheep's milk, or milk substitutes (e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are lactose intolerant, allergic to dairy protein or vegan." * } */ export interface SummarizeRequest { /** The text to generate a summary for. Can be up to 100,000 characters long. Currently the only supported language is English. */ text: string; /** One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. */ - length?: Cohere.SummarizeRequestLength; + length?: SummarizeRequest.Length; /** One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. */ - format?: Cohere.SummarizeRequestFormat; + format?: SummarizeRequest.Format; /** The identifier of the model to generate the summary with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). Smaller, "light" models are faster, while larger models will perform better. */ model?: string; /** One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. */ - extractiveness?: Cohere.SummarizeRequestExtractiveness; + extractiveness?: SummarizeRequest.Extractiveness; /** Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1. */ temperature?: number; /** A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". Eg. "focusing on the next steps" or "written by Yoda" */ - additionalCommand?: string; + additional_command?: string; +} + +export namespace SummarizeRequest { + /** + * One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. + */ + export type Length = "short" | "medium" | "long"; + export const Length = { + Short: "short", + Medium: "medium", + Long: "long", + } as const; + /** + * One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. + */ + export type Format = "paragraph" | "bullets"; + export const Format = { + Paragraph: "paragraph", + Bullets: "bullets", + } as const; + /** + * One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. + */ + export type Extractiveness = "low" | "medium" | "high"; + export const Extractiveness = { + Low: "low", + Medium: "medium", + High: "high", + } as const; } diff --git a/src/api/client/requests/TokenizeRequest.ts b/src/api/client/requests/TokenizeRequest.ts index 25a8c97b..aafc5e08 100644 --- a/src/api/client/requests/TokenizeRequest.ts +++ b/src/api/client/requests/TokenizeRequest.ts @@ -12,6 +12,6 @@ export interface TokenizeRequest { /** The string to be tokenized, the minimum text length is 1 character, and the maximum text length is 65536 characters. */ text: string; - /** An optional parameter to provide the model name. This will ensure that the tokenization uses the tokenizer used by that model. */ + /** The input will be tokenized by the tokenizer that is used by this model. */ model: string; } diff --git a/src/api/client/requests/index.ts b/src/api/client/requests/index.ts index 14b7ebaf..ad09c299 100644 --- a/src/api/client/requests/index.ts +++ b/src/api/client/requests/index.ts @@ -1,10 +1,10 @@ -export { type ChatStreamRequest } from "./ChatStreamRequest"; -export { type ChatRequest } from "./ChatRequest"; -export { type GenerateStreamRequest } from "./GenerateStreamRequest"; -export { type GenerateRequest } from "./GenerateRequest"; -export { type EmbedRequest } from "./EmbedRequest"; -export { type RerankRequest } from "./RerankRequest"; -export { type ClassifyRequest } from "./ClassifyRequest"; -export { type SummarizeRequest } from "./SummarizeRequest"; -export { type TokenizeRequest } from "./TokenizeRequest"; -export { type DetokenizeRequest } from "./DetokenizeRequest"; +export { type ChatStreamRequest } from "./ChatStreamRequest.js"; +export { type ChatRequest } from "./ChatRequest.js"; +export { type GenerateStreamRequest } from "./GenerateStreamRequest.js"; +export { type GenerateRequest } from "./GenerateRequest.js"; +export { type EmbedRequest } from "./EmbedRequest.js"; +export { type RerankRequest } from "./RerankRequest.js"; +export { type ClassifyRequest } from "./ClassifyRequest.js"; +export { type SummarizeRequest } from "./SummarizeRequest.js"; +export { type TokenizeRequest } from "./TokenizeRequest.js"; +export { type DetokenizeRequest } from "./DetokenizeRequest.js"; diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 64469b5c..10ac37d9 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class BadRequestError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "BadRequestError", statusCode: 400, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, BadRequestError.prototype); } diff --git a/src/api/errors/ClientClosedRequestError.ts b/src/api/errors/ClientClosedRequestError.ts index 1c6f3d52..503b755f 100644 --- a/src/api/errors/ClientClosedRequestError.ts +++ b/src/api/errors/ClientClosedRequestError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class ClientClosedRequestError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "ClientClosedRequestError", statusCode: 499, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, ClientClosedRequestError.prototype); } diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts index 12bf8f52..8114a57d 100644 --- a/src/api/errors/ForbiddenError.ts +++ b/src/api/errors/ForbiddenError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class ForbiddenError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "ForbiddenError", statusCode: 403, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, ForbiddenError.prototype); } diff --git a/src/api/errors/GatewayTimeoutError.ts b/src/api/errors/GatewayTimeoutError.ts index 2cf3fe7a..8bd82961 100644 --- a/src/api/errors/GatewayTimeoutError.ts +++ b/src/api/errors/GatewayTimeoutError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class GatewayTimeoutError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "GatewayTimeoutError", statusCode: 504, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, GatewayTimeoutError.prototype); } diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts index c9be916a..57b2ba5f 100644 --- a/src/api/errors/InternalServerError.ts +++ b/src/api/errors/InternalServerError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class InternalServerError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "InternalServerError", statusCode: 500, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, InternalServerError.prototype); } diff --git a/src/api/errors/InvalidTokenError.ts b/src/api/errors/InvalidTokenError.ts index e3f4cfd4..1d32885a 100644 --- a/src/api/errors/InvalidTokenError.ts +++ b/src/api/errors/InvalidTokenError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class InvalidTokenError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "InvalidTokenError", statusCode: 498, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, InvalidTokenError.prototype); } diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts index eb529054..5e23ffc4 100644 --- a/src/api/errors/NotFoundError.ts +++ b/src/api/errors/NotFoundError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class NotFoundError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "NotFoundError", statusCode: 404, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, NotFoundError.prototype); } diff --git a/src/api/errors/NotImplementedError.ts b/src/api/errors/NotImplementedError.ts index e0f57e30..0623717d 100644 --- a/src/api/errors/NotImplementedError.ts +++ b/src/api/errors/NotImplementedError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class NotImplementedError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "NotImplementedError", statusCode: 501, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, NotImplementedError.prototype); } diff --git a/src/api/errors/ServiceUnavailableError.ts b/src/api/errors/ServiceUnavailableError.ts index ef586f19..1b3bd30a 100644 --- a/src/api/errors/ServiceUnavailableError.ts +++ b/src/api/errors/ServiceUnavailableError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class ServiceUnavailableError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "ServiceUnavailableError", statusCode: 503, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, ServiceUnavailableError.prototype); } diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts index 525080b5..6dda331f 100644 --- a/src/api/errors/TooManyRequestsError.ts +++ b/src/api/errors/TooManyRequestsError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class TooManyRequestsError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "TooManyRequestsError", statusCode: 429, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, TooManyRequestsError.prototype); } diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts index 3f25bab2..cf790204 100644 --- a/src/api/errors/UnauthorizedError.ts +++ b/src/api/errors/UnauthorizedError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class UnauthorizedError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "UnauthorizedError", statusCode: 401, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, UnauthorizedError.prototype); } diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts index 5bde21b6..03e0d0a6 100644 --- a/src/api/errors/UnprocessableEntityError.ts +++ b/src/api/errors/UnprocessableEntityError.ts @@ -2,14 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors/index"; +import * as errors from "../../errors/index.js"; +import * as core from "../../core/index.js"; export class UnprocessableEntityError extends errors.CohereError { - constructor(body?: unknown) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "UnprocessableEntityError", statusCode: 422, body: body, + rawResponse: rawResponse, }); Object.setPrototypeOf(this, UnprocessableEntityError.prototype); } diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts index 651fac27..d1e29d1a 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1,12 +1,12 @@ -export * from "./BadRequestError"; -export * from "./UnauthorizedError"; -export * from "./ForbiddenError"; -export * from "./NotFoundError"; -export * from "./UnprocessableEntityError"; -export * from "./TooManyRequestsError"; -export * from "./InvalidTokenError"; -export * from "./ClientClosedRequestError"; -export * from "./InternalServerError"; -export * from "./NotImplementedError"; -export * from "./ServiceUnavailableError"; -export * from "./GatewayTimeoutError"; +export * from "./BadRequestError.js"; +export * from "./UnauthorizedError.js"; +export * from "./ForbiddenError.js"; +export * from "./NotFoundError.js"; +export * from "./UnprocessableEntityError.js"; +export * from "./TooManyRequestsError.js"; +export * from "./InvalidTokenError.js"; +export * from "./ClientClosedRequestError.js"; +export * from "./InternalServerError.js"; +export * from "./NotImplementedError.js"; +export * from "./ServiceUnavailableError.js"; +export * from "./GatewayTimeoutError.js"; diff --git a/src/api/index.ts b/src/api/index.ts index d5c609c4..e5836d1b 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,4 +1,4 @@ -export * from "./resources"; -export * from "./types"; -export * from "./errors"; -export * from "./client"; +export * from "./resources/index.js"; +export * from "./types/index.js"; +export * from "./errors/index.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/connectors/client/Client.ts b/src/api/resources/connectors/client/Client.ts index 3e2e97a9..43b09f2d 100644 --- a/src/api/resources/connectors/client/Client.ts +++ b/src/api/resources/connectors/client/Client.ts @@ -2,23 +2,24 @@ * 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 environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization/index"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; export declare namespace Connectors { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -57,12 +58,19 @@ export class Connectors { * @example * await client.connectors.list() */ - public async list( + public list( request: Cohere.ConnectorsListRequest = {}, - requestOptions?: Connectors.RequestOptions - ): Promise { + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Cohere.ConnectorsListRequest = {}, + requestOptions?: Connectors.RequestOptions, + ): Promise> { const { limit, offset } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (limit != null) { _queryParams["limit"] = limit.toString(); } @@ -73,8 +81,10 @@ export class Connectors { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/connectors" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/connectors", ), method: "GET", headers: { @@ -85,8 +95,8 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -99,45 +109,40 @@ export class Connectors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.ListConnectorsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.ListConnectorsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -147,12 +152,14 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -182,14 +189,23 @@ export class Connectors { * url: "url" * }) */ - public async create( + public create( + request: Cohere.CreateConnectorRequest, + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Cohere.CreateConnectorRequest, - requestOptions?: Connectors.RequestOptions - ): Promise { + requestOptions?: Connectors.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/connectors" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/connectors", ), method: "POST", headers: { @@ -200,63 +216,54 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.CreateConnectorRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateConnectorResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.CreateConnectorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -266,12 +273,14 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -298,11 +307,23 @@ export class Connectors { * @example * await client.connectors.get("id") */ - public async get(id: string, requestOptions?: Connectors.RequestOptions): Promise { + public get( + id: string, + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions)); + } + + private async __get( + id: string, + requestOptions?: Connectors.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/connectors/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/connectors/${encodeURIComponent(id)}`, ), method: "GET", headers: { @@ -313,8 +334,8 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -326,45 +347,40 @@ export class Connectors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.GetConnectorResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.GetConnectorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -374,12 +390,14 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -406,14 +424,23 @@ export class Connectors { * @example * await client.connectors.delete("id") */ - public async delete( + public delete( id: string, - requestOptions?: Connectors.RequestOptions - ): Promise { + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions)); + } + + private async __delete( + id: string, + requestOptions?: Connectors.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/connectors/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/connectors/${encodeURIComponent(id)}`, ), method: "DELETE", headers: { @@ -424,8 +451,8 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -437,45 +464,40 @@ export class Connectors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DeleteConnectorResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DeleteConnectorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -485,12 +507,14 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/connectors/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -518,15 +542,25 @@ export class Connectors { * @example * await client.connectors.update("id") */ - public async update( + public update( + id: string, + request: Cohere.UpdateConnectorRequest = {}, + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions)); + } + + private async __update( id: string, request: Cohere.UpdateConnectorRequest = {}, - requestOptions?: Connectors.RequestOptions - ): Promise { + requestOptions?: Connectors.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/connectors/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/connectors/${encodeURIComponent(id)}`, ), method: "PATCH", headers: { @@ -537,63 +571,54 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.UpdateConnectorRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.UpdateConnectorResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.UpdateConnectorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -603,12 +628,14 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/connectors/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -636,21 +663,31 @@ export class Connectors { * @example * await client.connectors.oAuthAuthorize("id") */ - public async oAuthAuthorize( + public oAuthAuthorize( + id: string, + request: Cohere.ConnectorsOAuthAuthorizeRequest = {}, + requestOptions?: Connectors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__oAuthAuthorize(id, request, requestOptions)); + } + + private async __oAuthAuthorize( id: string, request: Cohere.ConnectorsOAuthAuthorizeRequest = {}, - requestOptions?: Connectors.RequestOptions - ): Promise { - const { afterTokenRedirect } = request; - const _queryParams: Record = {}; + requestOptions?: Connectors.RequestOptions, + ): Promise> { + const { after_token_redirect: afterTokenRedirect } = request; + const _queryParams: Record = {}; if (afterTokenRedirect != null) { _queryParams["after_token_redirect"] = afterTokenRedirect; } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/connectors/${encodeURIComponent(id)}/oauth/authorize` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/connectors/${encodeURIComponent(id)}/oauth/authorize`, ), method: "POST", headers: { @@ -661,8 +698,8 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -675,45 +712,40 @@ export class Connectors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.OAuthAuthorizeResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.OAuthAuthorizeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -723,14 +755,16 @@ export class Connectors { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize." + "Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -739,7 +773,8 @@ export class Connectors { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/connectors/client/index.ts b/src/api/resources/connectors/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/connectors/client/index.ts +++ b/src/api/resources/connectors/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts index d3a9c108..d04c590b 100644 --- a/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts +++ b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts @@ -10,5 +10,5 @@ export interface ConnectorsOAuthAuthorizeRequest { /** * The URL to redirect to after the connector has been authorized. */ - afterTokenRedirect?: string; + after_token_redirect?: string; } diff --git a/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts index 76ce2e4b..dfd1d4ce 100644 --- a/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts +++ b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example @@ -25,7 +25,7 @@ export interface CreateConnectorRequest { /** Whether the connector is active or not. */ active?: boolean; /** Whether a chat request should continue or not if the request to this connector fails. */ - continueOnFailure?: boolean; + continue_on_failure?: boolean; /** The service to service authentication configuration for the connector. Cannot be specified if oauth is specified. */ - serviceAuth?: Cohere.CreateConnectorServiceAuth; + service_auth?: Cohere.CreateConnectorServiceAuth; } diff --git a/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts index efee33f8..f4479d90 100644 --- a/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts +++ b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example @@ -18,7 +18,7 @@ export interface UpdateConnectorRequest { /** The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified. */ oauth?: Cohere.CreateConnectorOAuth; active?: boolean; - continueOnFailure?: boolean; + continue_on_failure?: boolean; /** The service to service authentication configuration for the connector. Cannot be specified if oauth is specified. */ - serviceAuth?: Cohere.CreateConnectorServiceAuth; + service_auth?: Cohere.CreateConnectorServiceAuth; } diff --git a/src/api/resources/connectors/client/requests/index.ts b/src/api/resources/connectors/client/requests/index.ts index 8c4fc9bd..0a4443e3 100644 --- a/src/api/resources/connectors/client/requests/index.ts +++ b/src/api/resources/connectors/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ConnectorsListRequest } from "./ConnectorsListRequest"; -export { type CreateConnectorRequest } from "./CreateConnectorRequest"; -export { type UpdateConnectorRequest } from "./UpdateConnectorRequest"; -export { type ConnectorsOAuthAuthorizeRequest } from "./ConnectorsOAuthAuthorizeRequest"; +export { type ConnectorsListRequest } from "./ConnectorsListRequest.js"; +export { type CreateConnectorRequest } from "./CreateConnectorRequest.js"; +export { type UpdateConnectorRequest } from "./UpdateConnectorRequest.js"; +export { type ConnectorsOAuthAuthorizeRequest } from "./ConnectorsOAuthAuthorizeRequest.js"; diff --git a/src/api/resources/connectors/index.ts b/src/api/resources/connectors/index.ts index 5ec76921..914b8c3c 100644 --- a/src/api/resources/connectors/index.ts +++ b/src/api/resources/connectors/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/datasets/client/Client.ts b/src/api/resources/datasets/client/Client.ts index 38540f2f..139430c6 100644 --- a/src/api/resources/datasets/client/Client.ts +++ b/src/api/resources/datasets/client/Client.ts @@ -2,25 +2,25 @@ * 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 environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization/index"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; import * as fs from "fs"; -import { Blob } from "buffer"; export declare namespace Datasets { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -59,22 +59,29 @@ export class Datasets { * @example * await client.datasets.list() */ - public async list( + public list( request: Cohere.DatasetsListRequest = {}, - requestOptions?: Datasets.RequestOptions - ): Promise { + requestOptions?: Datasets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Cohere.DatasetsListRequest = {}, + requestOptions?: Datasets.RequestOptions, + ): Promise> { const { datasetType, before, after, limit, offset, validationStatus } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (datasetType != null) { _queryParams["datasetType"] = datasetType; } if (before != null) { - _queryParams["before"] = before.toISOString(); + _queryParams["before"] = before; } if (after != null) { - _queryParams["after"] = after.toISOString(); + _queryParams["after"] = after; } if (limit != null) { @@ -91,8 +98,10 @@ export class Datasets { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/datasets" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/datasets", ), method: "GET", headers: { @@ -103,8 +112,8 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -117,45 +126,40 @@ export class Datasets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DatasetsListResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DatasetsListResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -165,12 +169,14 @@ export class Datasets { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -178,8 +184,6 @@ export class Datasets { /** * Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information. * - * @param {File | fs.ReadStream | Blob} data - * @param {File | fs.ReadStream | Blob | undefined} evalData * @param {Cohere.DatasetsCreateRequest} request * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. * @@ -197,67 +201,71 @@ export class Datasets { * @throws {@link Cohere.GatewayTimeoutError} * * @example - * await client.datasets.create(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), { + * await client.datasets.create({ + * data: fs.createReadStream("/path/to/your/file"), * name: "name", * type: "embed-input" * }) */ - public async create( - data: File | fs.ReadStream | Blob, - evalData: File | fs.ReadStream | Blob | undefined, + public create( + request: Cohere.DatasetsCreateRequest, + requestOptions?: Datasets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Cohere.DatasetsCreateRequest, - requestOptions?: Datasets.RequestOptions - ): Promise { - const _queryParams: Record = {}; + requestOptions?: Datasets.RequestOptions, + ): Promise> { + const _queryParams: Record = {}; _queryParams["name"] = request.name; _queryParams["type"] = request.type; - if (request.keepOriginalFile != null) { - _queryParams["keep_original_file"] = request.keepOriginalFile.toString(); + if (request.keep_original_file != null) { + _queryParams["keep_original_file"] = request.keep_original_file.toString(); } - if (request.skipMalformedInput != null) { - _queryParams["skip_malformed_input"] = request.skipMalformedInput.toString(); + if (request.skip_malformed_input != null) { + _queryParams["skip_malformed_input"] = request.skip_malformed_input.toString(); } - if (request.keepFields != null) { - if (Array.isArray(request.keepFields)) { - _queryParams["keep_fields"] = request.keepFields.map((item) => item); + if (request.keep_fields != null) { + if (Array.isArray(request.keep_fields)) { + _queryParams["keep_fields"] = request.keep_fields.map((item) => item); } else { - _queryParams["keep_fields"] = request.keepFields; + _queryParams["keep_fields"] = request.keep_fields; } } - if (request.optionalFields != null) { - if (Array.isArray(request.optionalFields)) { - _queryParams["optional_fields"] = request.optionalFields.map((item) => item); + if (request.optional_fields != null) { + if (Array.isArray(request.optional_fields)) { + _queryParams["optional_fields"] = request.optional_fields.map((item) => item); } else { - _queryParams["optional_fields"] = request.optionalFields; + _queryParams["optional_fields"] = request.optional_fields; } } - if (request.textSeparator != null) { - _queryParams["text_separator"] = request.textSeparator; + if (request.text_separator != null) { + _queryParams["text_separator"] = request.text_separator; } - if (request.csvDelimiter != null) { - _queryParams["csv_delimiter"] = request.csvDelimiter; - } - - if (request.dryRun != null) { - _queryParams["dry_run"] = request.dryRun.toString(); + if (request.csv_delimiter != null) { + _queryParams["csv_delimiter"] = request.csv_delimiter; } const _request = await core.newFormData(); - await _request.appendFile("data", data); - if (evalData != null) { - await _request.appendFile("eval_data", evalData); + await _request.appendFile("data", request.data); + if (request.eval_data != null) { + await _request.appendFile("eval_data", request.eval_data); } const _maybeEncodedRequest = await _request.getRequest(); const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/datasets" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/datasets", ), method: "POST", headers: { @@ -268,8 +276,8 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ..._maybeEncodedRequest.headers, @@ -284,45 +292,40 @@ export class Datasets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DatasetsCreateResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DatasetsCreateResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -332,12 +335,14 @@ export class Datasets { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/datasets."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -363,11 +368,21 @@ export class Datasets { * @example * await client.datasets.getUsage() */ - public async getUsage(requestOptions?: Datasets.RequestOptions): Promise { + public getUsage( + requestOptions?: Datasets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getUsage(requestOptions)); + } + + private async __getUsage( + requestOptions?: Datasets.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/datasets/usage" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/datasets/usage", ), method: "GET", headers: { @@ -378,8 +393,8 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -391,45 +406,40 @@ export class Datasets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DatasetsGetUsageResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DatasetsGetUsageResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -439,12 +449,14 @@ export class Datasets { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/usage."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -471,11 +483,23 @@ export class Datasets { * @example * await client.datasets.get("id") */ - public async get(id: string, requestOptions?: Datasets.RequestOptions): Promise { + public get( + id: string, + requestOptions?: Datasets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions)); + } + + private async __get( + id: string, + requestOptions?: Datasets.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/datasets/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/datasets/${encodeURIComponent(id)}`, ), method: "GET", headers: { @@ -486,8 +510,8 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -499,45 +523,40 @@ export class Datasets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DatasetsGetResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.DatasetsGetResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -547,12 +566,14 @@ export class Datasets { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -579,11 +600,23 @@ export class Datasets { * @example * await client.datasets.delete("id") */ - public async delete(id: string, requestOptions?: Datasets.RequestOptions): Promise> { + public delete( + id: string, + requestOptions?: Datasets.RequestOptions, + ): core.HttpResponsePromise> { + return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions)); + } + + private async __delete( + id: string, + requestOptions?: Datasets.RequestOptions, + ): Promise>> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/datasets/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/datasets/${encodeURIComponent(id)}`, ), method: "DELETE", headers: { @@ -594,8 +627,8 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -607,45 +640,40 @@ export class Datasets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.datasets.delete.Response.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Record, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -655,12 +683,14 @@ export class Datasets { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/datasets/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -669,7 +699,8 @@ export class Datasets { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/datasets/client/index.ts b/src/api/resources/datasets/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/datasets/client/index.ts +++ b/src/api/resources/datasets/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts index 21f4845c..72f4c275 100644 --- a/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts +++ b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts @@ -2,11 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as fs from "fs"; +import * as Cohere from "../../../../index.js"; /** * @example * { + * data: fs.createReadStream("/path/to/your/file"), * name: "name", * type: "embed-input" * } @@ -23,29 +25,27 @@ export interface DatasetsCreateRequest { /** * Indicates if the original file should be stored. */ - keepOriginalFile?: boolean; + keep_original_file?: boolean; /** * Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field. */ - skipMalformedInput?: boolean; + skip_malformed_input?: boolean; /** * List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail. */ - keepFields?: string | string[]; + keep_fields?: string | string[]; /** * List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass. */ - optionalFields?: string | string[]; + optional_fields?: string | string[]; /** * Raw .txt uploads will be split into entries using the text_separator value. */ - textSeparator?: string; + text_separator?: string; /** * The delimiter used for .csv uploads. */ - csvDelimiter?: string; - /** - * flag to enable dry_run mode - */ - dryRun?: boolean; + csv_delimiter?: string; + data: File | fs.ReadStream | Blob; + eval_data?: File | fs.ReadStream | Blob | undefined; } diff --git a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts index a54317f5..1ce49a14 100644 --- a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts +++ b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example @@ -16,11 +16,11 @@ export interface DatasetsListRequest { /** * optional filter before a date */ - before?: Date; + before?: string; /** * optional filter after a date */ - after?: Date; + after?: string; /** * optional limit to number of results */ diff --git a/src/api/resources/datasets/client/requests/index.ts b/src/api/resources/datasets/client/requests/index.ts index 4b9a3f4f..95a5d625 100644 --- a/src/api/resources/datasets/client/requests/index.ts +++ b/src/api/resources/datasets/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type DatasetsListRequest } from "./DatasetsListRequest"; -export { type DatasetsCreateRequest } from "./DatasetsCreateRequest"; +export { type DatasetsListRequest } from "./DatasetsListRequest.js"; +export { type DatasetsCreateRequest } from "./DatasetsCreateRequest.js"; diff --git a/src/api/resources/datasets/index.ts b/src/api/resources/datasets/index.ts index c9240f83..f095e147 100644 --- a/src/api/resources/datasets/index.ts +++ b/src/api/resources/datasets/index.ts @@ -1,2 +1,2 @@ -export * from "./types"; -export * from "./client"; +export * from "./types/index.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts b/src/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts deleted file mode 100644 index adcc1d6c..00000000 --- a/src/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * the underlying files that make up the dataset - */ -export interface DatasetsCreateResponseDatasetPartsItem { - /** the name of the dataset part */ - name?: string; - /** the number of rows in the dataset part */ - numRows?: number; - samples?: string[]; - /** the kind of dataset part */ - partKind?: string; -} diff --git a/src/api/resources/datasets/types/DatasetsGetResponse.ts b/src/api/resources/datasets/types/DatasetsGetResponse.ts index 67e51fb0..dc9ce00c 100644 --- a/src/api/resources/datasets/types/DatasetsGetResponse.ts +++ b/src/api/resources/datasets/types/DatasetsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../index"; +import * as Cohere from "../../../index.js"; export interface DatasetsGetResponse { dataset: Cohere.Dataset; diff --git a/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts b/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts index e36b1385..77ac1049 100644 --- a/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts +++ b/src/api/resources/datasets/types/DatasetsGetUsageResponse.ts @@ -4,5 +4,5 @@ export interface DatasetsGetUsageResponse { /** The total number of bytes used by the organization. */ - organizationUsage?: number; + organization_usage?: number; } diff --git a/src/api/resources/datasets/types/DatasetsListResponse.ts b/src/api/resources/datasets/types/DatasetsListResponse.ts index 109999b3..100aa54f 100644 --- a/src/api/resources/datasets/types/DatasetsListResponse.ts +++ b/src/api/resources/datasets/types/DatasetsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../index"; +import * as Cohere from "../../../index.js"; export interface DatasetsListResponse { datasets?: Cohere.Dataset[]; diff --git a/src/api/resources/datasets/types/index.ts b/src/api/resources/datasets/types/index.ts index cc2e2520..52e0d07e 100644 --- a/src/api/resources/datasets/types/index.ts +++ b/src/api/resources/datasets/types/index.ts @@ -1,5 +1,4 @@ -export * from "./DatasetsListResponse"; -export * from "./DatasetsCreateResponseDatasetPartsItem"; -export * from "./DatasetsCreateResponse"; -export * from "./DatasetsGetUsageResponse"; -export * from "./DatasetsGetResponse"; +export * from "./DatasetsListResponse.js"; +export * from "./DatasetsCreateResponse.js"; +export * from "./DatasetsGetUsageResponse.js"; +export * from "./DatasetsGetResponse.js"; diff --git a/src/api/resources/embedJobs/client/Client.ts b/src/api/resources/embedJobs/client/Client.ts index 84511ff1..be029a5c 100644 --- a/src/api/resources/embedJobs/client/Client.ts +++ b/src/api/resources/embedJobs/client/Client.ts @@ -2,23 +2,24 @@ * 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 environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization/index"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; export declare namespace EmbedJobs { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -56,11 +57,19 @@ export class EmbedJobs { * @example * await client.embedJobs.list() */ - public async list(requestOptions?: EmbedJobs.RequestOptions): Promise { + public list(requestOptions?: EmbedJobs.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); + } + + private async __list( + requestOptions?: EmbedJobs.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/embed-jobs" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/embed-jobs", ), method: "GET", headers: { @@ -71,8 +80,8 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -84,45 +93,40 @@ export class EmbedJobs { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.ListEmbedJobResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.ListEmbedJobResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -132,12 +136,14 @@ export class EmbedJobs { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -164,18 +170,27 @@ export class EmbedJobs { * @example * await client.embedJobs.create({ * model: "model", - * datasetId: "dataset_id", - * inputType: "search_document" + * dataset_id: "dataset_id", + * input_type: "search_document" * }) */ - public async create( + public create( + request: Cohere.CreateEmbedJobRequest, + requestOptions?: EmbedJobs.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Cohere.CreateEmbedJobRequest, - requestOptions?: EmbedJobs.RequestOptions - ): Promise { + requestOptions?: EmbedJobs.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/embed-jobs" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/embed-jobs", ), method: "POST", headers: { @@ -186,63 +201,54 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.CreateEmbedJobRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateEmbedJobResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.CreateEmbedJobResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -252,12 +258,14 @@ export class EmbedJobs { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -284,11 +292,20 @@ export class EmbedJobs { * @example * await client.embedJobs.get("id") */ - public async get(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { + public get(id: string, requestOptions?: EmbedJobs.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions)); + } + + private async __get( + id: string, + requestOptions?: EmbedJobs.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/embed-jobs/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/embed-jobs/${encodeURIComponent(id)}`, ), method: "GET", headers: { @@ -299,8 +316,8 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -312,45 +329,40 @@ export class EmbedJobs { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.EmbedJob.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.EmbedJob, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -360,12 +372,14 @@ export class EmbedJobs { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs/{id}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -392,11 +406,17 @@ export class EmbedJobs { * @example * await client.embedJobs.cancel("id") */ - public async cancel(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { + public cancel(id: string, requestOptions?: EmbedJobs.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(id, requestOptions)); + } + + private async __cancel(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/embed-jobs/${encodeURIComponent(id)}/cancel` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/embed-jobs/${encodeURIComponent(id)}/cancel`, ), method: "POST", headers: { @@ -407,8 +427,8 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -420,39 +440,40 @@ export class EmbedJobs { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return { data: undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -462,12 +483,14 @@ export class EmbedJobs { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs/{id}/cancel."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -476,7 +499,8 @@ export class EmbedJobs { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/embedJobs/client/index.ts b/src/api/resources/embedJobs/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/embedJobs/client/index.ts +++ b/src/api/resources/embedJobs/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts index 974b8509..afded216 100644 --- a/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts +++ b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example * { * model: "model", - * datasetId: "dataset_id", - * inputType: "search_document" + * dataset_id: "dataset_id", + * input_type: "search_document" * } */ export interface CreateEmbedJobRequest { @@ -22,29 +22,40 @@ export interface CreateEmbedJobRequest { * - `embed-multilingual-v3.0` : 1024 * - `embed-english-light-v3.0` : 384 * - `embed-multilingual-light-v3.0` : 384 - * */ model: string; /** ID of a [Dataset](https://docs.cohere.com/docs/datasets). The Dataset must be of type `embed-input` and must have a validation status `Validated` */ - datasetId: string; - inputType: Cohere.EmbedInputType; + dataset_id: string; + input_type: Cohere.EmbedInputType; /** The name of the embed job. */ name?: string; /** * Specifies the types of embeddings you want to get back. Not required and default is None, which returns the Embed Floats response type. Can be one or more of the following types. * * * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. + * * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for v3 and newer model versions. + * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for v3 and newer model versions. + * * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for v3 and newer model versions. + * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for v3 and newer model versions. */ - embeddingTypes?: Cohere.EmbeddingType[]; + embedding_types?: Cohere.EmbeddingType[]; /** * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. * * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + */ + truncate?: CreateEmbedJobRequest.Truncate; +} + +export namespace CreateEmbedJobRequest { + /** + * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. */ - truncate?: Cohere.CreateEmbedJobRequestTruncate; + export type Truncate = "START" | "END"; + export const Truncate = { + Start: "START", + End: "END", + } as const; } diff --git a/src/api/resources/embedJobs/client/requests/index.ts b/src/api/resources/embedJobs/client/requests/index.ts index 0ba0caa0..f76d6361 100644 --- a/src/api/resources/embedJobs/client/requests/index.ts +++ b/src/api/resources/embedJobs/client/requests/index.ts @@ -1 +1 @@ -export { type CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; +export { type CreateEmbedJobRequest } from "./CreateEmbedJobRequest.js"; diff --git a/src/api/resources/embedJobs/index.ts b/src/api/resources/embedJobs/index.ts index c9240f83..914b8c3c 100644 --- a/src/api/resources/embedJobs/index.ts +++ b/src/api/resources/embedJobs/index.ts @@ -1,2 +1 @@ -export * from "./types"; -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts b/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts deleted file mode 100644 index 7a98132b..00000000 --- a/src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. - * - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - */ -export type CreateEmbedJobRequestTruncate = "START" | "END"; -export const CreateEmbedJobRequestTruncate = { - Start: "START", - End: "END", -} as const; diff --git a/src/api/resources/embedJobs/types/index.ts b/src/api/resources/embedJobs/types/index.ts deleted file mode 100644 index f6698e47..00000000 --- a/src/api/resources/embedJobs/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./CreateEmbedJobRequestTruncate"; diff --git a/src/api/resources/finetuning/client/Client.ts b/src/api/resources/finetuning/client/Client.ts index bbbffb14..c608ba23 100644 --- a/src/api/resources/finetuning/client/Client.ts +++ b/src/api/resources/finetuning/client/Client.ts @@ -2,23 +2,24 @@ * 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 environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization/index"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; export declare namespace Finetuning { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -52,12 +53,19 @@ export class Finetuning { * @example * await client.finetuning.listFinetunedModels() */ - public async listFinetunedModels( + public listFinetunedModels( request: Cohere.FinetuningListFinetunedModelsRequest = {}, - requestOptions?: Finetuning.RequestOptions - ): Promise { - const { pageSize, pageToken, orderBy } = request; - const _queryParams: Record = {}; + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listFinetunedModels(request, requestOptions)); + } + + private async __listFinetunedModels( + request: Cohere.FinetuningListFinetunedModelsRequest = {}, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { + const { page_size: pageSize, page_token: pageToken, order_by: orderBy } = request; + const _queryParams: Record = {}; if (pageSize != null) { _queryParams["page_size"] = pageSize.toString(); } @@ -72,8 +80,10 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/finetuning/finetuned-models" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/finetuning/finetuned-models", ), method: "GET", headers: { @@ -84,8 +94,8 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -98,33 +108,31 @@ export class Finetuning { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.ListFinetunedModelsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.ListFinetunedModelsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -134,14 +142,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling GET /v1/finetuning/finetuned-models." + "Timeout exceeded when calling GET /v1/finetuning/finetuned-models.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -161,21 +171,30 @@ export class Finetuning { * await client.finetuning.createFinetunedModel({ * name: "api-test", * settings: { - * baseModel: { - * baseType: "BASE_TYPE_CHAT" + * base_model: { + * base_type: "BASE_TYPE_CHAT" * }, - * datasetId: "my-dataset-id" + * dataset_id: "my-dataset-id" * } * }) */ - public async createFinetunedModel( + public createFinetunedModel( request: Cohere.finetuning.FinetunedModel, - requestOptions?: Finetuning.RequestOptions - ): Promise { + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createFinetunedModel(request, requestOptions)); + } + + private async __createFinetunedModel( + request: Cohere.finetuning.FinetunedModel, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/finetuning/finetuned-models" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/finetuning/finetuned-models", ), method: "POST", headers: { @@ -186,51 +205,45 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.finetuning.FinetunedModel.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.CreateFinetunedModelResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.CreateFinetunedModelResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -240,14 +253,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling POST /v1/finetuning/finetuned-models." + "Timeout exceeded when calling POST /v1/finetuning/finetuned-models.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -266,14 +281,23 @@ export class Finetuning { * @example * await client.finetuning.getFinetunedModel("id") */ - public async getFinetunedModel( + public getFinetunedModel( id: string, - requestOptions?: Finetuning.RequestOptions - ): Promise { + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getFinetunedModel(id, requestOptions)); + } + + private async __getFinetunedModel( + id: string, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}`, ), method: "GET", headers: { @@ -284,8 +308,8 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -297,33 +321,31 @@ export class Finetuning { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.GetFinetunedModelResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.GetFinetunedModelResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -333,14 +355,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}." + "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -359,14 +383,23 @@ export class Finetuning { * @example * await client.finetuning.deleteFinetunedModel("id") */ - public async deleteFinetunedModel( + public deleteFinetunedModel( id: string, - requestOptions?: Finetuning.RequestOptions - ): Promise { + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteFinetunedModel(id, requestOptions)); + } + + private async __deleteFinetunedModel( + id: string, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}`, ), method: "DELETE", headers: { @@ -377,8 +410,8 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -390,33 +423,31 @@ export class Finetuning { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.DeleteFinetunedModelResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.DeleteFinetunedModelResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -426,14 +457,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}." + "Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -454,22 +487,32 @@ export class Finetuning { * await client.finetuning.updateFinetunedModel("id", { * name: "name", * settings: { - * baseModel: { - * baseType: "BASE_TYPE_UNSPECIFIED" + * base_model: { + * base_type: "BASE_TYPE_UNSPECIFIED" * }, - * datasetId: "dataset_id" + * dataset_id: "dataset_id" * } * }) */ - public async updateFinetunedModel( + public updateFinetunedModel( id: string, request: Cohere.FinetuningUpdateFinetunedModelRequest, - requestOptions?: Finetuning.RequestOptions - ): Promise { + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateFinetunedModel(id, request, requestOptions)); + } + + private async __updateFinetunedModel( + id: string, + request: Cohere.FinetuningUpdateFinetunedModelRequest, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/finetuning/finetuned-models/${encodeURIComponent(id)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/finetuning/finetuned-models/${encodeURIComponent(id)}`, ), method: "PATCH", headers: { @@ -480,51 +523,45 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.UpdateFinetunedModelResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.UpdateFinetunedModelResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -534,14 +571,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}." + "Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -561,13 +600,21 @@ export class Finetuning { * @example * await client.finetuning.listEvents("finetuned_model_id") */ - public async listEvents( + public listEvents( finetunedModelId: string, request: Cohere.FinetuningListEventsRequest = {}, - requestOptions?: Finetuning.RequestOptions - ): Promise { - const { pageSize, pageToken, orderBy } = request; - const _queryParams: Record = {}; + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listEvents(finetunedModelId, request, requestOptions)); + } + + private async __listEvents( + finetunedModelId: string, + request: Cohere.FinetuningListEventsRequest = {}, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { + const { page_size: pageSize, page_token: pageToken, order_by: orderBy } = request; + const _queryParams: Record = {}; if (pageSize != null) { _queryParams["page_size"] = pageSize.toString(); } @@ -582,8 +629,10 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/events` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/events`, ), method: "GET", headers: { @@ -594,8 +643,8 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -608,33 +657,28 @@ export class Finetuning { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.ListEventsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.finetuning.ListEventsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -644,14 +688,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events." + "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -671,13 +717,23 @@ export class Finetuning { * @example * await client.finetuning.listTrainingStepMetrics("finetuned_model_id") */ - public async listTrainingStepMetrics( + public listTrainingStepMetrics( finetunedModelId: string, request: Cohere.FinetuningListTrainingStepMetricsRequest = {}, - requestOptions?: Finetuning.RequestOptions - ): Promise { - const { pageSize, pageToken } = request; - const _queryParams: Record = {}; + requestOptions?: Finetuning.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__listTrainingStepMetrics(finetunedModelId, request, requestOptions), + ); + } + + private async __listTrainingStepMetrics( + finetunedModelId: string, + request: Cohere.FinetuningListTrainingStepMetricsRequest = {}, + requestOptions?: Finetuning.RequestOptions, + ): Promise> { + const { page_size: pageSize, page_token: pageToken } = request; + const _queryParams: Record = {}; if (pageSize != null) { _queryParams["page_size"] = pageSize.toString(); } @@ -688,8 +744,10 @@ export class Finetuning { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/training-step-metrics` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/finetuning/finetuned-models/${encodeURIComponent(finetunedModelId)}/training-step-metrics`, ), method: "GET", headers: { @@ -700,8 +758,8 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -714,33 +772,31 @@ export class Finetuning { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.finetuning.ListTrainingStepMetricsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Cohere.finetuning.ListTrainingStepMetricsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -750,14 +806,16 @@ export class Finetuning { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError( - "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics." + "Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics.", ); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -766,7 +824,8 @@ export class Finetuning { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/finetuning/client/index.ts b/src/api/resources/finetuning/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/finetuning/client/index.ts +++ b/src/api/resources/finetuning/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts index 0d771bfc..97f25cfd 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts @@ -11,11 +11,11 @@ export interface FinetuningListEventsRequest { * Maximum number of results to be returned by the server. If 0, defaults to * 50. */ - pageSize?: number; + page_size?: number; /** * Request a specific page of the list results. */ - pageToken?: string; + page_token?: string; /** * Comma separated list of fields. For example: "created_at,name". The default * sorting order is ascending. To specify descending order for a field, append @@ -24,5 +24,5 @@ export interface FinetuningListEventsRequest { * Supported sorting fields: * - created_at (default) */ - orderBy?: string; + order_by?: string; } diff --git a/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts index 48ea8b27..4a2f518d 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts @@ -11,11 +11,11 @@ export interface FinetuningListFinetunedModelsRequest { * Maximum number of results to be returned by the server. If 0, defaults to * 50. */ - pageSize?: number; + page_size?: number; /** * Request a specific page of the list results. */ - pageToken?: string; + page_token?: string; /** * Comma separated list of fields. For example: "created_at,name". The default * sorting order is ascending. To specify descending order for a field, append @@ -24,5 +24,5 @@ export interface FinetuningListFinetunedModelsRequest { * Supported sorting fields: * - created_at (default) */ - orderBy?: string; + order_by?: string; } diff --git a/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts index b9661fec..d740b000 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts @@ -11,9 +11,9 @@ export interface FinetuningListTrainingStepMetricsRequest { * Maximum number of results to be returned by the server. If 0, defaults to * 50. */ - pageSize?: number; + page_size?: number; /** * Request a specific page of the list results. */ - pageToken?: string; + page_token?: string; } diff --git a/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts index ac5e06a5..0e9b04c9 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts @@ -2,37 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example * { * name: "name", * settings: { - * baseModel: { - * baseType: "BASE_TYPE_UNSPECIFIED" + * base_model: { + * base_type: "BASE_TYPE_UNSPECIFIED" * }, - * datasetId: "dataset_id" + * dataset_id: "dataset_id" * } * } */ export interface FinetuningUpdateFinetunedModelRequest { /** FinetunedModel name (e.g. `foobar`). */ name: string; - /** User ID of the creator. */ - creatorId?: string; - /** Organization ID. */ - organizationId?: string; /** FinetunedModel settings such as dataset, hyperparameters... */ settings: Cohere.finetuning.Settings; /** Current stage in the life-cycle of the fine-tuned model. */ status?: Cohere.finetuning.Status; - /** Creation timestamp. */ - createdAt?: Date; - /** Latest update timestamp. */ - updatedAt?: Date; - /** Timestamp for the completed fine-tuning. */ - completedAt?: Date; - /** Deprecated: Timestamp for the latest request to this fine-tuned model. */ - lastUsed?: Date; } diff --git a/src/api/resources/finetuning/client/requests/index.ts b/src/api/resources/finetuning/client/requests/index.ts index 337ccf54..f795c01f 100644 --- a/src/api/resources/finetuning/client/requests/index.ts +++ b/src/api/resources/finetuning/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type FinetuningListFinetunedModelsRequest } from "./FinetuningListFinetunedModelsRequest"; -export { type FinetuningUpdateFinetunedModelRequest } from "./FinetuningUpdateFinetunedModelRequest"; -export { type FinetuningListEventsRequest } from "./FinetuningListEventsRequest"; -export { type FinetuningListTrainingStepMetricsRequest } from "./FinetuningListTrainingStepMetricsRequest"; +export { type FinetuningListFinetunedModelsRequest } from "./FinetuningListFinetunedModelsRequest.js"; +export { type FinetuningUpdateFinetunedModelRequest } from "./FinetuningUpdateFinetunedModelRequest.js"; +export { type FinetuningListEventsRequest } from "./FinetuningListEventsRequest.js"; +export { type FinetuningListTrainingStepMetricsRequest } from "./FinetuningListTrainingStepMetricsRequest.js"; diff --git a/src/api/resources/finetuning/index.ts b/src/api/resources/finetuning/index.ts index 4ce0f390..02bb7065 100644 --- a/src/api/resources/finetuning/index.ts +++ b/src/api/resources/finetuning/index.ts @@ -1,2 +1,2 @@ -export * from "./resources"; -export * from "./client"; +export * from "./resources/index.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/finetuning/resources/finetuning/index.ts b/src/api/resources/finetuning/resources/finetuning/index.ts index eea524d6..2f88e301 100644 --- a/src/api/resources/finetuning/resources/finetuning/index.ts +++ b/src/api/resources/finetuning/resources/finetuning/index.ts @@ -1 +1 @@ -export * from "./types"; +export * from "./types/index.js"; diff --git a/src/api/resources/finetuning/resources/finetuning/types/BaseModel.ts b/src/api/resources/finetuning/resources/finetuning/types/BaseModel.ts index 00592210..8f2b35c7 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/BaseModel.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/BaseModel.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * The base model used for fine-tuning. @@ -13,7 +13,7 @@ export interface BaseModel { /** read-only. The version of the base model. */ version?: string; /** The type of the base model. */ - baseType: Cohere.finetuning.BaseType; + base_type: Cohere.finetuning.BaseType; /** Deprecated: The fine-tuning strategy. */ strategy?: Cohere.finetuning.Strategy; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts index 1755c1a7..5430d804 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to request to create a fine-tuned model. */ export interface CreateFinetunedModelResponse { /** Information about the fine-tuned model. */ - finetunedModel?: Cohere.finetuning.FinetunedModel; + finetuned_model?: Cohere.finetuning.FinetunedModel; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/Event.ts b/src/api/resources/finetuning/resources/finetuning/types/Event.ts index 200c2226..9aa09162 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/Event.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/Event.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * A change in status of a fine-tuned model. */ export interface Event { /** ID of the user who initiated the event. Empty if initiated by the system. */ - userId?: string; + user_id?: string; /** Status of the fine-tuned model. */ status?: Cohere.finetuning.Status; /** Timestamp when the event happened. */ - createdAt?: Date; + created_at?: string; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/FinetunedModel.ts b/src/api/resources/finetuning/resources/finetuning/types/FinetunedModel.ts index a8a5e53c..6e0da675 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/FinetunedModel.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/FinetunedModel.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * This resource represents a fine-tuned model. @@ -13,19 +13,19 @@ export interface FinetunedModel { /** FinetunedModel name (e.g. `foobar`). */ name: string; /** read-only. User ID of the creator. */ - creatorId?: string; + creator_id?: string; /** read-only. Organization ID. */ - organizationId?: string; + organization_id?: string; /** FinetunedModel settings such as dataset, hyperparameters... */ settings: Cohere.finetuning.Settings; /** read-only. Current stage in the life-cycle of the fine-tuned model. */ status?: Cohere.finetuning.Status; /** read-only. Creation timestamp. */ - createdAt?: Date; + created_at?: string; /** read-only. Latest update timestamp. */ - updatedAt?: Date; + updated_at?: string; /** read-only. Timestamp for the completed fine-tuning. */ - completedAt?: Date; + completed_at?: string; /** read-only. Deprecated: Timestamp for the latest request to this fine-tuned model. */ - lastUsed?: Date; + last_used?: string; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts index 0f66730e..7f589e9f 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to a request to get a fine-tuned model. */ export interface GetFinetunedModelResponse { /** Information about the fine-tuned model. */ - finetunedModel?: Cohere.finetuning.FinetunedModel; + finetuned_model?: Cohere.finetuning.FinetunedModel; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/Hyperparameters.ts b/src/api/resources/finetuning/resources/finetuning/types/Hyperparameters.ts index 13cd625e..738d5fb6 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/Hyperparameters.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/Hyperparameters.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * The fine-tuning hyperparameters. @@ -12,28 +12,28 @@ export interface Hyperparameters { * Stops training if the loss metric does not improve beyond the value of * `early_stopping_threshold` after this many times of evaluation. */ - earlyStoppingPatience?: number; + early_stopping_patience?: number; /** How much the loss must improve to prevent early stopping. */ - earlyStoppingThreshold?: number; + early_stopping_threshold?: number; /** * The batch size is the number of training examples included in a single * training pass. */ - trainBatchSize?: number; + train_batch_size?: number; /** The number of epochs to train for. */ - trainEpochs?: number; + train_epochs?: number; /** The learning rate to be used during training. */ - learningRate?: number; + learning_rate?: number; /** * Controls the scaling factor for LoRA updates. Higher values make the * updates more impactful. */ - loraAlpha?: number; + lora_alpha?: number; /** * Specifies the rank for low-rank matrices. Lower ranks reduce parameters * but may limit model flexibility. */ - loraRank?: number; + lora_rank?: number; /** The combination of LoRA modules to target. */ - loraTargetModules?: Cohere.finetuning.LoraTargetModules; + lora_target_modules?: Cohere.finetuning.LoraTargetModules; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts index e3c4340c..6dacf887 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to a request to list events of a fine-tuned model. @@ -14,7 +14,7 @@ export interface ListEventsResponse { * Pagination token to retrieve the next page of results. If the value is "", * it means no further results for the request. */ - nextPageToken?: string; + next_page_token?: string; /** Total count of results. */ - totalSize?: number; + total_size?: number; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts index 3daff5e6..7771611a 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to a request to list fine-tuned models. */ export interface ListFinetunedModelsResponse { /** List of fine-tuned models matching the request. */ - finetunedModels?: Cohere.finetuning.FinetunedModel[]; + finetuned_models?: Cohere.finetuning.FinetunedModel[]; /** * Pagination token to retrieve the next page of results. If the value is "", * it means no further results for the request. */ - nextPageToken?: string; + next_page_token?: string; /** Total count of results. */ - totalSize?: number; + total_size?: number; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts index 74189eec..e5157fa0 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts @@ -2,17 +2,17 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to a request to list training-step metrics of a fine-tuned model. */ export interface ListTrainingStepMetricsResponse { /** The metrics for each step the evaluation was run on. */ - stepMetrics?: Cohere.finetuning.TrainingStepMetrics[]; + step_metrics?: Cohere.finetuning.TrainingStepMetrics[]; /** * Pagination token to retrieve the next page of results. If the value is "", * it means no further results for the request. */ - nextPageToken?: string; + next_page_token?: string; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/Settings.ts b/src/api/resources/finetuning/resources/finetuning/types/Settings.ts index bef86249..657a5f76 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/Settings.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/Settings.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * The configuration used for fine-tuning. */ export interface Settings { /** The base model to fine-tune. */ - baseModel: Cohere.finetuning.BaseModel; + base_model: Cohere.finetuning.BaseModel; /** The data used for training and evaluating the fine-tuned model. */ - datasetId: string; + dataset_id: string; /** Fine-tuning hyper-parameters. */ hyperparameters?: Cohere.finetuning.Hyperparameters; /** read-only. Whether the model is single-label or multi-label (only for classification). */ - multiLabel?: boolean; + multi_label?: boolean; /** The Weights & Biases configuration (Chat fine-tuning only). */ wandb?: Cohere.finetuning.WandbConfig; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts b/src/api/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts index 2b7cba5a..768778e2 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts @@ -7,9 +7,9 @@ */ export interface TrainingStepMetrics { /** Creation timestamp. */ - createdAt?: Date; + created_at?: string; /** Step number. */ - stepNumber?: number; + step_number?: number; /** Map of names and values for each evaluation metrics. */ metrics?: Record; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts b/src/api/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts index 5e581267..f92ed658 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../../index"; +import * as Cohere from "../../../../../index.js"; /** * Response to a request to update a fine-tuned model. */ export interface UpdateFinetunedModelResponse { /** Information about the fine-tuned model. */ - finetunedModel?: Cohere.finetuning.FinetunedModel; + finetuned_model?: Cohere.finetuning.FinetunedModel; } diff --git a/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts b/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts index d031967a..cd5c932c 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts @@ -9,7 +9,7 @@ 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; + api_key: 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 cadba814..653a6856 100644 --- a/src/api/resources/finetuning/resources/finetuning/types/index.ts +++ b/src/api/resources/finetuning/resources/finetuning/types/index.ts @@ -1,18 +1,18 @@ -export * from "./BaseType"; -export * from "./Strategy"; -export * from "./BaseModel"; -export * from "./LoraTargetModules"; -export * from "./Hyperparameters"; -export * from "./WandbConfig"; -export * from "./Settings"; -export * from "./Status"; -export * from "./FinetunedModel"; -export * from "./ListFinetunedModelsResponse"; -export * from "./CreateFinetunedModelResponse"; -export * from "./GetFinetunedModelResponse"; -export * from "./DeleteFinetunedModelResponse"; -export * from "./UpdateFinetunedModelResponse"; -export * from "./Event"; -export * from "./ListEventsResponse"; -export * from "./TrainingStepMetrics"; -export * from "./ListTrainingStepMetricsResponse"; +export * from "./BaseType.js"; +export * from "./Strategy.js"; +export * from "./BaseModel.js"; +export * from "./LoraTargetModules.js"; +export * from "./Hyperparameters.js"; +export * from "./WandbConfig.js"; +export * from "./Settings.js"; +export * from "./Status.js"; +export * from "./FinetunedModel.js"; +export * from "./ListFinetunedModelsResponse.js"; +export * from "./CreateFinetunedModelResponse.js"; +export * from "./GetFinetunedModelResponse.js"; +export * from "./DeleteFinetunedModelResponse.js"; +export * from "./UpdateFinetunedModelResponse.js"; +export * from "./Event.js"; +export * from "./ListEventsResponse.js"; +export * from "./TrainingStepMetrics.js"; +export * from "./ListTrainingStepMetricsResponse.js"; diff --git a/src/api/resources/finetuning/resources/index.ts b/src/api/resources/finetuning/resources/index.ts index 1341eba9..09ae3f55 100644 --- a/src/api/resources/finetuning/resources/index.ts +++ b/src/api/resources/finetuning/resources/index.ts @@ -1,2 +1,2 @@ -export * as finetuning from "./finetuning"; -export * from "./finetuning/types"; +export * as finetuning from "./finetuning/index.js"; +export * from "./finetuning/types/index.js"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 829d2684..9e98e756 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,15 +1,14 @@ -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 * 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"; -export * from "./models/client/requests"; -export * from "./finetuning/client/requests"; +export * as v2 from "./v2/index.js"; +export * from "./v2/types/index.js"; +export * as datasets from "./datasets/index.js"; +export * from "./datasets/types/index.js"; +export * as finetuning from "./finetuning/index.js"; +export * as embedJobs from "./embedJobs/index.js"; +export * as connectors from "./connectors/index.js"; +export * as models from "./models/index.js"; +export * from "./v2/client/requests/index.js"; +export * from "./embedJobs/client/requests/index.js"; +export * from "./datasets/client/requests/index.js"; +export * from "./connectors/client/requests/index.js"; +export * from "./models/client/requests/index.js"; +export * from "./finetuning/client/requests/index.js"; diff --git a/src/api/resources/models/client/Client.ts b/src/api/resources/models/client/Client.ts index 0ba6b914..8c098703 100644 --- a/src/api/resources/models/client/Client.ts +++ b/src/api/resources/models/client/Client.ts @@ -2,23 +2,24 @@ * 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 environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization/index"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; export declare namespace Models { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -57,11 +58,23 @@ export class Models { * @example * await client.models.get("command-a-03-2025") */ - public async get(model: string, requestOptions?: Models.RequestOptions): Promise { + public get( + model: string, + requestOptions?: Models.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(model, requestOptions)); + } + + private async __get( + model: string, + requestOptions?: Models.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - `v1/models/${encodeURIComponent(model)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + `v1/models/${encodeURIComponent(model)}`, ), method: "GET", headers: { @@ -72,8 +85,8 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -85,45 +98,40 @@ export class Models { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.GetModelResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.GetModelResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -133,12 +141,14 @@ export class Models { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/models/{model}."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -165,12 +175,19 @@ export class Models { * @example * await client.models.list() */ - public async list( + public list( request: Cohere.ModelsListRequest = {}, - requestOptions?: Models.RequestOptions - ): Promise { - const { pageSize, pageToken, endpoint, defaultOnly } = request; - const _queryParams: Record = {}; + requestOptions?: Models.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Cohere.ModelsListRequest = {}, + requestOptions?: Models.RequestOptions, + ): Promise> { + const { page_size: pageSize, page_token: pageToken, endpoint, default_only: defaultOnly } = request; + const _queryParams: Record = {}; if (pageSize != null) { _queryParams["page_size"] = pageSize.toString(); } @@ -189,8 +206,10 @@ export class Models { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, - "v1/models" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v1/models", ), method: "GET", headers: { @@ -201,8 +220,8 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, @@ -215,45 +234,40 @@ export class Models { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.ListModelsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.ListModelsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -263,12 +277,14 @@ export class Models { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling GET /v1/models."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -277,7 +293,8 @@ export class Models { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/models/client/index.ts b/src/api/resources/models/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/models/client/index.ts +++ b/src/api/resources/models/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/models/client/requests/ModelsListRequest.ts b/src/api/resources/models/client/requests/ModelsListRequest.ts index df740749..9aa2a8d7 100644 --- a/src/api/resources/models/client/requests/ModelsListRequest.ts +++ b/src/api/resources/models/client/requests/ModelsListRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example @@ -13,11 +13,11 @@ export interface ModelsListRequest { * Maximum number of models to include in a page * Defaults to `20`, min value of `1`, max value of `1000`. */ - pageSize?: number; + page_size?: number; /** * Page token provided in the `next_page_token` field of a previous response. */ - pageToken?: string; + page_token?: string; /** * When provided, filters the list of models to only those that are compatible with the specified endpoint. */ @@ -25,5 +25,5 @@ export interface ModelsListRequest { /** * When provided, filters the list of models to only the default model to the endpoint. This parameter is only valid when `endpoint` is provided. */ - defaultOnly?: boolean; + default_only?: boolean; } diff --git a/src/api/resources/models/client/requests/index.ts b/src/api/resources/models/client/requests/index.ts index 0d252924..b5563ac6 100644 --- a/src/api/resources/models/client/requests/index.ts +++ b/src/api/resources/models/client/requests/index.ts @@ -1 +1 @@ -export { type ModelsListRequest } from "./ModelsListRequest"; +export { type ModelsListRequest } from "./ModelsListRequest.js"; diff --git a/src/api/resources/models/index.ts b/src/api/resources/models/index.ts index 5ec76921..914b8c3c 100644 --- a/src/api/resources/models/index.ts +++ b/src/api/resources/models/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/v2/client/Client.ts b/src/api/resources/v2/client/Client.ts index 2a1fc16b..453498f9 100644 --- a/src/api/resources/v2/client/Client.ts +++ b/src/api/resources/v2/client/Client.ts @@ -2,24 +2,25 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Cohere from "../../../index.js"; import urlJoin from "url-join"; import * as stream from "stream"; -import * as errors from "../../../../errors/index"; +import * as errors from "../../../../errors/index.js"; export declare namespace V2 { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the X-Client-Name header */ clientName?: core.Supplier; fetcher?: core.FetchFunction; } - interface RequestOptions { + export 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. */ @@ -41,14 +42,23 @@ export class V2 { * * Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2. */ - public async chatStream( + public chatStream( request: Cohere.V2ChatStreamRequest, - requestOptions?: V2.RequestOptions - ): Promise> { + requestOptions?: V2.RequestOptions, + ): core.HttpResponsePromise> { + return core.HttpResponsePromise.fromPromise(this.__chatStream(request, requestOptions)); + } + + private 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" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v2/chat", ), method: "POST", headers: { @@ -59,77 +69,66 @@ export class V2 { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: { - ...serializers.V2ChatStreamRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: true, - }, + body: { ...request, 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.StreamedChatResponseV2.parseOrThrow(data, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - }, - signal: requestOptions?.abortSignal, - eventShape: { - type: "sse", - streamTerminator: "[DONE]", - }, - }); + return { + data: new core.Stream({ + stream: _response.body, + parse: (data) => data as any, + signal: requestOptions?.abortSignal, + eventShape: { + type: "sse", + streamTerminator: "[DONE]", + }, + }), + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -139,12 +138,14 @@ export class V2 { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -172,19 +173,108 @@ export class V2 { * * @example * await client.v2.chat({ - * model: "model", + * model: "command-a-03-2025", * messages: [{ - * role: "tool", - * toolCallId: "messages", - * content: "messages" + * role: "user", + * content: "Tell me about LLMs" + * }] + * }) + * + * @example + * await client.v2.chat({ + * model: "command-r", + * documents: [{ + * data: { + * "content": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak." + * } + * }, { + * data: { + * "content": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold." + * } + * }, { + * data: { + * "content": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers." + * } + * }, { + * data: { + * "content": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures." + * } + * }], + * messages: [{ + * role: "user", + * content: "Who is more popular: Nsync or Backstreet Boys?" + * }] + * }) + * + * @example + * await client.v2.chat({ + * model: "command-r", + * messages: [{ + * role: "user", + * content: "Tell me about LLMs" + * }], + * tools: [{ + * type: "function", + * function: { + * name: "query_daily_sales_report", + * description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.", + * parameters: { + * "type": "object", + * "properties": { + * "day": { + * "description": "Retrieves sales data for this day, formatted as YYYY-MM-DD.", + * "type": "str" + * } + * }, + * "required": [ + * "day" + * ], + * "x-fern-type-name": "tools-by6k68" + * } + * } + * }, { + * type: "function", + * function: { + * name: "query_product_catalog", + * description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", + * parameters: { + * "type": "object", + * "properties": { + * "category": { + * "description": "Retrieves product information data for all products in this category.", + * "type": "str" + * } + * }, + * "required": [ + * "category" + * ], + * "x-fern-type-name": "tools-o09qd6" + * } + * } * }] * }) */ - public async chat(request: Cohere.V2ChatRequest, requestOptions?: V2.RequestOptions): Promise { + public chat( + request: Cohere.V2ChatRequest, + requestOptions?: V2.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__chat(request, requestOptions)); + } + + private 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" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v2/chat", ), method: "POST", headers: { @@ -195,66 +285,54 @@ export class V2 { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: { - ...serializers.V2ChatRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), - stream: false, - }, + body: { ...request, stream: false }, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.ChatResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.ChatResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -264,12 +342,14 @@ export class V2 { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -299,19 +379,37 @@ export class V2 { * * @example * await client.v2.embed({ - * model: "model", - * inputType: "search_document", - * embeddingTypes: ["float"] + * texts: ["hello", "goodbye"], + * model: "embed-v4.0", + * input_type: "classification", + * embedding_types: ["float"] + * }) + * + * @example + * await client.v2.embed({ + * model: "embed-v4.0", + * input_type: "image", + * embedding_types: ["float"], + * images: ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gAfQ29tcHJlc3NlZCBieSBqcGVnLXJlY29tcHJlc3P/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIAZABkAMBIgACEQEDEQH/xAAdAAEAAQQDAQAAAAAAAAAAAAAABwEFBggCAwQJ/9oACAEBAAAAAN/gAAAAAAAAAAAAAAAAAAAAAAAAAAHTg9j6agAAp23/ADjsAAAPFrlAUYeagAAArdZ12uzcAAKax6jWUAAAAO/bna+oAC1aBxAAAAAAbM7rVABYvnRgYAAAAAbwbIABw+cMYAAAAAAvH1CuwA091RAAAAAAbpbPAGJfMXzAAAAAAJk+hdQGlmsQAAAAABk31JqBx+V1iAAAAAALp9W6gRp826AAAAAAGS/UqoGuGjwAAAAAAl76I1A1K1EAAAAAAG5G1ADUHU0AAAAAAu/1Cu4DVbTgAAAAAA3n2JAIG0IAAAAAArt3toAMV+XfEAAAAAL1uzPlQBT5qR2AAAAAenZDbm/AAa06SgAAAAerYra/LQADp+YmIAAAAC77J7Q5KAACIPnjwAAAAzbZzY24gAAGq+m4AAA7Zo2cmaoAAANWdOOAAAMl2N2TysAAAApEOj2HgAOyYtl5w5jw4zZPJyuGQ5H2AAAdes+suDUAVyfYbZTLajG8HxjgD153n3IAABH8QxxiVo4XPKpGlyTKjowvCbUAF4mD3AAACgqCzYPiPQAA900XAACmN4favRk+a9wB0xdiNAAAvU1cgAxeDcUoPdL0s1B44atQAACSs8AEewD0gM72I5jjDFiAAAPfO1QGL6z9IAlGdRgkaAAABMmRANZsSADls7k6kFW8AAAJIz4DHtW6AAk+d1jhUAAAGdyWBFcGgAX/AGnYZFgAAAM4k4CF4hAA9u3FcKi4AAAEiSEBCsRgAe3biuGxWAAACXsoAiKFgALttgs0J0AAAHpnvkBhOt4AGebE1pBtsAAAGeySA4an2wAGwEjGFxaAAAe+c+wAjKBgAyfZ3kUh3HAAAO6Yb+AKQLGgBctmb2HXDNjAAD1yzkQAENRF1gyvYG9AcI2wjgAByyuSveAAWWMcQtnoyOQs8qAPFhVh8HADt999y65gAAKKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAEFBgIEA//aAAgBAhAAAAAAAAAAAAABEAAJkBEAAB0CIAABMhyAAA6EQAAA6EQAABMiIAAAmREAAAmQiAABMgOQAEyAHIATIACIBMu7H3fT419eACEnps7DoPFQch889Wd3V2TeWIBV0o+eF8I0OrXVoAIyvBm8uDe2Wp6ADO+Mw9WDV6rSgAzvjMNWA1Op1AARlvmZbOA3NnpfSAK6iHnwfnFttZ9Wh7AeXPcB5cxWd3Wk7Pvb+uR8q+rgAAAAAAAAP//EABsBAQABBQEAAAAAAAAAAAAAAAAEAQIDBQYH/9oACAEDEAAAAAAAAAC20AL6gCNDxAArnn3gpro4AAv2l4QIgAAJWwGLVAAAX7cQYYAAFdyNZgAAAy7UazAAABsZI18UAAE6YEfWgACRNygavCACsmZkALNZjAMkqVcAC2FFoKyJWe+fMyYoMAAUw2L8t0jYzqhE0dAzd70eHj+PK7mcAa7UDN7VvBwXmDb7EAU5uw9C9KCnh2n6WoAaKIey9ODy/jN+ADRRD2fpQeY8P0QAU5zGel+gg8V53oc4AgaYTfcJ45Tx5I31wCPobQ2PpPRYuP8APMZm2kqoxQddQAAAAAAAAP/EAFMQAAEDAgIDCQkMBwUIAwAAAAECAwQFEQAGBzFREhMhMEBBYXGBCBQYIjJCRlDSFSBSVGJygpGTobHREDRDc6LBwiMzU3CyFiQlNVVkdISSlLP/2gAIAQEAAT8A/wAo74nVaBAb32bNYitfDfcS2PrURiZpU0dwVFMjN1OVY8O8u7//APkFYc076LmfSVSvmQpB/ox4QGjH/r7v/wBGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0Y89fd7IMj2cN6e9GDpCTmRaOuFI9nEDSlo9qakpj5upoJNgH3d4+50JxGlxpbSH4r7bzSvJW0sLSeop5NWsw0fL8RU2rVGPDjJ4C6+4EAnYnaegYzV3StDhFcfK1LdqDuoSZBLDHWlPlqxXtNmkOulaVVxcFg3/sYA73A+kLrxKnTJrpfmSXX3jrcdWVqPWVYudvJ7nbil16s0R7vikVSVDduCVR3lNk9e5IvjKfdG5rpKmo+Yo7NXi8ALlgxJH0kiysZL0l5Uzsz/AMFn2l7m7kJ8BuSj6PnAbU8ieeZitOPPuoQ22krWtZCUpSkXJJOoDGkHui4MBT1MyW2ibITdJnuA97o/dJ1uHFczFXMyzV1Gu1N+bJV57yr7kbEjUkdA5dGlSYb7UqJIcZfaUFtuNLKFoUNRSocIONF3dBb6tih58eSCQEM1PUOqT7eELS4lK0KCkkAgg3BB4/M2Z6NlKlSKtWJiI8VoWueFS1nUhA85ZxpJ0v13Pj7kNorg0NC7tw0K4XNi3yPKPRqHqLQnpkeoD8XKmZZJVSHCG4klw/qijqQs/wCF/pwDfjc1ZqpOUKNLrVXf3qMyLJSLFbrh8ltA51qxn7P9az9V1z6istxWypMSIhRLbCD+Kj5yvUYJHCMdz7pLXWoByfWJBXUILV4bizwvRk+Z0qa4yoTodKgyZ859DEWO0t11xZslCEC5UrGlHSNOz/XVvBa26RFKkQY+xHO4v5a/UtArU3LlZptbpzm4lQ30ut7DbWk9ChwHGXq5EzHQ6ZWoCv8AdpsdDyRrIKtaFdKTwHi+6I0hrffGRKU/ZloodqSkngW5rQz1I1n1P3M2ZzJpFYyvIXdUJ0SowP8AhP8AAtI6AvitIWbWclZVqlbWElxpvcRmz+0kOcDaf5nEyXJnypM2Y8p2Q+6t11xRupa1m6lHpJ9T6B6uaVpHo7alEMz0PQnepxN0/wASRgauJ7pTNZmVynZTjuXZpzYkSRtkPDgB6UI9UZMlrgZsy1MQqxZqkRy/QHRfA4iZIaiRX5D6ghpptTi1bEIFycZmrL2YcwVitvk7ubLdfsfNClcCewcHqiiX91qbbX3yz/rGBxGmKse4ujnMz6F2dfjiGj/2VBs/ccE3J9UZOirm5ry3EQm5eqkRu3Qp0YHEd01PLGUqPT0mxk1QLV0oZaPteqdBtKNV0kUIkXah77Md6mkcH8RGBq4jupH7JyXG/wDPcP1tj1T3MuWVMQK5mt9FjJWmDGO1tHjuHqJ4nupEnvrJa+beZ4/jR6ooNGnZhrFOotNa3yXMeS02OvWo9CRwk4ytQIeWKDS6HC/V4TCWgq1itWtSz0rPCeJ7qKNenZSl2/upEtonpcShXqcC+NA+jFeW4H+1NbYKatOaswysWMaOrbscc4rujaYZuj/vzccMCpR3yehwFn+r1MAVGwGNDOhVbK4ubc4xLLFnYMB1PCNjrw/BHF58opzDk7MlHSndOSID28ja6gbtH3jChZRHqShZerOZag1S6JT3pcpzUhsahtUTwJTtJxow0G0vKRYreYS1PrIAUhNrx4yvkA+WsfCONXFnGlTLZytnqvU5KLRlvmTG2Fl/xwB0J1eookOXPkNRYUZ1991W5baaQVrWdiUi5JxkbudKzVCzOzg+abE196NWXKWOnWlvGW8p0DKMEU6g01qKzwFe5F1uEDynFnhUeO7pTJ5n0aBmyK3d+mneJVtZjOnxVfQX6ghwZtRktQ4EV6RJcNkNMoK1qOwJTcnGTe5yr9V3qXmuSKXFNj3uizkpY/0oxlbIOVslRt6oVKaZdIst9XjyHPnOK4ezkFVgw6vAmU2ewHYsllbDiFaloWNyoYz1lKZknMtRoEu6gyvdMO8zrC/IXy2j0Cs5glpg0WmyJkk+YwgrIG1WwdJxk7uap75amZyqQit6zChkLe6lueSnGWcl5ayjGEegUliKCAFuAbp5z57irqPI9NOjVOdqB31T2x7tU5KlxNryNa2CenWnDra2XFtOoUhaFFKkqFiCOAgg8qyro7zdnJwCh0Z5xi9lSVje46etarA22DGUe5spEPe5ebqgue78Ui3aj9Sl+WvFIodHoMREGj02PDjJ1NMNhAJ2m2s8m07aIHJi5WdMsxSZFiuoxG08LoGt9sDz/hjGrkzLD0hxDLDSluLISlKQSpRPMAMZU0C54zFvcidHTR4Sv2k24dI+SyPG+u2MqaBskZc3qRLimrzEftZoBaB+S0PFw0y2y2hppCUIQAEpSAAAOYAauU6XtBJmuycy5LjASVXcl05sWDu1bGxe1GHWnGXFtOoUhxCilSVAghSTYgg6iOR5eyfmXNT/AHvQKNJmKBspTaLNo+es2SntOMq9zNIc3uTm+sBoazEgWWvtdWLDGWchZTyk2E0KiR4zlrKkEbt9XW4u6uW6SNDNAzwHZ7BTTq3YkSm0XS7sS+ka/na8ZuyJmbJMwxK9T1NJJs1IR47D3S2vj2mXXlobabUtaiAlKRcknUAMZV0F56zJvT8iEKVCVY77PuhZHyWvLxlTuesl0Te3qqlysy08JMnxI4PQ0n+onEWDFhMNxokdphhsWQ20gIQkbEpFgPeyqnBg/rMhCCBfc3ur6hw4lZ1hNbpMdlbpGokhKT+OHs7zVf3EdpHzgVfzGDnGqnnbHUkYGcqqOZo/OT+VsMZ5eBG/w0K2lJKPaxDzfTJBCXFLZUTbxk3+q2GJTEhAcYdQtB1KSoEckqdLp1ThvQqnEZkxXU7lbLyAtCusKxnPubKVNU9NyhOMB03Pekm7kfsXwqRjM+jfOWUVLNZochEcapLY31gj56LgduLHZxNjjL+TM0ZpcDdCokuWL2LiEWaSflOKskYyt3M8t0tSM31hLCNZiwbLc7XVCwxljR9lHKDaRQ6Kww6BZUlQ32Qr6a7nAAHvFLSkEqUAAMT81UyGClDm/r2N6u1WKhm2oywpDKt4bPMjX/8ALC3HHCVLWSSbm+338adLhuB2O+tChzg4pOdOFDVRRbm31A/EflhiQ1IbS6y4laFaik3HJCkKBBAII4RjMOibIOYCtc/LkZD6tb0W8Zy+0luwVisdzDRX925RMyS4uxMtlD46gUFGKj3NWdY11wajSpbf71bS/qUnErQTpPjXIy2Xk7WZLCv68L0R6R2/KylO+ikK/A4Tom0jL1ZRqHa3bEXQjpPlkBGVXkDa48yj8V4p/c358lEGW/TIaOcOSCtfYG0qxSO5gp6AldczQ+9tbhsBr+NwqxRNDWjygFDjGXmpL4N99nEyVH6K/FGGmGY7SGm20oQgAJSkAJAHMAPeyJ8WEjfJD6EX1XP4DWTioZ1ZRdEBndnmWvgT2DE6tVCoE98SFFPMgGyR2DBN+E8XSq3MpToUyu7ZIK0HUcUmsRapGK46wlfBuknWnk5AOsY3I2YsNmLAagPf1HMFNp+6S68FOD9mjhV+QxUM5THrohJDKNutWHpL8halvOqWo6yokk8fT58inSESI6ylST2EbDtGKRU49VitvtkJI8tOsg7OOJA1nFSzhQKaVIkT21OA23DV3Fdu51Yk6VICCREpzznS4pKPw3WDpXk34KOgD9+fZwxpWB4JNIIG1D1/xTinaSMvylJDy3YyjwDfUXH1pviFPhTGw/FkNuoOpbagofdxU2fHhMqekOBDadus4q+bJcwqahkssfxnrOFKKjckk8iodWcpUxDySS2rgcTfWMMPtvstvNKCkLSFJI5weMzFm6mZfQUvL32UQCiOg+N1q2DFbzlWa2paXHyzGOplolKbfKOtWLnb72FUp9NeD8GU4y4OdBtfr2jGW9JTbqm4tdQlCr2D6fIPzxzYadbdQhxpYUlQBBBuCD7+pVKPTIq5D6uAcCUjWpWwYqtWlVV9Tr6yE6kIHkpHJcl1cqS5TXjfc+O3f7xxedc6IoqTAgEKnqHCdYZB5ztVsGH5D0p5x+Q6px1ZKlKUbknico5zk0J5EWWtTtPWeFOstdKejaMR5TMxhuQw4lbTiQpKkm4UD7151thtbriwlCElSidQAxXaw7VZalXsyglLadg/M8mpstcKbHko1oWDbb0duGXEOtIcQbpUkKB2g8Tm3MSMv0xbySDJduhhB+FtPQMSJD0p5yRIcK3XFFSlK1kni9HealU+UijzFjvZ5X9iVHyHDzdSve5yqqm2kU5pViuynCNnMOUZVld80lgKsVNEtns4QPqPEKNgTjOdbVWq0+tC7xmCWmRzWTrV2njEqUhQUkkEG4Ixk6ue7dFjPuuXeau08Plp5+0cP6VrS22pSiAACSdgGKpMXPnSJK/PWSBsHMOzlGRX/EmsW8koWOs3B4jONTNNoNQkIUUr3ve27awpzxb4PCTxujGpKYqkinKV4klvdJ+e3+nMkjvakS1DWtIb7FcB+7BNyTyjI67S5CDzsqP1EcRpUkqRTqfFBtvr6l9iE2/nx2V5XeeYKS9/3CEdizuD+OEm4/RnVak0+OhJtd256gm38+U5JTeY+rYyofeniNKyjv8AR0c24f8AxTx1NJTUYKhrD7Z/iGEeSP0Z63Pe8Xc6hur9dxynI7JtNeOqyAO0m/EaVv1mj/Mf/FPHU7/mEL98j8cI8gfozq2pdOZWnmdseopJ5TlKIWKShZFi8tSz2eL/AC4jSsx/Y0qR8FbqD9IA8dQmFSK1S2UjypTQ7N0L4SLJ/RmOOJVIloSk+Ijdjb4nCcEWJB5PDjrlSWWGxdS1hI7TiHHRGjsso8htCUDqSLcRpDppl5ckLABXHUl8DYBwH7jx2juAZeYmXyk7iM2t07L23I/HA/QtIWkpULggjFXgqp8+RHINkrO5O0axyfJlLK3l1F1Pit3S3cecRr7BxMqM3IjusOpCkOoKVjakixGKzTXaTU5cB4HdNOEAnzk6we0cbo3o5g0hU91FnZhCh+7T5PvM6UjfWkTmE3W0LObSnmPZyanQHqjKajMjhUeE2uANpxAhNQYzTDabNtpsOk85PXxWkjLJmRk1mGjdPR0WdA85rb9HjMqUByv1Rtgg97N2W+vYjZ1qww02y2htCQlCEhKUjUAPeLQlxCkLAUlQsQdRBxmKiOUqWopSox1m6FHht0HkjDDsl1DLKCpajYAYoFFRSYw3dlSF8K1bPkji1JCgUkXBxnjJTlJecqVOZvCWbrQn9kT/AEniqVSplYmNQoTRW4s9iRzqUeYDGXaBFoFPbiMC6/KdctYrVt/Ie+qECNMjKjyE7oLHaOkYrVEkUl8hQKmVE7hY1HkUOFInPoYjtla1bMUDLzNKb3xyy5KvKXzDoTxrjaHEKQ4gKSoWIIuCDzYzTo5WlTk2ggEG6lxr6vmH+WHmXWHFtPNqQ4k2UlQIIOwg+/y/lCq19xKm2yzFv4z7g8X6I844oOXoFBiiPDb4TYuOny1kbTxEmOxKaVHebS4hXlA4rWTpEdSnqfdxu5JR5w6tuFtONKKXEFJBsQeOShSzZIvilZTnTShySCwyfhDxj1DFPpcSmtBuM0B8JR4VK6zyCr5apFaQROiJWsCwdT4qx1KGKloseG7XSp4UnmQ+LfxJxJyLmaMoj3OU4n4TakqwrLVfSbGjy/sV4ZyhmN/yKRI+kncf6rYhaM64+QZa2YyOk7tQ7E4o+jyiU0h2SgzHhzu+R2I/PCEIbASgAJAsAOLqFFp84HvphKlkCyhwK4OnZiXkcElUKV9Fz2hh/KdZataPuwfOSoEYXQqog2MJ49Taj/LHuNVPiEj7Jf5Y9xqp8QkfZL/LHuNVPiEj7Jf5Y9xqp8QkfZL/ACx7jVT4hI+yX+WPcaqfEJH2S/yx7jVT4hI+yX+WEUCquaoTw+chQ/EYYyjWHQSpgN9K1C33XOIuR0+VMlfRbH8ziFRKdTwksRkhY89XjK+/VyWwxYf5ef/EADgRAAIBAgMDCQUHBQAAAAAAAAECAwQRAAUgMUFhEhMhIjBAUXGREDJQU6EGFDNCYoGSUnKiwdH/2gAIAQIBAT8A+L37e/wE9zHfj3k90Gk90Gk9ztqPcbd3t3e3b2129qRySGyIScRZY56ZXtwGFoKZfyX8zj7rT/JX0w+X0zbFKngcTZdLHdozyx9cbOg9pbFtENJPNYqlh4nEOWxJYykufQYVFQWRQBw1VVGk4LKAJPHxwysjFWFiNUsscKGSVwqjecVOfgErSxX/AFNhs5r2P4oHkoxHndchHKZXHFf+YpM7gnISYc0/+J0KpYhVFycUtCkQDygM/huHZZjThl59R1l97iNMsqQxvLIbKoucV1dLWykkkRg9VdOUZmyOtLO10PQhO4+Hty6mCrz7jpPu+XZsoZSp2EEYkQxyOh/KSNGf1JAipVO3rNq2EHGW1P3mkikJ6w6reYxGpd0QbyBhVCqFGwC3aV4tUycbHRnLFq+UeAUfTX9nmJhqE3BwfUYoxeqi8+1ryDVPwA0ZwCMwm4hT9Nf2eB5qobcWUfTFM3Inib9Q7QkAEnYMSvzkrv4knRn8BEkVQB0Ecg+Y15RTmCij5Qsz9c/v7KWYTQo28dDefZ5hUBI+aU9Z9vAaamnSqheF9jD0OKmmlpZWilFiNh3Eacqy9quUSSLaFDc8T4YAt7KWpNPJfap94YR1kUOhuD2NTVJTr4vuGHdpHZ3NydVVSQVaciZfIjaMVOR1URJhtKvocNSVSmzU8gP9pxHQVkhASnf9xbFJkJuHq2Fv6F/2cIiRoqIoVQLADRBUSwG6Ho3g7DiLMYX6Huh9RgTwtslT1GOdi+YnqMc7F8xP5DHOxfMT+Qxz0XzE9Rh6ymTbKD5dOJsyY3WFbcThmZiWYkk7z8W//8QAOREAAgECAgYHBwMDBQAAAAAAAQIDAAQFERITICExkQYwQVFSYXEQFCJAQlOBMlChI4KSYnJzsbL/2gAIAQMBAT8A/YCyjiwFa2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8YoMp4EHq5LlV3LvNPNI/FuXW5kcDUdw6cd4pJFkGanbJABJqacvmq7l+RR2Rgy0jiRQw2rmXM6CncOPydq+T6B4HZmfQjJ7eA+UQ6LqfMbN229V/Pyg4j1GzcnOVvlIV0pFH52bgZSt8pbRaC6TcTs3YycHvHyQBJAFQ2+WTyfgbVymlHmOI+Rjt3fe3wio4kj4Df39RNGY38jw60AscgMzSWrHe5yFJEkfBd/f1UiLIpU1JG0ZyPVJE7/pWktRxc/gUqKgyVQOtZVcZMMxUlqw3pvHdRBU5EEbIBO4CktpG3t8IpLeNOzM+fsSN5DkikmosPY75Wy8hS2duv0Z+te7wfaXlT2Nu3BSvoalsJE3xnTH81vG49UVVtzAGjbRH6cq90TxGvdE8RoW0Q7M6Cqu5VA9kVrNLvC5DvNRWEa75CWPIUqqgyVQB5bVzarMCy7n7++mUoxVhkRtW9tPdypBbRNJI3BVFYf0FdlWTErnQP24uP5JqLojgUYyNqznvZ2q46GYLKDq0khPejk/8ArOsU6HX1irTWre8xDeQBk4/FHduPtALEKozJq3skjAaQaT/wOqv4NJdco3jj6bNtby3c8VtAulJIwVRWCYJb4PbKqqGnYDWSdpPcPLZ6V9HEmikxOxjAlQaUqL9Q7x5+2xgCrrmG8/p9OrIDAg8CKkTQd07iRsdBcPV3ucSkX9H9KP1O8naIBBBG410gsBh2K3MCDKNjrE/2tSLpuqDtIFKAqhRwA6y9GVw/mAdjohEEwK2I4u0jH/Lb6exgXljL2tEwP9pq0GdzF69bfHO4fyAGx0ScPgVpl9JkB/yO309cG6w9O0ROeZq3bQnib/UOsJyBJqV9ZI7952Ogl8DDdYezfEra1B5HcdvpTfC+xicoc44QIl/t4/z7LaUTRK3bwPr1d9PoJqlPxN/A2cOvpsNvIbyA/Eh3jvHaDWHYjbYnapdWzgg/qHap7js9JseTDLZreBwbuVSAB9AP1GiSSSeJ9ltcGB8/pPEUjq6hlOYPU3FykC97dgp3aRi7HMnaw3FbzCptdaSZeJDvVh5isO6aYdcqq3gNvJ25705ikxXDJAGS/gI/5FqfHMIt10pb+H0DBjyGdYr03XRaLCojnw1sg/6FTTSzyPNNIXkc5szHMnYhuJIDmh3doPCo7+F9z5oaE0R4SrzrWR/cXnWsj+4vOtZH9xeYrWx/cXmKe6gTjID6b6lxAnMQrl5mmYsSzEkn92//2Q=="] * }) */ - public async embed( + public embed( request: Cohere.V2EmbedRequest, - requestOptions?: V2.RequestOptions - ): Promise { + requestOptions?: V2.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__embed(request, requestOptions)); + } + + private async __embed( + request: Cohere.V2EmbedRequest, + 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/embed" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v2/embed", ), method: "POST", headers: { @@ -322,63 +420,54 @@ export class V2 { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.V2EmbedRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.EmbedByTypeResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.EmbedByTypeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -388,12 +477,14 @@ export class V2 { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v2/embed."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -419,19 +510,29 @@ export class V2 { * * @example * await client.v2.rerank({ - * model: "model", - * query: "query", - * documents: ["documents"] + * documents: ["Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."], + * query: "What is the capital of the United States?", + * top_n: 3, + * model: "rerank-v3.5" * }) */ - public async rerank( + public rerank( request: Cohere.V2RerankRequest, - requestOptions?: V2.RequestOptions - ): Promise { + requestOptions?: V2.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__rerank(request, requestOptions)); + } + + private async __rerank( + request: Cohere.V2RerankRequest, + 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/rerank" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CohereEnvironment.Production, + "v2/rerank", ), method: "POST", headers: { @@ -442,63 +543,54 @@ export class V2 { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.17.1", - "User-Agent": "cohere-ai/7.17.1", + "X-Fern-SDK-Version": "7.18.0", + "User-Agent": "cohere-ai/7.18.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", requestType: "json", - body: serializers.V2RerankRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.V2RerankResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Cohere.V2RerankResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Cohere.BadRequestError(_response.error.body); + throw new Cohere.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: - throw new Cohere.UnauthorizedError(_response.error.body); + throw new Cohere.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); case 403: - throw new Cohere.ForbiddenError(_response.error.body); + throw new Cohere.ForbiddenError(_response.error.body as unknown, _response.rawResponse); case 404: - throw new Cohere.NotFoundError(_response.error.body); + throw new Cohere.NotFoundError(_response.error.body as unknown, _response.rawResponse); case 422: - throw new Cohere.UnprocessableEntityError(_response.error.body); + throw new Cohere.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); case 429: - throw new Cohere.TooManyRequestsError(_response.error.body); + throw new Cohere.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); case 498: - throw new Cohere.InvalidTokenError(_response.error.body); + throw new Cohere.InvalidTokenError(_response.error.body as unknown, _response.rawResponse); case 499: - throw new Cohere.ClientClosedRequestError(_response.error.body); + throw new Cohere.ClientClosedRequestError(_response.error.body as unknown, _response.rawResponse); case 500: - throw new Cohere.InternalServerError(_response.error.body); + throw new Cohere.InternalServerError(_response.error.body as unknown, _response.rawResponse); case 501: - throw new Cohere.NotImplementedError(_response.error.body); + throw new Cohere.NotImplementedError(_response.error.body as unknown, _response.rawResponse); case 503: - throw new Cohere.ServiceUnavailableError(_response.error.body); + throw new Cohere.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); case 504: - throw new Cohere.GatewayTimeoutError(_response.error.body); + throw new Cohere.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); default: throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } } @@ -508,12 +600,14 @@ export class V2 { throw new errors.CohereError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.CohereTimeoutError("Timeout exceeded when calling POST /v2/rerank."); case "unknown": throw new errors.CohereError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -522,7 +616,8 @@ export class V2 { 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.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable", }); } diff --git a/src/api/resources/v2/client/index.ts b/src/api/resources/v2/client/index.ts index 415726b7..195f9aa8 100644 --- a/src/api/resources/v2/client/index.ts +++ b/src/api/resources/v2/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export * from "./requests/index.js"; diff --git a/src/api/resources/v2/client/requests/V2ChatRequest.ts b/src/api/resources/v2/client/requests/V2ChatRequest.ts index f5d45ecf..94588d83 100644 --- a/src/api/resources/v2/client/requests/V2ChatRequest.ts +++ b/src/api/resources/v2/client/requests/V2ChatRequest.ts @@ -2,16 +2,93 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example * { - * model: "model", + * model: "command-a-03-2025", * messages: [{ - * role: "tool", - * toolCallId: "messages", - * content: "messages" + * role: "user", + * content: "Tell me about LLMs" + * }] + * } + * + * @example + * { + * model: "command-r", + * documents: [{ + * data: { + * "content": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak." + * } + * }, { + * data: { + * "content": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold." + * } + * }, { + * data: { + * "content": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters", + * "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers." + * } + * }, { + * data: { + * "content": "CSPC: NSYNC Popularity Analysis - ChartMasters", + * "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures." + * } + * }], + * messages: [{ + * role: "user", + * content: "Who is more popular: Nsync or Backstreet Boys?" + * }] + * } + * + * @example + * { + * model: "command-r", + * messages: [{ + * role: "user", + * content: "Tell me about LLMs" + * }], + * tools: [{ + * type: "function", + * function: { + * name: "query_daily_sales_report", + * description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.", + * parameters: { + * "type": "object", + * "properties": { + * "day": { + * "description": "Retrieves sales data for this day, formatted as YYYY-MM-DD.", + * "type": "str" + * } + * }, + * "required": [ + * "day" + * ], + * "x-fern-type-name": "tools-by6k68" + * } + * } + * }, { + * type: "function", + * function: { + * name: "query_product_catalog", + * description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.", + * parameters: { + * "type": "object", + * "properties": { + * "category": { + * "description": "Retrieves product information data for all products in this category.", + * "type": "str" + * } + * }, + * "required": [ + * "category" + * ], + * "x-fern-type-name": "tools-o09qd6" + * } + * } * }] * } */ @@ -23,23 +100,18 @@ export interface V2ChatRequest { * A list of available tools (functions) that the model may suggest invoking before producing a text response. * * When `tools` is passed (without `tool_results`), the `text` content in the response will be empty and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty. - * */ tools?: Cohere.ToolV2[]; /** * When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools). * * **Note**: The first few requests with a new set of tools will take longer to process. - * */ - strictTools?: boolean; - /** - * A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata. - * - */ - documents?: Cohere.V2ChatRequestDocumentsItem[]; - citationOptions?: Cohere.CitationOptions; - responseFormat?: Cohere.ResponseFormatV2; + strict_tools?: boolean; + /** A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata. */ + documents?: V2ChatRequest.Documents.Item[]; + citation_options?: Cohere.CitationOptions; + response_format?: Cohere.ResponseFormatV2; /** * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. * When `OFF` is specified, the safety instruction will be omitted. @@ -49,28 +121,22 @@ export interface V2ChatRequest { * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). * * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - * */ - safetyMode?: Cohere.V2ChatRequestSafetyMode; + safety_mode?: V2ChatRequest.SafetyMode; /** * The maximum number of tokens the model will generate as part of the response. * * **Note**: Setting a low value may result in incomplete generations. - * - */ - maxTokens?: number; - /** - * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. - * */ - stopSequences?: string[]; + max_tokens?: number; + /** A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. */ + stop_sequences?: string[]; /** * Defaults to `0.3`. * * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. * * Randomness can be further maximized by increasing the value of the `p` parameter. - * */ temperature?: number; /** @@ -78,40 +144,65 @@ export interface V2ChatRequest { * deterministically, such that repeated requests with the same * seed and parameters should return the same result. However, * determinism cannot be totally guaranteed. - * */ seed?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. - * */ - presencePenalty?: number; + presence_penalty?: number; /** * Ensures that only the top `k` most likely tokens are considered for generation at each step. When `k` is set to `0`, k-sampling is disabled. * Defaults to `0`, min value of `0`, max value of `500`. - * */ k?: number; /** * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - * */ p?: number; - /** Whether to return the prompt in the response. */ - returnPrompt?: boolean; + /** Defaults to `false`. When set to `true`, the log probabilities of the generated tokens will be included in the response. */ + logprobs?: boolean; /** - * Defaults to `false`. When set to `true`, the log probabilities of the generated tokens will be included in the response. + * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. + * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. + * If tool_choice isn't specified, then the model is free to choose whether to use the specified tools or not. + * + * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. * + * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. */ - logprobs?: boolean; + tool_choice?: V2ChatRequest.ToolChoice; +} + +export namespace V2ChatRequest { + export type Documents = Documents.Item[]; + + export namespace Documents { + export type Item = string | Cohere.Document; + } + + /** + * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. + * When `OFF` is specified, the safety instruction will be omitted. + * + * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. + * + * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). + * + * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. + */ + export type SafetyMode = "CONTEXTUAL" | "STRICT" | "OFF"; + export const SafetyMode = { + Contextual: "CONTEXTUAL", + Strict: "STRICT", + Off: "OFF", + } as const; /** * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. @@ -120,7 +211,10 @@ export interface V2ChatRequest { * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. * * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. - * */ - toolChoice?: Cohere.V2ChatRequestToolChoice; + export type ToolChoice = "REQUIRED" | "NONE"; + export const ToolChoice = { + Required: "REQUIRED", + None: "NONE", + } as const; } diff --git a/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts b/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts index 5c6bcf26..36b14edc 100644 --- a/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts +++ b/src/api/resources/v2/client/requests/V2ChatStreamRequest.ts @@ -2,16 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example * { - * model: "model", + * model: "command-r", * messages: [{ - * role: "tool", - * toolCallId: "messages", - * content: "messages" + * role: "user", + * content: "Hello!" * }] * } */ @@ -23,23 +22,18 @@ export interface V2ChatStreamRequest { * A list of available tools (functions) that the model may suggest invoking before producing a text response. * * When `tools` is passed (without `tool_results`), the `text` content in the response will be empty and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty. - * */ tools?: Cohere.ToolV2[]; /** * When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools). * * **Note**: The first few requests with a new set of tools will take longer to process. - * - */ - strictTools?: boolean; - /** - * A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata. - * */ - documents?: Cohere.V2ChatStreamRequestDocumentsItem[]; - citationOptions?: Cohere.CitationOptions; - responseFormat?: Cohere.ResponseFormatV2; + strict_tools?: boolean; + /** A list of relevant documents that the model can cite to generate a more accurate reply. Each document is either a string or document object with content and metadata. */ + documents?: V2ChatStreamRequest.Documents.Item[]; + citation_options?: Cohere.CitationOptions; + response_format?: Cohere.ResponseFormatV2; /** * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. * When `OFF` is specified, the safety instruction will be omitted. @@ -49,28 +43,22 @@ export interface V2ChatStreamRequest { * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). * * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - * */ - safetyMode?: Cohere.V2ChatStreamRequestSafetyMode; + safety_mode?: V2ChatStreamRequest.SafetyMode; /** * The maximum number of tokens the model will generate as part of the response. * * **Note**: Setting a low value may result in incomplete generations. - * - */ - maxTokens?: number; - /** - * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. - * */ - stopSequences?: string[]; + max_tokens?: number; + /** A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. */ + stop_sequences?: string[]; /** * Defaults to `0.3`. * * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. * * Randomness can be further maximized by increasing the value of the `p` parameter. - * */ temperature?: number; /** @@ -78,40 +66,65 @@ export interface V2ChatStreamRequest { * deterministically, such that repeated requests with the same * seed and parameters should return the same result. However, * determinism cannot be totally guaranteed. - * */ seed?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. - * */ - frequencyPenalty?: number; + frequency_penalty?: number; /** * Defaults to `0.0`, min value of `0.0`, max value of `1.0`. * Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. - * */ - presencePenalty?: number; + presence_penalty?: number; /** * Ensures that only the top `k` most likely tokens are considered for generation at each step. When `k` is set to `0`, k-sampling is disabled. * Defaults to `0`, min value of `0`, max value of `500`. - * */ k?: number; /** * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. * Defaults to `0.75`. min value of `0.01`, max value of `0.99`. - * */ p?: number; - /** Whether to return the prompt in the response. */ - returnPrompt?: boolean; + /** Defaults to `false`. When set to `true`, the log probabilities of the generated tokens will be included in the response. */ + logprobs?: boolean; /** - * Defaults to `false`. When set to `true`, the log probabilities of the generated tokens will be included in the response. + * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. + * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. + * If tool_choice isn't specified, then the model is free to choose whether to use the specified tools or not. * + * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. + * + * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. */ - logprobs?: boolean; + tool_choice?: V2ChatStreamRequest.ToolChoice; +} + +export namespace V2ChatStreamRequest { + export type Documents = Documents.Item[]; + + export namespace Documents { + export type Item = string | Cohere.Document; + } + + /** + * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. + * When `OFF` is specified, the safety instruction will be omitted. + * + * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. + * + * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). + * + * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. + */ + export type SafetyMode = "CONTEXTUAL" | "STRICT" | "OFF"; + export const SafetyMode = { + Contextual: "CONTEXTUAL", + Strict: "STRICT", + Off: "OFF", + } as const; /** * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. @@ -120,7 +133,10 @@ export interface V2ChatStreamRequest { * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. * * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. - * */ - toolChoice?: Cohere.V2ChatStreamRequestToolChoice; + export type ToolChoice = "REQUIRED" | "NONE"; + export const ToolChoice = { + Required: "REQUIRED", + None: "NONE", + } as const; } diff --git a/src/api/resources/v2/client/requests/V2EmbedRequest.ts b/src/api/resources/v2/client/requests/V2EmbedRequest.ts index 56131f6a..4660978c 100644 --- a/src/api/resources/v2/client/requests/V2EmbedRequest.ts +++ b/src/api/resources/v2/client/requests/V2EmbedRequest.ts @@ -2,62 +2,69 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../../index"; +import * as Cohere from "../../../../index.js"; /** * @example * { - * model: "model", - * inputType: "search_document", - * embeddingTypes: ["float"] + * texts: ["hello", "goodbye"], + * model: "embed-v4.0", + * input_type: "classification", + * embedding_types: ["float"] + * } + * + * @example + * { + * model: "embed-v4.0", + * input_type: "image", + * embedding_types: ["float"], + * images: ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gAfQ29tcHJlc3NlZCBieSBqcGVnLXJlY29tcHJlc3P/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIAZABkAMBIgACEQEDEQH/xAAdAAEAAQQDAQAAAAAAAAAAAAAABwEFBggCAwQJ/9oACAEBAAAAAN/gAAAAAAAAAAAAAAAAAAAAAAAAAAHTg9j6agAAp23/ADjsAAAPFrlAUYeagAAArdZ12uzcAAKax6jWUAAAAO/bna+oAC1aBxAAAAAAbM7rVABYvnRgYAAAAAbwbIABw+cMYAAAAAAvH1CuwA091RAAAAAAbpbPAGJfMXzAAAAAAJk+hdQGlmsQAAAAABk31JqBx+V1iAAAAAALp9W6gRp826AAAAAAGS/UqoGuGjwAAAAAAl76I1A1K1EAAAAAAG5G1ADUHU0AAAAAAu/1Cu4DVbTgAAAAAA3n2JAIG0IAAAAAArt3toAMV+XfEAAAAAL1uzPlQBT5qR2AAAAAenZDbm/AAa06SgAAAAerYra/LQADp+YmIAAAAC77J7Q5KAACIPnjwAAAAzbZzY24gAAGq+m4AAA7Zo2cmaoAAANWdOOAAAMl2N2TysAAAApEOj2HgAOyYtl5w5jw4zZPJyuGQ5H2AAAdes+suDUAVyfYbZTLajG8HxjgD153n3IAABH8QxxiVo4XPKpGlyTKjowvCbUAF4mD3AAACgqCzYPiPQAA900XAACmN4favRk+a9wB0xdiNAAAvU1cgAxeDcUoPdL0s1B44atQAACSs8AEewD0gM72I5jjDFiAAAPfO1QGL6z9IAlGdRgkaAAABMmRANZsSADls7k6kFW8AAAJIz4DHtW6AAk+d1jhUAAAGdyWBFcGgAX/AGnYZFgAAAM4k4CF4hAA9u3FcKi4AAAEiSEBCsRgAe3biuGxWAAACXsoAiKFgALttgs0J0AAAHpnvkBhOt4AGebE1pBtsAAAGeySA4an2wAGwEjGFxaAAAe+c+wAjKBgAyfZ3kUh3HAAAO6Yb+AKQLGgBctmb2HXDNjAAD1yzkQAENRF1gyvYG9AcI2wjgAByyuSveAAWWMcQtnoyOQs8qAPFhVh8HADt999y65gAAKKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAEFBgIEA//aAAgBAhAAAAAAAAAAAAABEAAJkBEAAB0CIAABMhyAAA6EQAAA6EQAABMiIAAAmREAAAmQiAABMgOQAEyAHIATIACIBMu7H3fT419eACEnps7DoPFQch889Wd3V2TeWIBV0o+eF8I0OrXVoAIyvBm8uDe2Wp6ADO+Mw9WDV6rSgAzvjMNWA1Op1AARlvmZbOA3NnpfSAK6iHnwfnFttZ9Wh7AeXPcB5cxWd3Wk7Pvb+uR8q+rgAAAAAAAAP//EABsBAQABBQEAAAAAAAAAAAAAAAAEAQIDBQYH/9oACAEDEAAAAAAAAAC20AL6gCNDxAArnn3gpro4AAv2l4QIgAAJWwGLVAAAX7cQYYAAFdyNZgAAAy7UazAAABsZI18UAAE6YEfWgACRNygavCACsmZkALNZjAMkqVcAC2FFoKyJWe+fMyYoMAAUw2L8t0jYzqhE0dAzd70eHj+PK7mcAa7UDN7VvBwXmDb7EAU5uw9C9KCnh2n6WoAaKIey9ODy/jN+ADRRD2fpQeY8P0QAU5zGel+gg8V53oc4AgaYTfcJ45Tx5I31wCPobQ2PpPRYuP8APMZm2kqoxQddQAAAAAAAAP/EAFMQAAEDAgIDCQkMBwUIAwAAAAECAwQFEQAGBzFREhMhMEBBYXGBCBQYIjJCRlDSFSBSVGJygpGTobHREDRDc6LBwiMzU3CyFiQlNVVkdISSlLP/2gAIAQEAAT8A/wAo74nVaBAb32bNYitfDfcS2PrURiZpU0dwVFMjN1OVY8O8u7//APkFYc076LmfSVSvmQpB/ox4QGjH/r7v/wBGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0YH0ge7IMj2ceEBowPpA92QZHs48IDRgfSB7sgyPZx4QGjA+kD3ZBkezjwgNGB9IHuyDI9nHhAaMD6QPdkGR7OPCA0Y89fd7IMj2cN6e9GDpCTmRaOuFI9nEDSlo9qakpj5upoJNgH3d4+50JxGlxpbSH4r7bzSvJW0sLSeop5NWsw0fL8RU2rVGPDjJ4C6+4EAnYnaegYzV3StDhFcfK1LdqDuoSZBLDHWlPlqxXtNmkOulaVVxcFg3/sYA73A+kLrxKnTJrpfmSXX3jrcdWVqPWVYudvJ7nbil16s0R7vikVSVDduCVR3lNk9e5IvjKfdG5rpKmo+Yo7NXi8ALlgxJH0kiysZL0l5Uzsz/AMFn2l7m7kJ8BuSj6PnAbU8ieeZitOPPuoQ22krWtZCUpSkXJJOoDGkHui4MBT1MyW2ibITdJnuA97o/dJ1uHFczFXMyzV1Gu1N+bJV57yr7kbEjUkdA5dGlSYb7UqJIcZfaUFtuNLKFoUNRSocIONF3dBb6tih58eSCQEM1PUOqT7eELS4lK0KCkkAgg3BB4/M2Z6NlKlSKtWJiI8VoWueFS1nUhA85ZxpJ0v13Pj7kNorg0NC7tw0K4XNi3yPKPRqHqLQnpkeoD8XKmZZJVSHCG4klw/qijqQs/wCF/pwDfjc1ZqpOUKNLrVXf3qMyLJSLFbrh8ltA51qxn7P9az9V1z6istxWypMSIhRLbCD+Kj5yvUYJHCMdz7pLXWoByfWJBXUILV4bizwvRk+Z0qa4yoTodKgyZ859DEWO0t11xZslCEC5UrGlHSNOz/XVvBa26RFKkQY+xHO4v5a/UtArU3LlZptbpzm4lQ30ut7DbWk9ChwHGXq5EzHQ6ZWoCv8AdpsdDyRrIKtaFdKTwHi+6I0hrffGRKU/ZloodqSkngW5rQz1I1n1P3M2ZzJpFYyvIXdUJ0SowP8AhP8AAtI6AvitIWbWclZVqlbWElxpvcRmz+0kOcDaf5nEyXJnypM2Y8p2Q+6t11xRupa1m6lHpJ9T6B6uaVpHo7alEMz0PQnepxN0/wASRgauJ7pTNZmVynZTjuXZpzYkSRtkPDgB6UI9UZMlrgZsy1MQqxZqkRy/QHRfA4iZIaiRX5D6ghpptTi1bEIFycZmrL2YcwVitvk7ubLdfsfNClcCewcHqiiX91qbbX3yz/rGBxGmKse4ujnMz6F2dfjiGj/2VBs/ccE3J9UZOirm5ry3EQm5eqkRu3Qp0YHEd01PLGUqPT0mxk1QLV0oZaPteqdBtKNV0kUIkXah77Md6mkcH8RGBq4jupH7JyXG/wDPcP1tj1T3MuWVMQK5mt9FjJWmDGO1tHjuHqJ4nupEnvrJa+beZ4/jR6ooNGnZhrFOotNa3yXMeS02OvWo9CRwk4ytQIeWKDS6HC/V4TCWgq1itWtSz0rPCeJ7qKNenZSl2/upEtonpcShXqcC+NA+jFeW4H+1NbYKatOaswysWMaOrbscc4rujaYZuj/vzccMCpR3yehwFn+r1MAVGwGNDOhVbK4ubc4xLLFnYMB1PCNjrw/BHF58opzDk7MlHSndOSID28ja6gbtH3jChZRHqShZerOZag1S6JT3pcpzUhsahtUTwJTtJxow0G0vKRYreYS1PrIAUhNrx4yvkA+WsfCONXFnGlTLZytnqvU5KLRlvmTG2Fl/xwB0J1eookOXPkNRYUZ1991W5baaQVrWdiUi5JxkbudKzVCzOzg+abE196NWXKWOnWlvGW8p0DKMEU6g01qKzwFe5F1uEDynFnhUeO7pTJ5n0aBmyK3d+mneJVtZjOnxVfQX6ghwZtRktQ4EV6RJcNkNMoK1qOwJTcnGTe5yr9V3qXmuSKXFNj3uizkpY/0oxlbIOVslRt6oVKaZdIst9XjyHPnOK4ezkFVgw6vAmU2ewHYsllbDiFaloWNyoYz1lKZknMtRoEu6gyvdMO8zrC/IXy2j0Cs5glpg0WmyJkk+YwgrIG1WwdJxk7uap75amZyqQit6zChkLe6lueSnGWcl5ayjGEegUliKCAFuAbp5z57irqPI9NOjVOdqB31T2x7tU5KlxNryNa2CenWnDra2XFtOoUhaFFKkqFiCOAgg8qyro7zdnJwCh0Z5xi9lSVje46etarA22DGUe5spEPe5ebqgue78Ui3aj9Sl+WvFIodHoMREGj02PDjJ1NMNhAJ2m2s8m07aIHJi5WdMsxSZFiuoxG08LoGt9sDz/hjGrkzLD0hxDLDSluLISlKQSpRPMAMZU0C54zFvcidHTR4Sv2k24dI+SyPG+u2MqaBskZc3qRLimrzEftZoBaB+S0PFw0y2y2hppCUIQAEpSAAAOYAauU6XtBJmuycy5LjASVXcl05sWDu1bGxe1GHWnGXFtOoUhxCilSVAghSTYgg6iOR5eyfmXNT/AHvQKNJmKBspTaLNo+es2SntOMq9zNIc3uTm+sBoazEgWWvtdWLDGWchZTyk2E0KiR4zlrKkEbt9XW4u6uW6SNDNAzwHZ7BTTq3YkSm0XS7sS+ka/na8ZuyJmbJMwxK9T1NJJs1IR47D3S2vj2mXXlobabUtaiAlKRcknUAMZV0F56zJvT8iEKVCVY77PuhZHyWvLxlTuesl0Te3qqlysy08JMnxI4PQ0n+onEWDFhMNxokdphhsWQ20gIQkbEpFgPeyqnBg/rMhCCBfc3ur6hw4lZ1hNbpMdlbpGokhKT+OHs7zVf3EdpHzgVfzGDnGqnnbHUkYGcqqOZo/OT+VsMZ5eBG/w0K2lJKPaxDzfTJBCXFLZUTbxk3+q2GJTEhAcYdQtB1KSoEckqdLp1ThvQqnEZkxXU7lbLyAtCusKxnPubKVNU9NyhOMB03Pekm7kfsXwqRjM+jfOWUVLNZochEcapLY31gj56LgduLHZxNjjL+TM0ZpcDdCokuWL2LiEWaSflOKskYyt3M8t0tSM31hLCNZiwbLc7XVCwxljR9lHKDaRQ6Kww6BZUlQ32Qr6a7nAAHvFLSkEqUAAMT81UyGClDm/r2N6u1WKhm2oywpDKt4bPMjX/8ALC3HHCVLWSSbm+338adLhuB2O+tChzg4pOdOFDVRRbm31A/EflhiQ1IbS6y4laFaik3HJCkKBBAII4RjMOibIOYCtc/LkZD6tb0W8Zy+0luwVisdzDRX925RMyS4uxMtlD46gUFGKj3NWdY11wajSpbf71bS/qUnErQTpPjXIy2Xk7WZLCv68L0R6R2/KylO+ikK/A4Tom0jL1ZRqHa3bEXQjpPlkBGVXkDa48yj8V4p/c358lEGW/TIaOcOSCtfYG0qxSO5gp6AldczQ+9tbhsBr+NwqxRNDWjygFDjGXmpL4N99nEyVH6K/FGGmGY7SGm20oQgAJSkAJAHMAPeyJ8WEjfJD6EX1XP4DWTioZ1ZRdEBndnmWvgT2DE6tVCoE98SFFPMgGyR2DBN+E8XSq3MpToUyu7ZIK0HUcUmsRapGK46wlfBuknWnk5AOsY3I2YsNmLAagPf1HMFNp+6S68FOD9mjhV+QxUM5THrohJDKNutWHpL8halvOqWo6yokk8fT58inSESI6ylST2EbDtGKRU49VitvtkJI8tOsg7OOJA1nFSzhQKaVIkT21OA23DV3Fdu51Yk6VICCREpzznS4pKPw3WDpXk34KOgD9+fZwxpWB4JNIIG1D1/xTinaSMvylJDy3YyjwDfUXH1pviFPhTGw/FkNuoOpbagofdxU2fHhMqekOBDadus4q+bJcwqahkssfxnrOFKKjckk8iodWcpUxDySS2rgcTfWMMPtvstvNKCkLSFJI5weMzFm6mZfQUvL32UQCiOg+N1q2DFbzlWa2paXHyzGOplolKbfKOtWLnb72FUp9NeD8GU4y4OdBtfr2jGW9JTbqm4tdQlCr2D6fIPzxzYadbdQhxpYUlQBBBuCD7+pVKPTIq5D6uAcCUjWpWwYqtWlVV9Tr6yE6kIHkpHJcl1cqS5TXjfc+O3f7xxedc6IoqTAgEKnqHCdYZB5ztVsGH5D0p5x+Q6px1ZKlKUbknico5zk0J5EWWtTtPWeFOstdKejaMR5TMxhuQw4lbTiQpKkm4UD7151thtbriwlCElSidQAxXaw7VZalXsyglLadg/M8mpstcKbHko1oWDbb0duGXEOtIcQbpUkKB2g8Tm3MSMv0xbySDJduhhB+FtPQMSJD0p5yRIcK3XFFSlK1kni9HealU+UijzFjvZ5X9iVHyHDzdSve5yqqm2kU5pViuynCNnMOUZVld80lgKsVNEtns4QPqPEKNgTjOdbVWq0+tC7xmCWmRzWTrV2njEqUhQUkkEG4Ixk6ue7dFjPuuXeau08Plp5+0cP6VrS22pSiAACSdgGKpMXPnSJK/PWSBsHMOzlGRX/EmsW8koWOs3B4jONTNNoNQkIUUr3ve27awpzxb4PCTxujGpKYqkinKV4klvdJ+e3+nMkjvakS1DWtIb7FcB+7BNyTyjI67S5CDzsqP1EcRpUkqRTqfFBtvr6l9iE2/nx2V5XeeYKS9/3CEdizuD+OEm4/RnVak0+OhJtd256gm38+U5JTeY+rYyofeniNKyjv8AR0c24f8AxTx1NJTUYKhrD7Z/iGEeSP0Z63Pe8Xc6hur9dxynI7JtNeOqyAO0m/EaVv1mj/Mf/FPHU7/mEL98j8cI8gfozq2pdOZWnmdseopJ5TlKIWKShZFi8tSz2eL/AC4jSsx/Y0qR8FbqD9IA8dQmFSK1S2UjypTQ7N0L4SLJ/RmOOJVIloSk+Ijdjb4nCcEWJB5PDjrlSWWGxdS1hI7TiHHRGjsso8htCUDqSLcRpDppl5ckLABXHUl8DYBwH7jx2juAZeYmXyk7iM2t07L23I/HA/QtIWkpULggjFXgqp8+RHINkrO5O0axyfJlLK3l1F1Pit3S3cecRr7BxMqM3IjusOpCkOoKVjakixGKzTXaTU5cB4HdNOEAnzk6we0cbo3o5g0hU91FnZhCh+7T5PvM6UjfWkTmE3W0LObSnmPZyanQHqjKajMjhUeE2uANpxAhNQYzTDabNtpsOk85PXxWkjLJmRk1mGjdPR0WdA85rb9HjMqUByv1Rtgg97N2W+vYjZ1qww02y2htCQlCEhKUjUAPeLQlxCkLAUlQsQdRBxmKiOUqWopSox1m6FHht0HkjDDsl1DLKCpajYAYoFFRSYw3dlSF8K1bPkji1JCgUkXBxnjJTlJecqVOZvCWbrQn9kT/AEniqVSplYmNQoTRW4s9iRzqUeYDGXaBFoFPbiMC6/KdctYrVt/Ie+qECNMjKjyE7oLHaOkYrVEkUl8hQKmVE7hY1HkUOFInPoYjtla1bMUDLzNKb3xyy5KvKXzDoTxrjaHEKQ4gKSoWIIuCDzYzTo5WlTk2ggEG6lxr6vmH+WHmXWHFtPNqQ4k2UlQIIOwg+/y/lCq19xKm2yzFv4z7g8X6I844oOXoFBiiPDb4TYuOny1kbTxEmOxKaVHebS4hXlA4rWTpEdSnqfdxu5JR5w6tuFtONKKXEFJBsQeOShSzZIvilZTnTShySCwyfhDxj1DFPpcSmtBuM0B8JR4VK6zyCr5apFaQROiJWsCwdT4qx1KGKloseG7XSp4UnmQ+LfxJxJyLmaMoj3OU4n4TakqwrLVfSbGjy/sV4ZyhmN/yKRI+kncf6rYhaM64+QZa2YyOk7tQ7E4o+jyiU0h2SgzHhzu+R2I/PCEIbASgAJAsAOLqFFp84HvphKlkCyhwK4OnZiXkcElUKV9Fz2hh/KdZataPuwfOSoEYXQqog2MJ49Taj/LHuNVPiEj7Jf5Y9xqp8QkfZL/LHuNVPiEj7Jf5Y9xqp8QkfZL/ACx7jVT4hI+yX+WPcaqfEJH2S/yx7jVT4hI+yX+WEUCquaoTw+chQ/EYYyjWHQSpgN9K1C33XOIuR0+VMlfRbH8ziFRKdTwksRkhY89XjK+/VyWwxYf5ef/EADgRAAIBAgMDCQUHBQAAAAAAAAECAwQRAAUgMUFhEhMhIjBAUXGREDJQU6EGFDNCYoGSUnKiwdH/2gAIAQIBAT8A+L37e/wE9zHfj3k90Gk90Gk9ztqPcbd3t3e3b2129qRySGyIScRZY56ZXtwGFoKZfyX8zj7rT/JX0w+X0zbFKngcTZdLHdozyx9cbOg9pbFtENJPNYqlh4nEOWxJYykufQYVFQWRQBw1VVGk4LKAJPHxwysjFWFiNUsscKGSVwqjecVOfgErSxX/AFNhs5r2P4oHkoxHndchHKZXHFf+YpM7gnISYc0/+J0KpYhVFycUtCkQDygM/huHZZjThl59R1l97iNMsqQxvLIbKoucV1dLWykkkRg9VdOUZmyOtLO10PQhO4+Hty6mCrz7jpPu+XZsoZSp2EEYkQxyOh/KSNGf1JAipVO3rNq2EHGW1P3mkikJ6w6reYxGpd0QbyBhVCqFGwC3aV4tUycbHRnLFq+UeAUfTX9nmJhqE3BwfUYoxeqi8+1ryDVPwA0ZwCMwm4hT9Nf2eB5qobcWUfTFM3Inib9Q7QkAEnYMSvzkrv4knRn8BEkVQB0Ecg+Y15RTmCij5Qsz9c/v7KWYTQo28dDefZ5hUBI+aU9Z9vAaamnSqheF9jD0OKmmlpZWilFiNh3Eacqy9quUSSLaFDc8T4YAt7KWpNPJfap94YR1kUOhuD2NTVJTr4vuGHdpHZ3NydVVSQVaciZfIjaMVOR1URJhtKvocNSVSmzU8gP9pxHQVkhASnf9xbFJkJuHq2Fv6F/2cIiRoqIoVQLADRBUSwG6Ho3g7DiLMYX6Huh9RgTwtslT1GOdi+YnqMc7F8xP5DHOxfMT+Qxz0XzE9Rh6ymTbKD5dOJsyY3WFbcThmZiWYkk7z8W//8QAOREAAgECAgYHBwMDBQAAAAAAAQIDAAQFERITICExkQYwQVFSYXEQFCJAQlOBMlChI4KSYnJzsbL/2gAIAQMBAT8A/YCyjiwFa2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8Y51rY/GOda2PxjnWtj8YoMp4EHq5LlV3LvNPNI/FuXW5kcDUdw6cd4pJFkGanbJABJqacvmq7l+RR2Rgy0jiRQw2rmXM6CncOPydq+T6B4HZmfQjJ7eA+UQ6LqfMbN229V/Pyg4j1GzcnOVvlIV0pFH52bgZSt8pbRaC6TcTs3YycHvHyQBJAFQ2+WTyfgbVymlHmOI+Rjt3fe3wio4kj4Df39RNGY38jw60AscgMzSWrHe5yFJEkfBd/f1UiLIpU1JG0ZyPVJE7/pWktRxc/gUqKgyVQOtZVcZMMxUlqw3pvHdRBU5EEbIBO4CktpG3t8IpLeNOzM+fsSN5DkikmosPY75Wy8hS2duv0Z+te7wfaXlT2Nu3BSvoalsJE3xnTH81vG49UVVtzAGjbRH6cq90TxGvdE8RoW0Q7M6Cqu5VA9kVrNLvC5DvNRWEa75CWPIUqqgyVQB5bVzarMCy7n7++mUoxVhkRtW9tPdypBbRNJI3BVFYf0FdlWTErnQP24uP5JqLojgUYyNqznvZ2q46GYLKDq0khPejk/8ArOsU6HX1irTWre8xDeQBk4/FHduPtALEKozJq3skjAaQaT/wOqv4NJdco3jj6bNtby3c8VtAulJIwVRWCYJb4PbKqqGnYDWSdpPcPLZ6V9HEmikxOxjAlQaUqL9Q7x5+2xgCrrmG8/p9OrIDAg8CKkTQd07iRsdBcPV3ucSkX9H9KP1O8naIBBBG410gsBh2K3MCDKNjrE/2tSLpuqDtIFKAqhRwA6y9GVw/mAdjohEEwK2I4u0jH/Lb6exgXljL2tEwP9pq0GdzF69bfHO4fyAGx0ScPgVpl9JkB/yO309cG6w9O0ROeZq3bQnib/UOsJyBJqV9ZI7952Ogl8DDdYezfEra1B5HcdvpTfC+xicoc44QIl/t4/z7LaUTRK3bwPr1d9PoJqlPxN/A2cOvpsNvIbyA/Eh3jvHaDWHYjbYnapdWzgg/qHap7js9JseTDLZreBwbuVSAB9AP1GiSSSeJ9ltcGB8/pPEUjq6hlOYPU3FykC97dgp3aRi7HMnaw3FbzCptdaSZeJDvVh5isO6aYdcqq3gNvJ25705ikxXDJAGS/gI/5FqfHMIt10pb+H0DBjyGdYr03XRaLCojnw1sg/6FTTSzyPNNIXkc5szHMnYhuJIDmh3doPCo7+F9z5oaE0R4SrzrWR/cXnWsj+4vOtZH9xeYrWx/cXmKe6gTjID6b6lxAnMQrl5mmYsSzEkn92//2Q=="] * } */ export interface V2EmbedRequest { - /** An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality. */ + /** An array of strings for the model to embed. Maximum number of texts per call is `96`. */ texts?: string[]; /** * An array of image data URIs for the model to embed. Maximum number of images per call is `1`. * * The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB. - */ - images?: string[]; - /** - * Defaults to embed-english-v2.0 - * - * The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID. - * - * Available models and corresponding embedding dimensions: * - * * `embed-english-v3.0` 1024 - * * `embed-multilingual-v3.0` 1024 - * * `embed-english-light-v3.0` 384 - * * `embed-multilingual-light-v3.0` 384 - * - * * `embed-english-v2.0` 4096 - * * `embed-english-light-v2.0` 1024 - * * `embed-multilingual-v2.0` 768 + * Image embeddings are supported with Embed v3.0 and newer models. */ + images?: string[]; + /** ID of one of the available [Embedding models](https://docs.cohere.com/docs/cohere-embed). */ model: string; - inputType: Cohere.EmbedInputType; + input_type: Cohere.EmbedInputType; /** An array of inputs for the model to embed. Maximum number of inputs per call is `96`. An input can contain a mix of text and image components. */ inputs?: Cohere.EmbedInput[]; /** The maximum number of tokens to embed per input. If the input text is longer than this, it will be truncated according to the `truncate` parameter. */ - maxTokens?: number; + max_tokens?: number; /** * The number of dimensions of the output embedding. This is only available for `embed-v4` and newer models. * Possible values are `256`, `512`, `1024`, and `1536`. The default is `1536`. */ - outputDimension?: number; + output_dimension?: number; /** * Specifies the types of embeddings you want to get back. Can be one or more of the following types. * - * * `"float"`: Use this when you want to get back the default float embeddings. Valid for all models. - * * `"int8"`: Use this when you want to get back signed int8 embeddings. Valid for only v3 models. - * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Valid for only v3 models. - * * `"binary"`: Use this when you want to get back signed binary embeddings. Valid for only v3 models. - * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Valid for only v3 models. + * * `"float"`: Use this when you want to get back the default float embeddings. Supported with all Embed models. + * * `"int8"`: Use this when you want to get back signed int8 embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models. + * * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models. */ - embeddingTypes: Cohere.EmbeddingType[]; + embedding_types?: Cohere.EmbeddingType[]; + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + truncate?: V2EmbedRequest.Truncate; +} + +export namespace V2EmbedRequest { /** * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. * @@ -65,5 +72,10 @@ export interface V2EmbedRequest { * * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. */ - truncate?: Cohere.V2EmbedRequestTruncate; + export type Truncate = "NONE" | "START" | "END"; + export const Truncate = { + None: "NONE", + Start: "START", + End: "END", + } as const; } diff --git a/src/api/resources/v2/client/requests/V2RerankRequest.ts b/src/api/resources/v2/client/requests/V2RerankRequest.ts index b3dc57bb..111735d8 100644 --- a/src/api/resources/v2/client/requests/V2RerankRequest.ts +++ b/src/api/resources/v2/client/requests/V2RerankRequest.ts @@ -5,9 +5,10 @@ /** * @example * { - * model: "model", - * query: "query", - * documents: ["documents"] + * documents: ["Carson City is the capital city of the American state of Nevada.", "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.", "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", "Capital punishment has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."], + * query: "What is the capital of the United States?", + * top_n: 3, + * model: "rerank-v3.5" * } */ export interface V2RerankRequest { @@ -25,12 +26,7 @@ export interface V2RerankRequest { */ documents: string[]; /** Limits the number of returned rerank results to the specified value. If not passed, all the rerank results will be returned. */ - topN?: number; - /** - * - If false, returns results without the doc text - the api will return a list of {index, relevance score} where index is inferred from the list passed into the request. - * - If true, returns results with the doc text passed in - the api will return an ordered list of {index, text, relevance score} where index + text refers to the list passed into the request. - */ - returnDocuments?: boolean; + top_n?: number; /** Defaults to `4096`. Long documents will be automatically truncated to the specified number of tokens. */ - maxTokensPerDoc?: number; + max_tokens_per_doc?: number; } diff --git a/src/api/resources/v2/client/requests/index.ts b/src/api/resources/v2/client/requests/index.ts index 8130c964..d16a369b 100644 --- a/src/api/resources/v2/client/requests/index.ts +++ b/src/api/resources/v2/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type V2ChatStreamRequest } from "./V2ChatStreamRequest"; -export { type V2ChatRequest } from "./V2ChatRequest"; -export { type V2EmbedRequest } from "./V2EmbedRequest"; -export { type V2RerankRequest } from "./V2RerankRequest"; +export { type V2ChatStreamRequest } from "./V2ChatStreamRequest.js"; +export { type V2ChatRequest } from "./V2ChatRequest.js"; +export { type V2EmbedRequest } from "./V2EmbedRequest.js"; +export { type V2RerankRequest } from "./V2RerankRequest.js"; diff --git a/src/api/resources/v2/index.ts b/src/api/resources/v2/index.ts index c9240f83..f095e147 100644 --- a/src/api/resources/v2/index.ts +++ b/src/api/resources/v2/index.ts @@ -1,2 +1,2 @@ -export * from "./types"; -export * from "./client"; +export * from "./types/index.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/v2/types/V2ChatRequestDocumentsItem.ts b/src/api/resources/v2/types/V2ChatRequestDocumentsItem.ts deleted file mode 100644 index 6167643d..00000000 --- a/src/api/resources/v2/types/V2ChatRequestDocumentsItem.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../../../index"; - -export type V2ChatRequestDocumentsItem = string | Cohere.Document; diff --git a/src/api/resources/v2/types/V2ChatRequestSafetyMode.ts b/src/api/resources/v2/types/V2ChatRequestSafetyMode.ts deleted file mode 100644 index 3ed6d6f9..00000000 --- a/src/api/resources/v2/types/V2ChatRequestSafetyMode.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. - * When `OFF` is specified, the safety instruction will be omitted. - * - * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. - * - * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). - * - * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - */ -export type V2ChatRequestSafetyMode = "CONTEXTUAL" | "STRICT" | "OFF"; -export const V2ChatRequestSafetyMode = { - Contextual: "CONTEXTUAL", - Strict: "STRICT", - Off: "OFF", -} as const; diff --git a/src/api/resources/v2/types/V2ChatRequestToolChoice.ts b/src/api/resources/v2/types/V2ChatRequestToolChoice.ts deleted file mode 100644 index e0232ac5..00000000 --- a/src/api/resources/v2/types/V2ChatRequestToolChoice.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. - * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. - * If tool_choice isn't specified, then the model is free to choose whether to use the specified tools or not. - * - * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. - * - * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. - */ -export type V2ChatRequestToolChoice = "REQUIRED" | "NONE"; -export const V2ChatRequestToolChoice = { - Required: "REQUIRED", - None: "NONE", -} as const; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts b/src/api/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts deleted file mode 100644 index 964db9f5..00000000 --- a/src/api/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../../../index"; - -export type V2ChatStreamRequestDocumentsItem = string | Cohere.Document; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestSafetyMode.ts b/src/api/resources/v2/types/V2ChatStreamRequestSafetyMode.ts deleted file mode 100644 index 62494ad8..00000000 --- a/src/api/resources/v2/types/V2ChatStreamRequestSafetyMode.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. - * When `OFF` is specified, the safety instruction will be omitted. - * - * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. - * - * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). - * - * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - */ -export type V2ChatStreamRequestSafetyMode = "CONTEXTUAL" | "STRICT" | "OFF"; -export const V2ChatStreamRequestSafetyMode = { - Contextual: "CONTEXTUAL", - Strict: "STRICT", - Off: "OFF", -} as const; diff --git a/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts b/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts deleted file mode 100644 index 1c1b9645..00000000 --- a/src/api/resources/v2/types/V2ChatStreamRequestToolChoice.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to control whether or not the model will be forced to use a tool when answering. When `REQUIRED` is specified, the model will be forced to use at least one of the user-defined tools, and the `tools` parameter must be passed in the request. - * When `NONE` is specified, the model will be forced **not** to use one of the specified tools, and give a direct response. - * If tool_choice isn't specified, then the model is free to choose whether to use the specified tools or not. - * - * **Note**: This parameter is only compatible with models [Command-r7b](https://docs.cohere.com/v2/docs/command-r7b) and newer. - * - * **Note**: The same functionality can be achieved in `/v1/chat` using the `force_single_step` parameter. If `force_single_step=true`, this is equivalent to specifying `REQUIRED`. While if `force_single_step=true` and `tool_results` are passed, this is equivalent to specifying `NONE`. - */ -export type V2ChatStreamRequestToolChoice = "REQUIRED" | "NONE"; -export const V2ChatStreamRequestToolChoice = { - Required: "REQUIRED", - None: "NONE", -} as const; diff --git a/src/api/resources/v2/types/V2EmbedRequestTruncate.ts b/src/api/resources/v2/types/V2EmbedRequestTruncate.ts deleted file mode 100644 index 5c1ed7cb..00000000 --- a/src/api/resources/v2/types/V2EmbedRequestTruncate.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - * - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - * - * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - */ -export type V2EmbedRequestTruncate = "NONE" | "START" | "END"; -export const V2EmbedRequestTruncate = { - None: "NONE", - Start: "START", - End: "END", -} as const; diff --git a/src/api/resources/v2/types/V2RerankResponse.ts b/src/api/resources/v2/types/V2RerankResponse.ts index d5eefd3a..3966ad3b 100644 --- a/src/api/resources/v2/types/V2RerankResponse.ts +++ b/src/api/resources/v2/types/V2RerankResponse.ts @@ -2,11 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../../../index"; +import * as Cohere from "../../../index.js"; export interface V2RerankResponse { id?: string; /** An ordered list of ranked documents */ - results: Cohere.V2RerankResponseResultsItem[]; + results: V2RerankResponse.Results.Item[]; meta?: Cohere.ApiMeta; } + +export namespace V2RerankResponse { + export type Results = Results.Item[]; + + export namespace Results { + export interface Item { + /** Corresponds to the index in the original list of documents to which the ranked document belongs. (i.e. if the first value in the `results` object has an `index` value of 3, it means in the list of documents passed in, the document at `index=3` had the highest relevance) */ + index: number; + /** Relevance scores are normalized to be in the range `[0, 1]`. Scores close to `1` indicate a high relevance to the query, and scores closer to `0` indicate low relevance. It is not accurate to assume a score of 0.9 means the document is 2x more relevant than a document with a score of 0.45 */ + relevance_score?: number; + } + } +} diff --git a/src/api/resources/v2/types/V2RerankResponseResultsItem.ts b/src/api/resources/v2/types/V2RerankResponseResultsItem.ts deleted file mode 100644 index 64c5b03b..00000000 --- a/src/api/resources/v2/types/V2RerankResponseResultsItem.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../../../index"; - -export interface V2RerankResponseResultsItem { - /** If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in */ - document?: Cohere.V2RerankResponseResultsItemDocument; - /** Corresponds to the index in the original list of documents to which the ranked document belongs. (i.e. if the first value in the `results` object has an `index` value of 3, it means in the list of documents passed in, the document at `index=3` had the highest relevance) */ - index: number; - /** Relevance scores are normalized to be in the range `[0, 1]`. Scores close to `1` indicate a high relevance to the query, and scores closer to `0` indicate low relevance. It is not accurate to assume a score of 0.9 means the document is 2x more relevant than a document with a score of 0.45 */ - relevanceScore: number; -} diff --git a/src/api/resources/v2/types/V2RerankResponseResultsItemDocument.ts b/src/api/resources/v2/types/V2RerankResponseResultsItemDocument.ts deleted file mode 100644 index aba00dbe..00000000 --- a/src/api/resources/v2/types/V2RerankResponseResultsItemDocument.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in - */ -export interface V2RerankResponseResultsItemDocument { - /** The text of the document to rerank */ - text: string; -} diff --git a/src/api/resources/v2/types/index.ts b/src/api/resources/v2/types/index.ts index 56d3128e..9ac7c15f 100644 --- a/src/api/resources/v2/types/index.ts +++ b/src/api/resources/v2/types/index.ts @@ -1,10 +1 @@ -export * from "./V2ChatStreamRequestDocumentsItem"; -export * from "./V2ChatStreamRequestSafetyMode"; -export * from "./V2ChatStreamRequestToolChoice"; -export * from "./V2ChatRequestDocumentsItem"; -export * from "./V2ChatRequestSafetyMode"; -export * from "./V2ChatRequestToolChoice"; -export * from "./V2EmbedRequestTruncate"; -export * from "./V2RerankResponseResultsItemDocument"; -export * from "./V2RerankResponseResultsItem"; -export * from "./V2RerankResponse"; +export * from "./V2RerankResponse.js"; diff --git a/src/api/types/ApiMeta.ts b/src/api/types/ApiMeta.ts index ea0a4f18..d336c415 100644 --- a/src/api/types/ApiMeta.ts +++ b/src/api/types/ApiMeta.ts @@ -2,11 +2,37 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - export interface ApiMeta { - apiVersion?: Cohere.ApiMetaApiVersion; - billedUnits?: Cohere.ApiMetaBilledUnits; - tokens?: Cohere.ApiMetaTokens; + api_version?: ApiMeta.ApiVersion; + billed_units?: ApiMeta.BilledUnits; + tokens?: ApiMeta.Tokens; warnings?: string[]; } + +export namespace ApiMeta { + export interface ApiVersion { + version: string; + is_deprecated?: boolean; + is_experimental?: boolean; + } + + export interface BilledUnits { + /** The number of billed images. */ + images?: number; + /** The number of billed input tokens. */ + input_tokens?: number; + /** The number of billed output tokens. */ + output_tokens?: number; + /** The number of billed search units. */ + search_units?: number; + /** The number of billed classifications units. */ + classifications?: number; + } + + export interface Tokens { + /** The number of tokens used as input to the model. */ + input_tokens?: number; + /** The number of tokens produced by the model. */ + output_tokens?: number; + } +} diff --git a/src/api/types/ApiMetaApiVersion.ts b/src/api/types/ApiMetaApiVersion.ts deleted file mode 100644 index 44f15912..00000000 --- a/src/api/types/ApiMetaApiVersion.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ApiMetaApiVersion { - version: string; - isDeprecated?: boolean; - isExperimental?: boolean; -} diff --git a/src/api/types/ApiMetaBilledUnits.ts b/src/api/types/ApiMetaBilledUnits.ts deleted file mode 100644 index 050e2227..00000000 --- a/src/api/types/ApiMetaBilledUnits.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ApiMetaBilledUnits { - /** The number of billed images. */ - images?: number; - /** 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/types/ApiMetaTokens.ts b/src/api/types/ApiMetaTokens.ts deleted file mode 100644 index a2c362fe..00000000 --- a/src/api/types/ApiMetaTokens.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ApiMetaTokens { - /** 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/types/AssistantMessage.ts b/src/api/types/AssistantMessage.ts index 3b870c7b..8484550a 100644 --- a/src/api/types/AssistantMessage.ts +++ b/src/api/types/AssistantMessage.ts @@ -2,15 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A message from the assistant role can contain text and tool call information. */ export interface AssistantMessage { - toolCalls?: Cohere.ToolCallV2[]; + tool_calls?: Cohere.ToolCallV2[]; /** A chain-of-thought style reflection and plan that the model generates when working with Tools. */ - toolPlan?: string; - content?: Cohere.AssistantMessageContent; + tool_plan?: string; + content?: AssistantMessage.Content; citations?: Cohere.Citation[]; } + +export namespace AssistantMessage { + export type Content = string | Cohere.AssistantMessageContentItem[]; +} diff --git a/src/api/types/AssistantMessageContent.ts b/src/api/types/AssistantMessageContent.ts deleted file mode 100644 index 9f424b61..00000000 --- a/src/api/types/AssistantMessageContent.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export type AssistantMessageContent = string | Cohere.AssistantMessageContentItem[]; diff --git a/src/api/types/AssistantMessageContentItem.ts b/src/api/types/AssistantMessageContentItem.ts index 63c4b6b9..5848279a 100644 --- a/src/api/types/AssistantMessageContentItem.ts +++ b/src/api/types/AssistantMessageContentItem.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export type AssistantMessageContentItem = Cohere.AssistantMessageContentItem.Text; export namespace AssistantMessageContentItem { - export interface Text extends Cohere.TextContent { + export interface Text extends Cohere.ChatTextContent { type: "text"; } } diff --git a/src/api/types/AssistantMessageResponse.ts b/src/api/types/AssistantMessageResponse.ts index b3a02599..a733092c 100644 --- a/src/api/types/AssistantMessageResponse.ts +++ b/src/api/types/AssistantMessageResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A message from the assistant role can contain text and tool call information. */ export interface AssistantMessageResponse { role: "assistant"; - toolCalls?: Cohere.ToolCallV2[]; + tool_calls?: Cohere.ToolCallV2[]; /** A chain-of-thought style reflection and plan that the model generates when working with Tools. */ - toolPlan?: string; + tool_plan?: string; content?: Cohere.AssistantMessageResponseContentItem[]; citations?: Cohere.Citation[]; } diff --git a/src/api/types/AssistantMessageResponseContentItem.ts b/src/api/types/AssistantMessageResponseContentItem.ts index 96d96338..d9fadf2b 100644 --- a/src/api/types/AssistantMessageResponseContentItem.ts +++ b/src/api/types/AssistantMessageResponseContentItem.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export type AssistantMessageResponseContentItem = Cohere.AssistantMessageResponseContentItem.Text; export namespace AssistantMessageResponseContentItem { - export interface Text extends Cohere.TextContent { + export interface Text extends Cohere.ChatTextContent { type: "text"; } } diff --git a/src/api/types/ChatCitation.ts b/src/api/types/ChatCitation.ts index 16609e3d..d390295f 100644 --- a/src/api/types/ChatCitation.ts +++ b/src/api/types/ChatCitation.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - /** * A section of the generated reply which cites external knowledge. */ @@ -15,7 +13,18 @@ export interface ChatCitation { /** The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`. */ text: string; /** Identifiers of documents cited by this section of the generated reply. */ - documentIds: string[]; + document_ids: string[]; /** The type of citation which indicates what part of the response the citation is for. */ - type?: Cohere.ChatCitationType; + type?: ChatCitation.Type; +} + +export namespace ChatCitation { + /** + * The type of citation which indicates what part of the response the citation is for. + */ + export type Type = "TEXT_CONTENT" | "PLAN"; + export const Type = { + TextContent: "TEXT_CONTENT", + Plan: "PLAN", + } as const; } diff --git a/src/api/types/ChatCitationGenerationEvent.ts b/src/api/types/ChatCitationGenerationEvent.ts index 486b4bf9..298252f5 100644 --- a/src/api/types/ChatCitationGenerationEvent.ts +++ b/src/api/types/ChatCitationGenerationEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatCitationGenerationEvent extends Cohere.ChatStreamEvent { /** Citations for the generated reply. */ diff --git a/src/api/types/ChatCitationType.ts b/src/api/types/ChatCitationType.ts deleted file mode 100644 index 6d60602c..00000000 --- a/src/api/types/ChatCitationType.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The type of citation which indicates what part of the response the citation is for. - */ -export type ChatCitationType = "TEXT_CONTENT" | "PLAN"; -export const ChatCitationType = { - TextContent: "TEXT_CONTENT", - Plan: "PLAN", -} as const; diff --git a/src/api/types/ChatConnector.ts b/src/api/types/ChatConnector.ts index 9f166f66..125026b2 100644 --- a/src/api/types/ChatConnector.ts +++ b/src/api/types/ChatConnector.ts @@ -9,13 +9,13 @@ export interface ChatConnector { /** The identifier of the connector. */ id: string; /** When specified, this user access token will be passed to the connector in the Authorization header instead of the Cohere generated one. */ - userAccessToken?: string; + user_access_token?: string; /** * Defaults to `false`. * * When `true`, the request will continue if this connector returned an error. */ - continueOnFailure?: boolean; + continue_on_failure?: boolean; /** * Provides the connector with different settings at request time. The key/value pairs of this object are specific to each connector. * diff --git a/src/api/types/ChatContentDeltaEvent.ts b/src/api/types/ChatContentDeltaEvent.ts index e7ed836b..4e82d839 100644 --- a/src/api/types/ChatContentDeltaEvent.ts +++ b/src/api/types/ChatContentDeltaEvent.ts @@ -2,13 +2,31 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed delta event which contains a delta of chat text content. */ export interface ChatContentDeltaEvent extends Cohere.ChatStreamEventType { index?: number; - delta?: Cohere.ChatContentDeltaEventDelta; + delta?: ChatContentDeltaEvent.Delta; logprobs?: Cohere.LogprobItem; } + +export namespace ChatContentDeltaEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + content?: Message.Content; + } + + export namespace Message { + export interface Content { + text?: string; + } + } + } +} diff --git a/src/api/types/ChatContentDeltaEventDelta.ts b/src/api/types/ChatContentDeltaEventDelta.ts deleted file mode 100644 index e307d65b..00000000 --- a/src/api/types/ChatContentDeltaEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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/types/ChatContentDeltaEventDeltaMessage.ts b/src/api/types/ChatContentDeltaEventDeltaMessage.ts deleted file mode 100644 index d6ff6ab4..00000000 --- a/src/api/types/ChatContentDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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/types/ChatContentDeltaEventDeltaMessageContent.ts b/src/api/types/ChatContentDeltaEventDeltaMessageContent.ts deleted file mode 100644 index f437fbb8..00000000 --- a/src/api/types/ChatContentDeltaEventDeltaMessageContent.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ChatContentDeltaEventDeltaMessageContent { - text?: string; -} diff --git a/src/api/types/ChatContentEndEvent.ts b/src/api/types/ChatContentEndEvent.ts index 2b0997ab..622fd815 100644 --- a/src/api/types/ChatContentEndEvent.ts +++ b/src/api/types/ChatContentEndEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed delta event which signifies that the content block has ended. diff --git a/src/api/types/ChatContentStartEvent.ts b/src/api/types/ChatContentStartEvent.ts index de3abcfb..e12f978f 100644 --- a/src/api/types/ChatContentStartEvent.ts +++ b/src/api/types/ChatContentStartEvent.ts @@ -2,12 +2,31 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed delta event which signifies that a new content block has started. */ export interface ChatContentStartEvent extends Cohere.ChatStreamEventType { index?: number; - delta?: Cohere.ChatContentStartEventDelta; + delta?: ChatContentStartEvent.Delta; +} + +export namespace ChatContentStartEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + content?: Message.Content; + } + + export namespace Message { + export interface Content { + text?: string; + type?: "text"; + } + } + } } diff --git a/src/api/types/ChatContentStartEventDelta.ts b/src/api/types/ChatContentStartEventDelta.ts deleted file mode 100644 index 708d91c8..00000000 --- a/src/api/types/ChatContentStartEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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/types/ChatContentStartEventDeltaMessage.ts b/src/api/types/ChatContentStartEventDeltaMessage.ts deleted file mode 100644 index ba65d620..00000000 --- a/src/api/types/ChatContentStartEventDeltaMessage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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/types/ChatContentStartEventDeltaMessageContent.ts b/src/api/types/ChatContentStartEventDeltaMessageContent.ts deleted file mode 100644 index 690268da..00000000 --- a/src/api/types/ChatContentStartEventDeltaMessageContent.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ChatContentStartEventDeltaMessageContent { - text?: string; - type?: "text"; -} diff --git a/src/api/types/ChatDataMetrics.ts b/src/api/types/ChatDataMetrics.ts index aa5bd8b8..21c73fcf 100644 --- a/src/api/types/ChatDataMetrics.ts +++ b/src/api/types/ChatDataMetrics.ts @@ -4,9 +4,9 @@ export interface ChatDataMetrics { /** The sum of all turns of valid train examples. */ - numTrainTurns?: number; + num_train_turns?: number; /** The sum of all turns of valid eval examples. */ - numEvalTurns?: number; + num_eval_turns?: number; /** The preamble of this dataset. */ preamble?: string; } diff --git a/src/api/types/ChatDebugEvent.ts b/src/api/types/ChatDebugEvent.ts index 831e10fd..f544f987 100644 --- a/src/api/types/ChatDebugEvent.ts +++ b/src/api/types/ChatDebugEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatDebugEvent extends Cohere.ChatStreamEvent { prompt?: string; diff --git a/src/api/types/DocumentSource.ts b/src/api/types/ChatDocumentSource.ts similarity index 88% rename from src/api/types/DocumentSource.ts rename to src/api/types/ChatDocumentSource.ts index b048b24e..f932f02e 100644 --- a/src/api/types/DocumentSource.ts +++ b/src/api/types/ChatDocumentSource.ts @@ -5,7 +5,7 @@ /** * A document source object containing the unique identifier of the document and the document itself. */ -export interface DocumentSource { +export interface ChatDocumentSource { /** The unique identifier of the document */ id?: string; document?: Record; diff --git a/src/api/types/ChatMessage.ts b/src/api/types/ChatMessage.ts index 51dfafd2..63b8f9fb 100644 --- a/src/api/types/ChatMessage.ts +++ b/src/api/types/ChatMessage.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Represents a single message in the chat history, excluding the current user turn. It has two properties: `role` and `message`. The `role` identifies the sender (`CHATBOT`, `SYSTEM`, or `USER`), while the `message` contains the text content. @@ -12,5 +12,5 @@ import * as Cohere from "../index"; export interface ChatMessage { /** Contents of the chat message. */ message: string; - toolCalls?: Cohere.ToolCall[]; + tool_calls?: Cohere.ToolCall[]; } diff --git a/src/api/types/ChatMessageEndEvent.ts b/src/api/types/ChatMessageEndEvent.ts index 2fcd3aa7..8e6dcda4 100644 --- a/src/api/types/ChatMessageEndEvent.ts +++ b/src/api/types/ChatMessageEndEvent.ts @@ -2,12 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event which signifies that the chat message has ended. */ export interface ChatMessageEndEvent extends Cohere.ChatStreamEventType { id?: string; - delta?: Cohere.ChatMessageEndEventDelta; + delta?: ChatMessageEndEvent.Delta; +} + +export namespace ChatMessageEndEvent { + export interface Delta { + /** An error message if an error occurred during the generation. */ + error?: string; + finish_reason?: Cohere.ChatFinishReason; + usage?: Cohere.Usage; + } } diff --git a/src/api/types/ChatMessageEndEventDelta.ts b/src/api/types/ChatMessageEndEventDelta.ts deleted file mode 100644 index 2def6b9f..00000000 --- a/src/api/types/ChatMessageEndEventDelta.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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/types/ChatMessageStartEvent.ts b/src/api/types/ChatMessageStartEvent.ts index 30fcdab2..5220f12c 100644 --- a/src/api/types/ChatMessageStartEvent.ts +++ b/src/api/types/ChatMessageStartEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event which signifies that a stream has started. @@ -10,5 +10,18 @@ import * as Cohere from "../index"; export interface ChatMessageStartEvent extends Cohere.ChatStreamEventType { /** Unique identifier for the generated reply. */ id?: string; - delta?: Cohere.ChatMessageStartEventDelta; + delta?: ChatMessageStartEvent.Delta; +} + +export namespace ChatMessageStartEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + /** The role of the message. */ + role?: "assistant"; + } + } } diff --git a/src/api/types/ChatMessageStartEventDelta.ts b/src/api/types/ChatMessageStartEventDelta.ts deleted file mode 100644 index 4bdf2816..00000000 --- a/src/api/types/ChatMessageStartEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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/types/ChatMessageStartEventDeltaMessage.ts b/src/api/types/ChatMessageStartEventDeltaMessage.ts deleted file mode 100644 index 4f6d664c..00000000 --- a/src/api/types/ChatMessageStartEventDeltaMessage.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * 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/types/ChatMessageV2.ts b/src/api/types/ChatMessageV2.ts index 2f1fd327..8a43a03c 100644 --- a/src/api/types/ChatMessageV2.ts +++ b/src/api/types/ChatMessageV2.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Represents a single message in the chat history from a given role. @@ -14,7 +14,7 @@ export type ChatMessageV2 = | Cohere.ChatMessageV2.Tool; export namespace ChatMessageV2 { - export interface User extends Cohere.UserMessage { + export interface User extends Cohere.UserMessageV2 { role: "user"; } @@ -22,7 +22,7 @@ export namespace ChatMessageV2 { role: "assistant"; } - export interface System extends Cohere.SystemMessage { + export interface System extends Cohere.SystemMessageV2 { role: "system"; } diff --git a/src/api/types/ChatMessages.ts b/src/api/types/ChatMessages.ts index e6f5cd95..c56348c2 100644 --- a/src/api/types/ChatMessages.ts +++ b/src/api/types/ChatMessages.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A list of chat messages in chronological order, representing a conversation between the user and the model. diff --git a/src/api/types/ChatRequestCitationQuality.ts b/src/api/types/ChatRequestCitationQuality.ts deleted file mode 100644 index ad63f8b1..00000000 --- a/src/api/types/ChatRequestCitationQuality.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Defaults to `"accurate"`. - * - * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatRequestCitationQuality = "fast" | "accurate" | "off"; -export const ChatRequestCitationQuality = { - Fast: "fast", - Accurate: "accurate", - Off: "off", -} as const; diff --git a/src/api/types/ChatRequestConnectorsSearchOptions.ts b/src/api/types/ChatRequestConnectorsSearchOptions.ts deleted file mode 100644 index 2312ae73..00000000 --- a/src/api/types/ChatRequestConnectorsSearchOptions.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * (internal) Sets inference and model options for RAG search query and tool use generations. Defaults are used when options are not specified here, meaning that other parameters outside of connectors_search_options are ignored (such as model= or temperature=). - */ -export interface ChatRequestConnectorsSearchOptions { - /** - * If specified, the backend will make a best effort to sample tokens - * deterministically, such that repeated requests with the same - * seed and parameters should return the same result. However, - * determinism cannot be totally guaranteed. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ - seed?: number; -} diff --git a/src/api/types/ChatRequestPromptTruncation.ts b/src/api/types/ChatRequestPromptTruncation.ts deleted file mode 100644 index c4db05a2..00000000 --- a/src/api/types/ChatRequestPromptTruncation.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. - * - * Dictates how the prompt will be constructed. - * - * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance. - * - * With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API. - * - * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. - * - * Compatible Deployments: - * - AUTO: Cohere Platform Only - * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatRequestPromptTruncation = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; -export const ChatRequestPromptTruncation = { - Off: "OFF", - Auto: "AUTO", - AutoPreserveOrder: "AUTO_PRESERVE_ORDER", -} as const; diff --git a/src/api/types/ChatRequestSafetyMode.ts b/src/api/types/ChatRequestSafetyMode.ts deleted file mode 100644 index 5fe6ddb4..00000000 --- a/src/api/types/ChatRequestSafetyMode.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. - * When `NONE` is specified, the safety instruction will be omitted. - * - * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. - * - * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). - * - * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatRequestSafetyMode = "CONTEXTUAL" | "STRICT" | "NONE"; -export const ChatRequestSafetyMode = { - Contextual: "CONTEXTUAL", - Strict: "STRICT", - None: "NONE", -} as const; diff --git a/src/api/types/ChatResponse.ts b/src/api/types/ChatResponse.ts index ce6acd33..91600258 100644 --- a/src/api/types/ChatResponse.ts +++ b/src/api/types/ChatResponse.ts @@ -2,14 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatResponse { /** 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; + finish_reason: Cohere.ChatFinishReason; message: Cohere.AssistantMessageResponse; usage?: Cohere.Usage; logprobs?: Cohere.LogprobItem[]; diff --git a/src/api/types/ChatSearchQueriesGenerationEvent.ts b/src/api/types/ChatSearchQueriesGenerationEvent.ts index 90a3665d..d26b4da0 100644 --- a/src/api/types/ChatSearchQueriesGenerationEvent.ts +++ b/src/api/types/ChatSearchQueriesGenerationEvent.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatSearchQueriesGenerationEvent extends Cohere.ChatStreamEvent { /** Generated search queries, meant to be used as part of the RAG flow. */ - searchQueries: Cohere.ChatSearchQuery[]; + search_queries: Cohere.ChatSearchQuery[]; } diff --git a/src/api/types/ChatSearchQuery.ts b/src/api/types/ChatSearchQuery.ts index 48ea2f7c..ae8bf301 100644 --- a/src/api/types/ChatSearchQuery.ts +++ b/src/api/types/ChatSearchQuery.ts @@ -9,5 +9,5 @@ export interface ChatSearchQuery { /** The text of the search query. */ text: string; /** Unique identifier for the generated search query. Useful for submitting feedback. */ - generationId: string; + generation_id: string; } diff --git a/src/api/types/ChatSearchResult.ts b/src/api/types/ChatSearchResult.ts index 12fc08fc..bce4c4c7 100644 --- a/src/api/types/ChatSearchResult.ts +++ b/src/api/types/ChatSearchResult.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatSearchResult { - searchQuery?: Cohere.ChatSearchQuery; + search_query?: Cohere.ChatSearchQuery; /** The connector from which this result comes from. */ connector: Cohere.ChatSearchResultConnector; /** Identifiers of documents found by this search query. */ - documentIds: string[]; + document_ids: string[]; /** An error message if the search failed. */ - errorMessage?: string; + error_message?: string; /** Whether a chat request should continue or not if the request to this connector fails. */ - continueOnFailure?: boolean; + continue_on_failure?: boolean; } diff --git a/src/api/types/ChatSearchResultsEvent.ts b/src/api/types/ChatSearchResultsEvent.ts index 254ff062..47e66239 100644 --- a/src/api/types/ChatSearchResultsEvent.ts +++ b/src/api/types/ChatSearchResultsEvent.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatSearchResultsEvent extends Cohere.ChatStreamEvent { /** Conducted searches and the ids of documents retrieved from each of them. */ - searchResults?: Cohere.ChatSearchResult[]; + search_results?: Cohere.ChatSearchResult[]; /** Documents fetched from searches or provided by the user. */ documents?: Cohere.ChatDocument[]; } diff --git a/src/api/types/ChatStreamEndEvent.ts b/src/api/types/ChatStreamEndEvent.ts index a7a74af1..9c687b7e 100644 --- a/src/api/types/ChatStreamEndEvent.ts +++ b/src/api/types/ChatStreamEndEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatStreamEndEvent extends Cohere.ChatStreamEvent { /** @@ -12,7 +12,25 @@ export interface ChatStreamEndEvent extends Cohere.ChatStreamEvent { * - `ERROR` - something went wrong when generating the reply * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic */ - finishReason: Cohere.ChatStreamEndEventFinishReason; + finish_reason: ChatStreamEndEvent.FinishReason; /** The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. */ response: Cohere.NonStreamedChatResponse; } + +export namespace ChatStreamEndEvent { + /** + * - `COMPLETE` - the model sent back a finished reply + * - `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length + * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter + * - `ERROR` - something went wrong when generating the reply + * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic + */ + export type FinishReason = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; + export const FinishReason = { + Complete: "COMPLETE", + ErrorLimit: "ERROR_LIMIT", + MaxTokens: "MAX_TOKENS", + Error: "ERROR", + ErrorToxic: "ERROR_TOXIC", + } as const; +} diff --git a/src/api/types/ChatStreamEndEventFinishReason.ts b/src/api/types/ChatStreamEndEventFinishReason.ts deleted file mode 100644 index d2866314..00000000 --- a/src/api/types/ChatStreamEndEventFinishReason.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * - `COMPLETE` - the model sent back a finished reply - * - `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length - * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter - * - `ERROR` - something went wrong when generating the reply - * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic - */ -export type ChatStreamEndEventFinishReason = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; -export const ChatStreamEndEventFinishReason = { - Complete: "COMPLETE", - ErrorLimit: "ERROR_LIMIT", - MaxTokens: "MAX_TOKENS", - Error: "ERROR", - ErrorToxic: "ERROR_TOXIC", -} as const; diff --git a/src/api/types/ChatStreamRequestCitationQuality.ts b/src/api/types/ChatStreamRequestCitationQuality.ts deleted file mode 100644 index 3534f1f3..00000000 --- a/src/api/types/ChatStreamRequestCitationQuality.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Defaults to `"accurate"`. - * - * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatStreamRequestCitationQuality = "fast" | "accurate" | "off"; -export const ChatStreamRequestCitationQuality = { - Fast: "fast", - Accurate: "accurate", - Off: "off", -} as const; diff --git a/src/api/types/ChatStreamRequestConnectorsSearchOptions.ts b/src/api/types/ChatStreamRequestConnectorsSearchOptions.ts deleted file mode 100644 index 741b7e04..00000000 --- a/src/api/types/ChatStreamRequestConnectorsSearchOptions.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * (internal) Sets inference and model options for RAG search query and tool use generations. Defaults are used when options are not specified here, meaning that other parameters outside of connectors_search_options are ignored (such as model= or temperature=). - */ -export interface ChatStreamRequestConnectorsSearchOptions { - /** - * If specified, the backend will make a best effort to sample tokens - * deterministically, such that repeated requests with the same - * seed and parameters should return the same result. However, - * determinism cannot be totally guaranteed. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ - seed?: number; -} diff --git a/src/api/types/ChatStreamRequestPromptTruncation.ts b/src/api/types/ChatStreamRequestPromptTruncation.ts deleted file mode 100644 index 72ba8fa2..00000000 --- a/src/api/types/ChatStreamRequestPromptTruncation.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. - * - * Dictates how the prompt will be constructed. - * - * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance. - * - * With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API. - * - * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. - * - * Compatible Deployments: - * - AUTO: Cohere Platform Only - * - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatStreamRequestPromptTruncation = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; -export const ChatStreamRequestPromptTruncation = { - Off: "OFF", - Auto: "AUTO", - AutoPreserveOrder: "AUTO_PRESERVE_ORDER", -} as const; diff --git a/src/api/types/ChatStreamRequestSafetyMode.ts b/src/api/types/ChatStreamRequestSafetyMode.ts deleted file mode 100644 index 4ab7a5ec..00000000 --- a/src/api/types/ChatStreamRequestSafetyMode.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. - * When `NONE` is specified, the safety instruction will be omitted. - * - * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters. - * - * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release). - * - * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes. - * - * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - */ -export type ChatStreamRequestSafetyMode = "CONTEXTUAL" | "STRICT" | "NONE"; -export const ChatStreamRequestSafetyMode = { - Contextual: "CONTEXTUAL", - Strict: "STRICT", - None: "NONE", -} as const; diff --git a/src/api/types/ChatStreamStartEvent.ts b/src/api/types/ChatStreamStartEvent.ts index b91dbe2b..2781e4f3 100644 --- a/src/api/types/ChatStreamStartEvent.ts +++ b/src/api/types/ChatStreamStartEvent.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatStreamStartEvent extends Cohere.ChatStreamEvent { /** Unique identifier for the generated reply. Useful for submitting feedback. */ - generationId: string; + generation_id: string; } diff --git a/src/api/types/TextContent.ts b/src/api/types/ChatTextContent.ts similarity index 79% rename from src/api/types/TextContent.ts rename to src/api/types/ChatTextContent.ts index a9cc35dd..1bfab669 100644 --- a/src/api/types/TextContent.ts +++ b/src/api/types/ChatTextContent.ts @@ -5,6 +5,6 @@ /** * Text content of the message. */ -export interface TextContent { +export interface ChatTextContent { text: string; } diff --git a/src/api/types/ChatTextGenerationEvent.ts b/src/api/types/ChatTextGenerationEvent.ts index 9be9986b..494cf266 100644 --- a/src/api/types/ChatTextGenerationEvent.ts +++ b/src/api/types/ChatTextGenerationEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatTextGenerationEvent extends Cohere.ChatStreamEvent { /** The next batch of text generated by the model. */ diff --git a/src/api/types/TextResponseFormatV2.ts b/src/api/types/ChatTextResponseFormat.ts similarity index 63% rename from src/api/types/TextResponseFormatV2.ts rename to src/api/types/ChatTextResponseFormat.ts index c7dac513..4d602260 100644 --- a/src/api/types/TextResponseFormatV2.ts +++ b/src/api/types/ChatTextResponseFormat.ts @@ -2,4 +2,4 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface TextResponseFormatV2 {} +export interface ChatTextResponseFormat {} diff --git a/src/api/types/TextResponseFormat.ts b/src/api/types/ChatTextResponseFormatV2.ts similarity index 62% rename from src/api/types/TextResponseFormat.ts rename to src/api/types/ChatTextResponseFormatV2.ts index 3375931d..31edae2e 100644 --- a/src/api/types/TextResponseFormat.ts +++ b/src/api/types/ChatTextResponseFormatV2.ts @@ -2,4 +2,4 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface TextResponseFormat {} +export interface ChatTextResponseFormatV2 {} diff --git a/src/api/types/ChatToolCallDeltaEvent.ts b/src/api/types/ChatToolCallDeltaEvent.ts index 481200d8..9a233db4 100644 --- a/src/api/types/ChatToolCallDeltaEvent.ts +++ b/src/api/types/ChatToolCallDeltaEvent.ts @@ -2,12 +2,36 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event delta which signifies a delta in tool call arguments. */ export interface ChatToolCallDeltaEvent extends Cohere.ChatStreamEventType { index?: number; - delta?: Cohere.ChatToolCallDeltaEventDelta; + delta?: ChatToolCallDeltaEvent.Delta; +} + +export namespace ChatToolCallDeltaEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + tool_calls?: Message.ToolCalls; + } + + export namespace Message { + export interface ToolCalls { + function?: ToolCalls.Function; + } + + export namespace ToolCalls { + export interface Function { + arguments?: string; + } + } + } + } } diff --git a/src/api/types/ChatToolCallDeltaEventDelta.ts b/src/api/types/ChatToolCallDeltaEventDelta.ts deleted file mode 100644 index b76e298b..00000000 --- a/src/api/types/ChatToolCallDeltaEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolCallDeltaEventDelta { - message?: Cohere.ChatToolCallDeltaEventDeltaMessage; -} diff --git a/src/api/types/ChatToolCallDeltaEventDeltaMessage.ts b/src/api/types/ChatToolCallDeltaEventDeltaMessage.ts deleted file mode 100644 index 485c319b..00000000 --- a/src/api/types/ChatToolCallDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolCallDeltaEventDeltaMessage { - toolCalls?: Cohere.ChatToolCallDeltaEventDeltaMessageToolCalls; -} diff --git a/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts b/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts deleted file mode 100644 index b8a154d0..00000000 --- a/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolCallDeltaEventDeltaMessageToolCalls { - function?: Cohere.ChatToolCallDeltaEventDeltaMessageToolCallsFunction; -} diff --git a/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts b/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts deleted file mode 100644 index 49c348aa..00000000 --- a/src/api/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ChatToolCallDeltaEventDeltaMessageToolCallsFunction { - arguments?: string; -} diff --git a/src/api/types/ChatToolCallEndEvent.ts b/src/api/types/ChatToolCallEndEvent.ts index cb729ac3..89907fa0 100644 --- a/src/api/types/ChatToolCallEndEvent.ts +++ b/src/api/types/ChatToolCallEndEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event delta which signifies a tool call has finished streaming. diff --git a/src/api/types/ChatToolCallStartEvent.ts b/src/api/types/ChatToolCallStartEvent.ts index 11fd4436..69574cd7 100644 --- a/src/api/types/ChatToolCallStartEvent.ts +++ b/src/api/types/ChatToolCallStartEvent.ts @@ -2,12 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event delta which signifies a tool call has started streaming. */ export interface ChatToolCallStartEvent extends Cohere.ChatStreamEventType { index?: number; - delta?: Cohere.ChatToolCallStartEventDelta; + delta?: ChatToolCallStartEvent.Delta; +} + +export namespace ChatToolCallStartEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + tool_calls?: Cohere.ToolCallV2; + } + } } diff --git a/src/api/types/ChatToolCallStartEventDelta.ts b/src/api/types/ChatToolCallStartEventDelta.ts deleted file mode 100644 index 2de5c9a7..00000000 --- a/src/api/types/ChatToolCallStartEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolCallStartEventDelta { - message?: Cohere.ChatToolCallStartEventDeltaMessage; -} diff --git a/src/api/types/ChatToolCallStartEventDeltaMessage.ts b/src/api/types/ChatToolCallStartEventDeltaMessage.ts deleted file mode 100644 index 2e2f8d0d..00000000 --- a/src/api/types/ChatToolCallStartEventDeltaMessage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolCallStartEventDeltaMessage { - toolCalls?: Cohere.ToolCallV2; -} diff --git a/src/api/types/ChatToolCallsChunkEvent.ts b/src/api/types/ChatToolCallsChunkEvent.ts index bd2845ca..016d73f7 100644 --- a/src/api/types/ChatToolCallsChunkEvent.ts +++ b/src/api/types/ChatToolCallsChunkEvent.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatToolCallsChunkEvent extends Cohere.ChatStreamEvent { - toolCallDelta: Cohere.ToolCallDelta; + tool_call_delta: Cohere.ToolCallDelta; text?: string; } diff --git a/src/api/types/ChatToolCallsGenerationEvent.ts b/src/api/types/ChatToolCallsGenerationEvent.ts index a0983b9e..833dff84 100644 --- a/src/api/types/ChatToolCallsGenerationEvent.ts +++ b/src/api/types/ChatToolCallsGenerationEvent.ts @@ -2,10 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ChatToolCallsGenerationEvent extends Cohere.ChatStreamEvent { /** The text generated related to the tool calls generated */ text?: string; - toolCalls: Cohere.ToolCall[]; + tool_calls: Cohere.ToolCall[]; } diff --git a/src/api/types/ToolMessage.ts b/src/api/types/ChatToolMessage.ts similarity index 53% rename from src/api/types/ToolMessage.ts rename to src/api/types/ChatToolMessage.ts index ce3decdb..45a71d2d 100644 --- a/src/api/types/ToolMessage.ts +++ b/src/api/types/ChatToolMessage.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Represents tool result in the chat history. */ -export interface ToolMessage { - toolResults?: Cohere.ToolResult[]; +export interface ChatToolMessage { + tool_results?: Cohere.ToolResult[]; } diff --git a/src/api/types/ChatToolPlanDeltaEvent.ts b/src/api/types/ChatToolPlanDeltaEvent.ts index 6d3db605..87a307ea 100644 --- a/src/api/types/ChatToolPlanDeltaEvent.ts +++ b/src/api/types/ChatToolPlanDeltaEvent.ts @@ -2,11 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event which contains a delta of tool plan text. */ export interface ChatToolPlanDeltaEvent extends Cohere.ChatStreamEventType { - delta?: Cohere.ChatToolPlanDeltaEventDelta; + delta?: ChatToolPlanDeltaEvent.Delta; +} + +export namespace ChatToolPlanDeltaEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + tool_plan?: string; + } + } } diff --git a/src/api/types/ChatToolPlanDeltaEventDelta.ts b/src/api/types/ChatToolPlanDeltaEventDelta.ts deleted file mode 100644 index 8250bc70..00000000 --- a/src/api/types/ChatToolPlanDeltaEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ChatToolPlanDeltaEventDelta { - message?: Cohere.ChatToolPlanDeltaEventDeltaMessage; -} diff --git a/src/api/types/ChatToolPlanDeltaEventDeltaMessage.ts b/src/api/types/ChatToolPlanDeltaEventDeltaMessage.ts deleted file mode 100644 index 3f6f87aa..00000000 --- a/src/api/types/ChatToolPlanDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ChatToolPlanDeltaEventDeltaMessage { - toolPlan?: string; -} diff --git a/src/api/types/ToolSource.ts b/src/api/types/ChatToolSource.ts similarity index 64% rename from src/api/types/ToolSource.ts rename to src/api/types/ChatToolSource.ts index 1401d64e..d2fb5571 100644 --- a/src/api/types/ToolSource.ts +++ b/src/api/types/ChatToolSource.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface ToolSource { +export interface ChatToolSource { /** The unique identifier of the document */ id?: string; - toolOutput?: Record; + tool_output?: Record; } diff --git a/src/api/types/CheckApiKeyResponse.ts b/src/api/types/CheckApiKeyResponse.ts index 6c7ed1ed..c54c39e2 100644 --- a/src/api/types/CheckApiKeyResponse.ts +++ b/src/api/types/CheckApiKeyResponse.ts @@ -4,6 +4,6 @@ export interface CheckApiKeyResponse { valid: boolean; - organizationId?: string; - ownerId?: string; + organization_id?: string; + owner_id?: string; } diff --git a/src/api/types/Citation.ts b/src/api/types/Citation.ts index 47f98b35..69ba6a9a 100644 --- a/src/api/types/Citation.ts +++ b/src/api/types/Citation.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Citation information containing sources and the text cited. diff --git a/src/api/types/CitationEndEvent.ts b/src/api/types/CitationEndEvent.ts index 7181bdc7..8891e987 100644 --- a/src/api/types/CitationEndEvent.ts +++ b/src/api/types/CitationEndEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event which signifies a citation has finished streaming. diff --git a/src/api/types/CitationOptions.ts b/src/api/types/CitationOptions.ts index b5a4edae..46096d3d 100644 --- a/src/api/types/CitationOptions.ts +++ b/src/api/types/CitationOptions.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - /** * Options for controlling citation generation. */ @@ -14,5 +12,20 @@ export interface CitationOptions { * * **Note**: `command-r7b-12-2024` and `command-a-03-2025` only support `"fast"` and `"off"` modes. The default is `"fast"`. */ - mode?: Cohere.CitationOptionsMode; + mode?: CitationOptions.Mode; +} + +export namespace CitationOptions { + /** + * Defaults to `"accurate"`. + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. + * + * **Note**: `command-r7b-12-2024` and `command-a-03-2025` only support `"fast"` and `"off"` modes. The default is `"fast"`. + */ + export type Mode = "FAST" | "ACCURATE" | "OFF"; + export const Mode = { + Fast: "FAST", + Accurate: "ACCURATE", + Off: "OFF", + } as const; } diff --git a/src/api/types/CitationOptionsMode.ts b/src/api/types/CitationOptionsMode.ts deleted file mode 100644 index 8939379d..00000000 --- a/src/api/types/CitationOptionsMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Defaults to `"accurate"`. - * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. - * - * **Note**: `command-r7b-12-2024` and `command-a-03-2025` only support `"fast"` and `"off"` modes. The default is `"fast"`. - */ -export type CitationOptionsMode = "FAST" | "ACCURATE" | "OFF"; -export const CitationOptionsMode = { - Fast: "FAST", - Accurate: "ACCURATE", - Off: "OFF", -} as const; diff --git a/src/api/types/CitationStartEvent.ts b/src/api/types/CitationStartEvent.ts index eda6ddd2..eaf80491 100644 --- a/src/api/types/CitationStartEvent.ts +++ b/src/api/types/CitationStartEvent.ts @@ -2,12 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A streamed event which signifies a citation has been created. */ export interface CitationStartEvent extends Cohere.ChatStreamEventType { index?: number; - delta?: Cohere.CitationStartEventDelta; + delta?: CitationStartEvent.Delta; +} + +export namespace CitationStartEvent { + export interface Delta { + message?: Delta.Message; + } + + export namespace Delta { + export interface Message { + citations?: Cohere.Citation; + } + } } diff --git a/src/api/types/CitationStartEventDelta.ts b/src/api/types/CitationStartEventDelta.ts deleted file mode 100644 index b1967635..00000000 --- a/src/api/types/CitationStartEventDelta.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface CitationStartEventDelta { - message?: Cohere.CitationStartEventDeltaMessage; -} diff --git a/src/api/types/CitationStartEventDeltaMessage.ts b/src/api/types/CitationStartEventDeltaMessage.ts deleted file mode 100644 index 1f59a7e2..00000000 --- a/src/api/types/CitationStartEventDeltaMessage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface CitationStartEventDeltaMessage { - citations?: Cohere.Citation; -} diff --git a/src/api/types/ClassifyDataMetrics.ts b/src/api/types/ClassifyDataMetrics.ts index 85fa4816..5ee60a3e 100644 --- a/src/api/types/ClassifyDataMetrics.ts +++ b/src/api/types/ClassifyDataMetrics.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ClassifyDataMetrics { - labelMetrics?: Cohere.LabelMetric[]; + label_metrics?: Cohere.LabelMetric[]; } diff --git a/src/api/types/ClassifyRequestTruncate.ts b/src/api/types/ClassifyRequestTruncate.ts deleted file mode 100644 index 2be543fb..00000000 --- a/src/api/types/ClassifyRequestTruncate.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - */ -export type ClassifyRequestTruncate = "NONE" | "START" | "END"; -export const ClassifyRequestTruncate = { - None: "NONE", - Start: "START", - End: "END", -} as const; diff --git a/src/api/types/ClassifyResponse.ts b/src/api/types/ClassifyResponse.ts index 832e0ab1..fb2cd38b 100644 --- a/src/api/types/ClassifyResponse.ts +++ b/src/api/types/ClassifyResponse.ts @@ -2,10 +2,51 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ClassifyResponse { - id: string; - classifications: Cohere.ClassifyResponseClassificationsItem[]; + id?: string; + classifications?: ClassifyResponse.Classifications.Item[]; meta?: Cohere.ApiMeta; } + +export namespace ClassifyResponse { + export type Classifications = Classifications.Item[]; + + export namespace Classifications { + export interface Item { + id?: string; + /** The input text that was classified */ + input?: string; + /** The predicted label for the associated query (only filled for single-label models) */ + prediction?: string; + /** An array containing the predicted labels for the associated query (only filled for single-label classification) */ + predictions?: string[]; + /** The confidence score for the top predicted class (only filled for single-label classification) */ + confidence?: number; + /** An array containing the confidence scores of all the predictions in the same order */ + confidences?: number[]; + /** A map containing each label and its confidence score according to the classifier. All the confidence scores add up to 1 for single-label classification. For multi-label classification the label confidences are independent of each other, so they don't have to sum up to 1. */ + labels?: Record; + /** The type of classification performed */ + classification_type?: Item.ClassificationType; + } + + export namespace Item { + export namespace Labels { + export interface Value { + confidence?: number; + } + } + + /** + * The type of classification performed + */ + export type ClassificationType = "single-label" | "multi-label"; + export const ClassificationType = { + SingleLabel: "single-label", + MultiLabel: "multi-label", + } as const; + } + } +} diff --git a/src/api/types/ClassifyResponseClassificationsItem.ts b/src/api/types/ClassifyResponseClassificationsItem.ts deleted file mode 100644 index 43268fb9..00000000 --- a/src/api/types/ClassifyResponseClassificationsItem.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface ClassifyResponseClassificationsItem { - id: string; - /** The input text that was classified */ - input?: string; - /** The predicted label for the associated query (only filled for single-label models) */ - prediction?: string; - /** An array containing the predicted labels for the associated query (only filled for single-label classification) */ - predictions: string[]; - /** The confidence score for the top predicted class (only filled for single-label classification) */ - confidence?: number; - /** An array containing the confidence scores of all the predictions in the same order */ - confidences: number[]; - /** A map containing each label and its confidence score according to the classifier. All the confidence scores add up to 1 for single-label classification. For multi-label classification the label confidences are independent of each other, so they don't have to sum up to 1. */ - labels: Record; - /** The type of classification performed */ - classificationType: Cohere.ClassifyResponseClassificationsItemClassificationType; -} diff --git a/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts b/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts deleted file mode 100644 index fa6d2792..00000000 --- a/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The type of classification performed - */ -export type ClassifyResponseClassificationsItemClassificationType = "single-label" | "multi-label"; -export const ClassifyResponseClassificationsItemClassificationType = { - SingleLabel: "single-label", - MultiLabel: "multi-label", -} as const; diff --git a/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts b/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts deleted file mode 100644 index 7d5cfa5c..00000000 --- a/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ClassifyResponseClassificationsItemLabelsValue { - confidence?: number; -} diff --git a/src/api/types/Connector.ts b/src/api/types/Connector.ts index 7d0dd523..078514d0 100644 --- a/src/api/types/Connector.ts +++ b/src/api/types/Connector.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A connector allows you to integrate data sources with the '/chat' endpoint to create grounded generations with citations to the data source. @@ -18,7 +18,7 @@ export interface Connector { * The organization to which this connector belongs. This is automatically set to * the organization of the user who created the connector. */ - organizationId?: string; + organization_id?: string; /** A human-readable name for the connector. */ name: string; /** A description of the connector. */ @@ -26,19 +26,30 @@ export interface Connector { /** The URL of the connector that will be used to search for documents. */ url?: string; /** The UTC time at which the connector was created. */ - createdAt: Date; + created_at: string; /** The UTC time at which the connector was last updated. */ - updatedAt: Date; + updated_at: string; /** A list of fields to exclude from the prompt (fields remain in the document). */ excludes?: string[]; /** The type of authentication/authorization used by the connector. Possible values: [oauth, service_auth] */ - authType?: string; + auth_type?: string; /** The OAuth 2.0 configuration for the connector. */ oauth?: Cohere.ConnectorOAuth; /** The OAuth status for the user making the request. One of ["valid", "expired", ""]. Empty string (field is omitted) means the user has not authorized the connector yet. */ - authStatus?: Cohere.ConnectorAuthStatus; + auth_status?: Connector.AuthStatus; /** Whether the connector is active or not. */ active?: boolean; /** Whether a chat request should continue or not if the request to this connector fails. */ - continueOnFailure?: boolean; + continue_on_failure?: boolean; +} + +export namespace Connector { + /** + * The OAuth status for the user making the request. One of ["valid", "expired", ""]. Empty string (field is omitted) means the user has not authorized the connector yet. + */ + export type AuthStatus = "valid" | "expired"; + export const AuthStatus = { + Valid: "valid", + Expired: "expired", + } as const; } diff --git a/src/api/types/ConnectorAuthStatus.ts b/src/api/types/ConnectorAuthStatus.ts deleted file mode 100644 index cbcced19..00000000 --- a/src/api/types/ConnectorAuthStatus.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The OAuth status for the user making the request. One of ["valid", "expired", ""]. Empty string (field is omitted) means the user has not authorized the connector yet. - */ -export type ConnectorAuthStatus = "valid" | "expired"; -export const ConnectorAuthStatus = { - Valid: "valid", - Expired: "expired", -} as const; diff --git a/src/api/types/ConnectorOAuth.ts b/src/api/types/ConnectorOAuth.ts index 12c51a8d..b2273cc7 100644 --- a/src/api/types/ConnectorOAuth.ts +++ b/src/api/types/ConnectorOAuth.ts @@ -4,13 +4,13 @@ export interface ConnectorOAuth { /** The OAuth 2.0 client ID. This field is encrypted at rest. */ - clientId?: string; + client_id?: string; /** The OAuth 2.0 client Secret. This field is encrypted at rest and never returned in a response. */ - clientSecret?: string; + client_secret?: string; /** The OAuth 2.0 /authorize endpoint to use when users authorize the connector. */ - authorizeUrl: string; + authorize_url: string; /** The OAuth 2.0 /token endpoint to use when users authorize the connector. */ - tokenUrl: string; + token_url: string; /** The OAuth scopes to request when users authorize the connector. */ scope?: string; } diff --git a/src/api/types/Content.ts b/src/api/types/Content.ts index 8d2a964c..a471c06e 100644 --- a/src/api/types/Content.ts +++ b/src/api/types/Content.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A Content block which contains information about the content type and the content itself. @@ -10,7 +10,7 @@ import * as Cohere from "../index"; export type Content = Cohere.Content.Text | Cohere.Content.ImageUrl; export namespace Content { - export interface Text extends Cohere.TextContent { + export interface Text extends Cohere.ChatTextContent { type: "text"; } diff --git a/src/api/types/CreateConnectorOAuth.ts b/src/api/types/CreateConnectorOAuth.ts index a90ab6c2..a0fae19f 100644 --- a/src/api/types/CreateConnectorOAuth.ts +++ b/src/api/types/CreateConnectorOAuth.ts @@ -4,13 +4,13 @@ export interface CreateConnectorOAuth { /** The OAuth 2.0 client ID. This fields is encrypted at rest. */ - clientId?: string; + client_id?: string; /** The OAuth 2.0 client Secret. This field is encrypted at rest and never returned in a response. */ - clientSecret?: string; + client_secret?: string; /** The OAuth 2.0 /authorize endpoint to use when users authorize the connector. */ - authorizeUrl?: string; + authorize_url?: string; /** The OAuth 2.0 /token endpoint to use when users authorize the connector. */ - tokenUrl?: string; + token_url?: string; /** The OAuth scopes to request when users authorize the connector. */ scope?: string; } diff --git a/src/api/types/CreateConnectorResponse.ts b/src/api/types/CreateConnectorResponse.ts index 63697726..0a503dd2 100644 --- a/src/api/types/CreateConnectorResponse.ts +++ b/src/api/types/CreateConnectorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface CreateConnectorResponse { connector: Cohere.Connector; diff --git a/src/api/types/CreateConnectorServiceAuth.ts b/src/api/types/CreateConnectorServiceAuth.ts index 8630aa7e..00710192 100644 --- a/src/api/types/CreateConnectorServiceAuth.ts +++ b/src/api/types/CreateConnectorServiceAuth.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface CreateConnectorServiceAuth { type: Cohere.AuthTokenType; diff --git a/src/api/types/CreateEmbedJobResponse.ts b/src/api/types/CreateEmbedJobResponse.ts index dbc14090..ec649f6c 100644 --- a/src/api/types/CreateEmbedJobResponse.ts +++ b/src/api/types/CreateEmbedJobResponse.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Response from creating an embed job. */ export interface CreateEmbedJobResponse { - jobId: string; + job_id: string; meta?: Cohere.ApiMeta; } diff --git a/src/api/types/Dataset.ts b/src/api/types/Dataset.ts index 41e8f93a..fff8202c 100644 --- a/src/api/types/Dataset.ts +++ b/src/api/types/Dataset.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface Dataset { /** The dataset ID */ @@ -10,19 +10,19 @@ export interface Dataset { /** The name of the dataset */ name: string; /** The creation date */ - createdAt: Date; + created_at: string; /** The last update date */ - updatedAt: Date; - datasetType: Cohere.DatasetType; - validationStatus: Cohere.DatasetValidationStatus; + updated_at: string; + dataset_type: Cohere.DatasetType; + validation_status: Cohere.DatasetValidationStatus; /** Errors found during validation */ - validationError?: string; + validation_error?: string; /** the avro schema of the dataset */ schema?: string; - requiredFields?: string[]; - preserveFields?: string[]; + required_fields?: string[]; + preserve_fields?: string[]; /** the underlying files that make up the dataset */ - datasetParts?: Cohere.DatasetPart[]; + dataset_parts?: Cohere.DatasetPart[]; /** warnings found during validation */ - validationWarnings?: string[]; + validation_warnings?: string[]; } diff --git a/src/api/types/DatasetPart.ts b/src/api/types/DatasetPart.ts index e5db6cff..097d958c 100644 --- a/src/api/types/DatasetPart.ts +++ b/src/api/types/DatasetPart.ts @@ -12,11 +12,11 @@ export interface DatasetPart { /** The index of the file */ index?: number; /** The size of the file in bytes */ - sizeBytes?: number; + size_bytes?: number; /** The number of rows in the file */ - numRows?: number; + num_rows?: number; /** The download url of the original file */ - originalUrl?: string; + original_url?: string; /** The first few rows of the parsed file */ samples?: string[]; } diff --git a/src/api/types/DetokenizeResponse.ts b/src/api/types/DetokenizeResponse.ts index 9b8fc42f..b59b444a 100644 --- a/src/api/types/DetokenizeResponse.ts +++ b/src/api/types/DetokenizeResponse.ts @@ -2,10 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface DetokenizeResponse { /** A string representing the list of tokens. */ - text: string; + text?: string; meta?: Cohere.ApiMeta; } diff --git a/src/api/types/DocumentContent.ts b/src/api/types/DocumentContent.ts index df5295ec..4d4bba27 100644 --- a/src/api/types/DocumentContent.ts +++ b/src/api/types/DocumentContent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Document content. diff --git a/src/api/types/EmbedByTypeResponse.ts b/src/api/types/EmbedByTypeResponse.ts index d546a006..aee4e970 100644 --- a/src/api/types/EmbedByTypeResponse.ts +++ b/src/api/types/EmbedByTypeResponse.ts @@ -2,15 +2,33 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface EmbedByTypeResponse { id: string; /** An object with different embedding types. The length of each embedding type array will be the same as the length of the original `texts` array. */ - embeddings: Cohere.EmbedByTypeResponseEmbeddings; + embeddings?: EmbedByTypeResponse.Embeddings; /** The text entries for which embeddings were returned. */ texts: string[]; /** The image entries for which embeddings were returned. */ images?: Cohere.Image[]; meta?: Cohere.ApiMeta; } + +export namespace EmbedByTypeResponse { + /** + * An object with different embedding types. The length of each embedding type array will be the same as the length of the original `texts` array. + */ + export interface Embeddings { + /** An array of float embeddings. */ + float?: number[][]; + /** An array of signed int8 embeddings. Each value is between -128 and 127. */ + int8?: number[][]; + /** An array of unsigned int8 embeddings. Each value is between 0 and 255. */ + uint8?: number[][]; + /** An array of packed signed binary embeddings. The length of each binary embedding is 1/8 the length of the float embeddings of the provided model. Each value is between -128 and 127. */ + binary?: number[][]; + /** An array of packed unsigned binary embeddings. The length of each binary embedding is 1/8 the length of the float embeddings of the provided model. Each value is between 0 and 255. */ + ubinary?: number[][]; + } +} diff --git a/src/api/types/EmbedByTypeResponseEmbeddings.ts b/src/api/types/EmbedByTypeResponseEmbeddings.ts deleted file mode 100644 index a4d9240e..00000000 --- a/src/api/types/EmbedByTypeResponseEmbeddings.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * An object with different embedding types. The length of each embedding type array will be the same as the length of the original `texts` array. - */ -export interface EmbedByTypeResponseEmbeddings { - /** An array of float embeddings. */ - float?: number[][]; - /** An array of signed int8 embeddings. Each value is between -128 and 127. */ - int8?: number[][]; - /** An array of unsigned int8 embeddings. Each value is between 0 and 255. */ - uint8?: number[][]; - /** An array of packed signed binary embeddings. The length of each binary embedding is 1/8 the length of the float embeddings of the provided model. Each value is between -128 and 127. */ - binary?: number[][]; - /** An array of packed unsigned binary embeddings. The length of each binary embedding is 1/8 the length of the float embeddings of the provided model. Each value is between 0 and 255. */ - ubinary?: number[][]; -} diff --git a/src/api/types/EmbedContent.ts b/src/api/types/EmbedContent.ts index db445015..6859a060 100644 --- a/src/api/types/EmbedContent.ts +++ b/src/api/types/EmbedContent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export type EmbedContent = Cohere.EmbedContent.ImageUrl | Cohere.EmbedContent.Text; diff --git a/src/api/types/EmbedFloatsResponse.ts b/src/api/types/EmbedFloatsResponse.ts index 47fd8939..9cd92878 100644 --- a/src/api/types/EmbedFloatsResponse.ts +++ b/src/api/types/EmbedFloatsResponse.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface EmbedFloatsResponse { id: string; /** An array of embeddings, where each embedding is an array of floats. The length of the `embeddings` array will be the same as the length of the original `texts` array. */ - embeddings: number[][]; + embeddings?: number[][]; /** The text entries for which embeddings were returned. */ texts: string[]; /** The image entries for which embeddings were returned. */ diff --git a/src/api/types/EmbedImage.ts b/src/api/types/EmbedImage.ts index d8536a58..3a0c76d6 100644 --- a/src/api/types/EmbedImage.ts +++ b/src/api/types/EmbedImage.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** - * Image content of the input. + * Image content of the input. Supported with Embed v3.0 and newer models. */ export interface EmbedImage { - imageUrl?: Cohere.EmbedImageUrl; + image_url?: Cohere.EmbedImageUrl; } diff --git a/src/api/types/EmbedInput.ts b/src/api/types/EmbedInput.ts index f7faf266..b8dbcd42 100644 --- a/src/api/types/EmbedInput.ts +++ b/src/api/types/EmbedInput.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface EmbedInput { /** An array of objects containing the input data for the model to embed. */ diff --git a/src/api/types/EmbedJob.ts b/src/api/types/EmbedJob.ts index fa4536fa..d8ec9ad6 100644 --- a/src/api/types/EmbedJob.ts +++ b/src/api/types/EmbedJob.ts @@ -2,24 +2,46 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface EmbedJob { /** ID of the embed job */ - jobId: string; + job_id: string; /** The name of the embed job */ name?: string; /** The status of the embed job */ - status: Cohere.EmbedJobStatus; + status: EmbedJob.Status; /** The creation date of the embed job */ - createdAt: Date; + created_at: string; /** ID of the input dataset */ - inputDatasetId: string; + input_dataset_id: string; /** ID of the resulting output dataset */ - outputDatasetId?: string; + output_dataset_id?: string; /** ID of the model used to embed */ model: string; /** The truncation option used */ - truncate: Cohere.EmbedJobTruncate; + truncate: EmbedJob.Truncate; meta?: Cohere.ApiMeta; } + +export namespace EmbedJob { + /** + * The status of the embed job + */ + export type Status = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; + export const Status = { + Processing: "processing", + Complete: "complete", + Cancelling: "cancelling", + Cancelled: "cancelled", + Failed: "failed", + } as const; + /** + * The truncation option used + */ + export type Truncate = "START" | "END"; + export const Truncate = { + Start: "START", + End: "END", + } as const; +} diff --git a/src/api/types/EmbedJobStatus.ts b/src/api/types/EmbedJobStatus.ts deleted file mode 100644 index ca212325..00000000 --- a/src/api/types/EmbedJobStatus.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The status of the embed job - */ -export type EmbedJobStatus = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; -export const EmbedJobStatus = { - Processing: "processing", - Complete: "complete", - Cancelling: "cancelling", - Cancelled: "cancelled", - Failed: "failed", -} as const; diff --git a/src/api/types/EmbedJobTruncate.ts b/src/api/types/EmbedJobTruncate.ts deleted file mode 100644 index de4a2967..00000000 --- a/src/api/types/EmbedJobTruncate.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The truncation option used - */ -export type EmbedJobTruncate = "START" | "END"; -export const EmbedJobTruncate = { - Start: "START", - End: "END", -} as const; diff --git a/src/api/types/EmbedRequestTruncate.ts b/src/api/types/EmbedRequestTruncate.ts deleted file mode 100644 index 79ca8191..00000000 --- a/src/api/types/EmbedRequestTruncate.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - * - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - * - * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - */ -export type EmbedRequestTruncate = "NONE" | "START" | "END"; -export const EmbedRequestTruncate = { - None: "NONE", - Start: "START", - End: "END", -} as const; diff --git a/src/api/types/EmbedResponse.ts b/src/api/types/EmbedResponse.ts index 7cbfed24..7b8cddbf 100644 --- a/src/api/types/EmbedResponse.ts +++ b/src/api/types/EmbedResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export type EmbedResponse = Cohere.EmbedResponse.EmbeddingsFloats | Cohere.EmbedResponse.EmbeddingsByType; export namespace EmbedResponse { export interface EmbeddingsFloats extends Cohere.EmbedFloatsResponse { - responseType: "embeddings_floats"; + response_type: "embeddings_floats"; } export interface EmbeddingsByType extends Cohere.EmbedByTypeResponse { - responseType: "embeddings_by_type"; + response_type: "embeddings_by_type"; } } diff --git a/src/api/types/FinetuneDatasetMetrics.ts b/src/api/types/FinetuneDatasetMetrics.ts index 548da317..85fb87ce 100644 --- a/src/api/types/FinetuneDatasetMetrics.ts +++ b/src/api/types/FinetuneDatasetMetrics.ts @@ -4,15 +4,15 @@ export interface FinetuneDatasetMetrics { /** The number of tokens of valid examples that can be used for training. */ - trainableTokenCount?: number; + trainable_token_count?: number; /** The overall number of examples. */ - totalExamples?: number; + total_examples?: number; /** The number of training examples. */ - trainExamples?: number; + train_examples?: number; /** The size in bytes of all training examples. */ - trainSizeBytes?: number; + train_size_bytes?: number; /** Number of evaluation examples. */ - evalExamples?: number; + eval_examples?: number; /** The size in bytes of all eval examples. */ - evalSizeBytes?: number; + eval_size_bytes?: number; } diff --git a/src/api/types/GenerateRequestReturnLikelihoods.ts b/src/api/types/GenerateRequestReturnLikelihoods.ts deleted file mode 100644 index 7d7661b8..00000000 --- a/src/api/types/GenerateRequestReturnLikelihoods.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. - * - * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. - * - * WARNING: `ALL` is deprecated, and will be removed in a future release. - */ -export type GenerateRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; -export const GenerateRequestReturnLikelihoods = { - Generation: "GENERATION", - All: "ALL", - None: "NONE", -} as const; diff --git a/src/api/types/GenerateRequestTruncate.ts b/src/api/types/GenerateRequestTruncate.ts deleted file mode 100644 index c9c0d528..00000000 --- a/src/api/types/GenerateRequestTruncate.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - * - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - * - * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - */ -export type GenerateRequestTruncate = "NONE" | "START" | "END"; -export const GenerateRequestTruncate = { - None: "NONE", - Start: "START", - End: "END", -} as const; diff --git a/src/api/types/GenerateStreamEnd.ts b/src/api/types/GenerateStreamEnd.ts index 3d6a5760..6f862c0d 100644 --- a/src/api/types/GenerateStreamEnd.ts +++ b/src/api/types/GenerateStreamEnd.ts @@ -2,10 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface GenerateStreamEnd extends Cohere.GenerateStreamEvent { - isFinished: boolean; - finishReason?: Cohere.FinishReason; - response: Cohere.GenerateStreamEndResponse; + is_finished: boolean; + finish_reason?: Cohere.FinishReason; + response: GenerateStreamEnd.Response; +} + +export namespace GenerateStreamEnd { + export interface Response { + id: string; + prompt?: string; + generations?: Cohere.SingleGenerationInStream[]; + } } diff --git a/src/api/types/GenerateStreamEndResponse.ts b/src/api/types/GenerateStreamEndResponse.ts deleted file mode 100644 index 769f4db0..00000000 --- a/src/api/types/GenerateStreamEndResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface GenerateStreamEndResponse { - id: string; - prompt?: string; - generations?: Cohere.SingleGenerationInStream[]; -} diff --git a/src/api/types/GenerateStreamError.ts b/src/api/types/GenerateStreamError.ts index 1ada5dd7..9f737ae5 100644 --- a/src/api/types/GenerateStreamError.ts +++ b/src/api/types/GenerateStreamError.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface GenerateStreamError extends Cohere.GenerateStreamEvent { /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ index?: number; - isFinished: boolean; - finishReason: Cohere.FinishReason; + is_finished: boolean; + finish_reason: Cohere.FinishReason; /** Error message */ err: string; } diff --git a/src/api/types/GenerateStreamRequestReturnLikelihoods.ts b/src/api/types/GenerateStreamRequestReturnLikelihoods.ts deleted file mode 100644 index 55699010..00000000 --- a/src/api/types/GenerateStreamRequestReturnLikelihoods.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. - * - * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. - * - * WARNING: `ALL` is deprecated, and will be removed in a future release. - */ -export type GenerateStreamRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; -export const GenerateStreamRequestReturnLikelihoods = { - Generation: "GENERATION", - All: "ALL", - None: "NONE", -} as const; diff --git a/src/api/types/GenerateStreamRequestTruncate.ts b/src/api/types/GenerateStreamRequestTruncate.ts deleted file mode 100644 index f64dcbec..00000000 --- a/src/api/types/GenerateStreamRequestTruncate.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. - * - * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. - * - * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. - */ -export type GenerateStreamRequestTruncate = "NONE" | "START" | "END"; -export const GenerateStreamRequestTruncate = { - None: "NONE", - Start: "START", - End: "END", -} as const; diff --git a/src/api/types/GenerateStreamText.ts b/src/api/types/GenerateStreamText.ts index eb8aac76..ac4f3354 100644 --- a/src/api/types/GenerateStreamText.ts +++ b/src/api/types/GenerateStreamText.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface GenerateStreamText extends Cohere.GenerateStreamEvent { /** A segment of text of the generation. */ text: string; /** Refers to the nth generation. Only present when `num_generations` is greater than zero, and only when text responses are being streamed. */ index?: number; - isFinished: boolean; + is_finished: boolean; } diff --git a/src/api/types/GenerateStreamedResponse.ts b/src/api/types/GenerateStreamedResponse.ts index 1838d15e..5fdfbd48 100644 --- a/src/api/types/GenerateStreamedResponse.ts +++ b/src/api/types/GenerateStreamedResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Response in content type stream when `stream` is `true` in the request parameters. Generation tokens are streamed with the GenerationStream response. The final response is of type GenerationFinalResponse. @@ -14,14 +14,14 @@ export type GenerateStreamedResponse = export namespace GenerateStreamedResponse { export interface TextGeneration extends Cohere.GenerateStreamText { - eventType: "text-generation"; + event_type: "text-generation"; } export interface StreamEnd extends Cohere.GenerateStreamEnd { - eventType: "stream-end"; + event_type: "stream-end"; } export interface StreamError extends Cohere.GenerateStreamError { - eventType: "stream-error"; + event_type: "stream-error"; } } diff --git a/src/api/types/Generation.ts b/src/api/types/Generation.ts index 1b7a121b..b34878e0 100644 --- a/src/api/types/Generation.ts +++ b/src/api/types/Generation.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface Generation { id: string; diff --git a/src/api/types/GetConnectorResponse.ts b/src/api/types/GetConnectorResponse.ts index c4dfef82..0808691e 100644 --- a/src/api/types/GetConnectorResponse.ts +++ b/src/api/types/GetConnectorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface GetConnectorResponse { connector: Cohere.Connector; diff --git a/src/api/types/GetModelResponse.ts b/src/api/types/GetModelResponse.ts index 2af432ff..2da09a17 100644 --- a/src/api/types/GetModelResponse.ts +++ b/src/api/types/GetModelResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Contains information about the model and which API endpoints it can be used with. @@ -15,13 +15,13 @@ export interface GetModelResponse { /** Whether the model has been fine-tuned or not. */ finetuned?: boolean; /** The maximum number of tokens that the model can process in a single request. Note that not all of these tokens are always available due to special tokens and preambles that Cohere has added by default. */ - contextLength?: number; + context_length?: number; /** Public URL to the tokenizer's configuration file. */ - tokenizerUrl?: string; + tokenizer_url?: string; /** Whether the model supports image inputs or not. */ - supportsVision?: boolean; + supports_vision?: boolean; /** The API endpoints that the model is default to. */ - defaultEndpoints?: Cohere.CompatibleEndpoint[]; + default_endpoints?: Cohere.CompatibleEndpoint[]; /** The features that the model supports. */ features?: string[]; } diff --git a/src/api/types/Image.ts b/src/api/types/Image.ts index 96bbd28c..8fce37ec 100644 --- a/src/api/types/Image.ts +++ b/src/api/types/Image.ts @@ -10,5 +10,5 @@ export interface Image { /** Format of the image */ format: string; /** Bit depth of the image */ - bitDepth: number; + bit_depth: number; } diff --git a/src/api/types/ImageContent.ts b/src/api/types/ImageContent.ts index ea20837c..5173bc9d 100644 --- a/src/api/types/ImageContent.ts +++ b/src/api/types/ImageContent.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Image content of the message. */ export interface ImageContent { - imageUrl: Cohere.ImageUrl; + image_url: Cohere.ImageUrl; } diff --git a/src/api/types/ImageUrl.ts b/src/api/types/ImageUrl.ts index 76f8e646..ba3ae57d 100644 --- a/src/api/types/ImageUrl.ts +++ b/src/api/types/ImageUrl.ts @@ -2,9 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -/** - * Base64 url of image. - */ export interface ImageUrl { + /** URL of an image. Can be either a base64 data URI or a web URL. */ url: string; + /** Controls the level of detail in image processing. `"auto"` is the default and lets the system choose, `"low"` is faster but less detailed, and `"high"` preserves maximum detail. You can save tokens and speed up responses by using detail: `"low"`. */ + detail?: ImageUrl.Detail; +} + +export namespace ImageUrl { + /** + * Controls the level of detail in image processing. `"auto"` is the default and lets the system choose, `"low"` is faster but less detailed, and `"high"` preserves maximum detail. You can save tokens and speed up responses by using detail: `"low"`. + */ + export type Detail = "auto" | "low" | "high"; + export const Detail = { + Auto: "auto", + Low: "low", + High: "high", + } as const; } diff --git a/src/api/types/JsonResponseFormatV2.ts b/src/api/types/JsonResponseFormatV2.ts index ebfa3354..7b5814d8 100644 --- a/src/api/types/JsonResponseFormatV2.ts +++ b/src/api/types/JsonResponseFormatV2.ts @@ -19,5 +19,5 @@ export interface JsonResponseFormatV2 { * * **Note**: This field must not be specified when the `type` is set to `"text"`. */ - jsonSchema?: Record; + json_schema?: Record; } diff --git a/src/api/types/LabelMetric.ts b/src/api/types/LabelMetric.ts index 621bac02..24ca9bda 100644 --- a/src/api/types/LabelMetric.ts +++ b/src/api/types/LabelMetric.ts @@ -4,7 +4,7 @@ export interface LabelMetric { /** Total number of examples for this label */ - totalExamples?: number; + total_examples?: number; /** value of the label */ label?: string; /** samples for this label */ diff --git a/src/api/types/ListConnectorsResponse.ts b/src/api/types/ListConnectorsResponse.ts index 06ade011..172f84ff 100644 --- a/src/api/types/ListConnectorsResponse.ts +++ b/src/api/types/ListConnectorsResponse.ts @@ -2,10 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ListConnectorsResponse { connectors: Cohere.Connector[]; /** Total number of connectors. */ - totalCount?: number; + total_count?: number; } diff --git a/src/api/types/ListEmbedJobResponse.ts b/src/api/types/ListEmbedJobResponse.ts index b72e13f5..ed1b9805 100644 --- a/src/api/types/ListEmbedJobResponse.ts +++ b/src/api/types/ListEmbedJobResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ListEmbedJobResponse { - embedJobs?: Cohere.EmbedJob[]; + embed_jobs?: Cohere.EmbedJob[]; } diff --git a/src/api/types/ListModelsResponse.ts b/src/api/types/ListModelsResponse.ts index a341272b..162febeb 100644 --- a/src/api/types/ListModelsResponse.ts +++ b/src/api/types/ListModelsResponse.ts @@ -2,10 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ListModelsResponse { models: Cohere.GetModelResponse[]; /** A token to retrieve the next page of results. Provide in the page_token parameter of the next request. */ - nextPageToken?: string; + next_page_token?: string; } diff --git a/src/api/types/LogprobItem.ts b/src/api/types/LogprobItem.ts index 7532f5c9..5489d42f 100644 --- a/src/api/types/LogprobItem.ts +++ b/src/api/types/LogprobItem.ts @@ -6,7 +6,7 @@ export interface LogprobItem { /** The text chunk for which the log probabilities was calculated. */ text?: string; /** The token ids of each token used to construct the text chunk. */ - tokenIds: number[]; + token_ids: number[]; /** The log probability of each token used to construct the text chunk. */ logprobs?: number[]; } diff --git a/src/api/types/Message.ts b/src/api/types/Message.ts index 94d4f46e..274ed56e 100644 --- a/src/api/types/Message.ts +++ b/src/api/types/Message.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export type Message = Cohere.Message.Chatbot | Cohere.Message.System | Cohere.Message.User | Cohere.Message.Tool; @@ -19,7 +19,7 @@ export namespace Message { role: "USER"; } - export interface Tool extends Cohere.ToolMessage { + export interface Tool extends Cohere.ChatToolMessage { role: "TOOL"; } } diff --git a/src/api/types/Metrics.ts b/src/api/types/Metrics.ts index 954f6a70..ddd6f119 100644 --- a/src/api/types/Metrics.ts +++ b/src/api/types/Metrics.ts @@ -2,9 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface Metrics { - finetuneDatasetMetrics?: Cohere.FinetuneDatasetMetrics; - embedData?: Cohere.MetricsEmbedData; + finetune_dataset_metrics?: Cohere.FinetuneDatasetMetrics; } diff --git a/src/api/types/MetricsEmbedData.ts b/src/api/types/MetricsEmbedData.ts deleted file mode 100644 index 8cba241a..00000000 --- a/src/api/types/MetricsEmbedData.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface MetricsEmbedData { - /** the fields in the dataset */ - fields?: Cohere.MetricsEmbedDataFieldsItem[]; -} diff --git a/src/api/types/MetricsEmbedDataFieldsItem.ts b/src/api/types/MetricsEmbedDataFieldsItem.ts deleted file mode 100644 index 1f1fdb8e..00000000 --- a/src/api/types/MetricsEmbedDataFieldsItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface MetricsEmbedDataFieldsItem { - /** the name of the field */ - name?: string; - /** the number of times the field appears in the dataset */ - count?: number; -} diff --git a/src/api/types/NonStreamedChatResponse.ts b/src/api/types/NonStreamedChatResponse.ts index f9bbec28..c02431f0 100644 --- a/src/api/types/NonStreamedChatResponse.ts +++ b/src/api/types/NonStreamedChatResponse.ts @@ -2,30 +2,28 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface NonStreamedChatResponse { /** Contents of the reply generated by the model. */ text: string; /** Unique identifier for the generated reply. Useful for submitting feedback. */ - generationId?: string; + generation_id?: string; /** Unique identifier for the response. */ - responseId?: string; + response_id?: string; /** Inline citations for the generated reply. */ citations?: Cohere.ChatCitation[]; /** Documents seen by the model when generating the reply. */ documents?: Cohere.ChatDocument[]; /** Denotes that a search for documents is required during the RAG flow. */ - isSearchRequired?: boolean; + is_search_required?: boolean; /** Generated search queries, meant to be used as part of the RAG flow. */ - searchQueries?: Cohere.ChatSearchQuery[]; + search_queries?: Cohere.ChatSearchQuery[]; /** Documents retrieved from each of the conducted searches. */ - searchResults?: Cohere.ChatSearchResult[]; - finishReason?: Cohere.FinishReason; - toolCalls?: Cohere.ToolCall[]; + search_results?: Cohere.ChatSearchResult[]; + finish_reason?: Cohere.FinishReason; + tool_calls?: Cohere.ToolCall[]; /** A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's `message`. */ - chatHistory?: Cohere.Message[]; - /** The prompt that was used. Only present when `return_prompt` in the request is set to true. */ - prompt?: string; + chat_history?: Cohere.Message[]; meta?: Cohere.ApiMeta; } diff --git a/src/api/types/OAuthAuthorizeResponse.ts b/src/api/types/OAuthAuthorizeResponse.ts index c9cd885f..d27cdafa 100644 --- a/src/api/types/OAuthAuthorizeResponse.ts +++ b/src/api/types/OAuthAuthorizeResponse.ts @@ -4,5 +4,5 @@ export interface OAuthAuthorizeResponse { /** The OAuth 2.0 redirect url. Redirect the user to this url to authorize the connector. */ - redirectUrl?: string; + redirect_url?: string; } diff --git a/src/api/types/RerankRequestDocumentsItem.ts b/src/api/types/RerankRequestDocumentsItem.ts deleted file mode 100644 index 6e750bd0..00000000 --- a/src/api/types/RerankRequestDocumentsItem.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export type RerankRequestDocumentsItem = string | Cohere.RerankDocument; diff --git a/src/api/types/RerankResponse.ts b/src/api/types/RerankResponse.ts index 79e56248..eb732214 100644 --- a/src/api/types/RerankResponse.ts +++ b/src/api/types/RerankResponse.ts @@ -2,11 +2,36 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface RerankResponse { id?: string; /** An ordered list of ranked documents */ - results: Cohere.RerankResponseResultsItem[]; + results: RerankResponse.Results.Item[]; meta?: Cohere.ApiMeta; } + +export namespace RerankResponse { + export type Results = Results.Item[]; + + export namespace Results { + export interface Item { + /** If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in */ + document?: Item.Document; + /** Corresponds to the index in the original list of documents to which the ranked document belongs. (i.e. if the first value in the `results` object has an `index` value of 3, it means in the list of documents passed in, the document at `index=3` had the highest relevance) */ + index: number; + /** Relevance scores are normalized to be in the range `[0, 1]`. Scores close to `1` indicate a high relevance to the query, and scores closer to `0` indicate low relevance. It is not accurate to assume a score of 0.9 means the document is 2x more relevant than a document with a score of 0.45 */ + relevance_score?: number; + } + + export namespace Item { + /** + * If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in + */ + export interface Document { + /** The text of the document to rerank */ + text: string; + } + } + } +} diff --git a/src/api/types/RerankResponseResultsItem.ts b/src/api/types/RerankResponseResultsItem.ts deleted file mode 100644 index b6446984..00000000 --- a/src/api/types/RerankResponseResultsItem.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export interface RerankResponseResultsItem { - /** If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in */ - document?: Cohere.RerankResponseResultsItemDocument; - /** Corresponds to the index in the original list of documents to which the ranked document belongs. (i.e. if the first value in the `results` object has an `index` value of 3, it means in the list of documents passed in, the document at `index=3` had the highest relevance) */ - index: number; - /** Relevance scores are normalized to be in the range `[0, 1]`. Scores close to `1` indicate a high relevance to the query, and scores closer to `0` indicate low relevance. It is not accurate to assume a score of 0.9 means the document is 2x more relevant than a document with a score of 0.45 */ - relevanceScore: number; -} diff --git a/src/api/types/RerankResponseResultsItemDocument.ts b/src/api/types/RerankResponseResultsItemDocument.ts deleted file mode 100644 index 7ef54176..00000000 --- a/src/api/types/RerankResponseResultsItemDocument.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in - */ -export interface RerankResponseResultsItemDocument { - /** The text of the document to rerank */ - text: string; -} diff --git a/src/api/types/RerankerDataMetrics.ts b/src/api/types/RerankerDataMetrics.ts index 67eff1ac..7436c132 100644 --- a/src/api/types/RerankerDataMetrics.ts +++ b/src/api/types/RerankerDataMetrics.ts @@ -4,15 +4,15 @@ export interface RerankerDataMetrics { /** The number of training queries. */ - numTrainQueries?: number; + num_train_queries?: number; /** The sum of all relevant passages of valid training examples. */ - numTrainRelevantPassages?: number; + num_train_relevant_passages?: number; /** The sum of all hard negatives of valid training examples. */ - numTrainHardNegatives?: number; + num_train_hard_negatives?: number; /** The number of evaluation queries. */ - numEvalQueries?: number; + num_eval_queries?: number; /** The sum of all relevant passages of valid eval examples. */ - numEvalRelevantPassages?: number; + num_eval_relevant_passages?: number; /** The sum of all hard negatives of valid eval examples. */ - numEvalHardNegatives?: number; + num_eval_hard_negatives?: number; } diff --git a/src/api/types/ResponseFormat.ts b/src/api/types/ResponseFormat.ts index 7c8f4912..7a0c1d3d 100644 --- a/src/api/types/ResponseFormat.ts +++ b/src/api/types/ResponseFormat.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Configuration for forcing the model output to adhere to the specified format. Supported on [Command R 03-2024](https://docs.cohere.com/docs/command-r), [Command R+ 04-2024](https://docs.cohere.com/docs/command-r-plus) and newer models. @@ -17,7 +17,7 @@ import * as Cohere from "../index"; export type ResponseFormat = Cohere.ResponseFormat.Text | Cohere.ResponseFormat.JsonObject; export namespace ResponseFormat { - export interface Text extends Cohere.TextResponseFormat { + export interface Text extends Cohere.ChatTextResponseFormat { type: "text"; } diff --git a/src/api/types/ResponseFormatV2.ts b/src/api/types/ResponseFormatV2.ts index 2f891a82..b76fa7a5 100644 --- a/src/api/types/ResponseFormatV2.ts +++ b/src/api/types/ResponseFormatV2.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/v2/docs/command-r), [Command R+](https://docs.cohere.com/v2/docs/command-r-plus) and newer models. @@ -20,7 +20,7 @@ import * as Cohere from "../index"; export type ResponseFormatV2 = Cohere.ResponseFormatV2.Text | Cohere.ResponseFormatV2.JsonObject; export namespace ResponseFormatV2 { - export interface Text extends Cohere.TextResponseFormatV2 { + export interface Text extends Cohere.ChatTextResponseFormatV2 { type: "text"; } diff --git a/src/api/types/SingleGeneration.ts b/src/api/types/SingleGeneration.ts index 3ef6f92b..81f787f4 100644 --- a/src/api/types/SingleGeneration.ts +++ b/src/api/types/SingleGeneration.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - export interface SingleGeneration { id: string; text: string; @@ -11,5 +9,16 @@ export interface SingleGeneration { index?: number; likelihood?: number; /** Only returned if `return_likelihoods` is set to `GENERATION` or `ALL`. The likelihood refers to the average log-likelihood of the entire specified string, which is useful for [evaluating the performance of your model](likelihood-eval), especially if you've created a [custom model](https://docs.cohere.com/docs/training-custom-models). Individual token likelihoods provide the log-likelihood of each token. The first token will not have a likelihood. */ - tokenLikelihoods?: Cohere.SingleGenerationTokenLikelihoodsItem[]; + token_likelihoods?: SingleGeneration.TokenLikelihoods.Item[]; +} + +export namespace SingleGeneration { + export type TokenLikelihoods = TokenLikelihoods.Item[]; + + export namespace TokenLikelihoods { + export interface Item { + token: string; + likelihood: number; + } + } } diff --git a/src/api/types/SingleGenerationInStream.ts b/src/api/types/SingleGenerationInStream.ts index 69e88d7c..559bba6c 100644 --- a/src/api/types/SingleGenerationInStream.ts +++ b/src/api/types/SingleGenerationInStream.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface SingleGenerationInStream { id: string; @@ -10,5 +10,5 @@ export interface SingleGenerationInStream { text: string; /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ index?: number; - finishReason: Cohere.FinishReason; + finish_reason: Cohere.FinishReason; } diff --git a/src/api/types/SingleGenerationTokenLikelihoodsItem.ts b/src/api/types/SingleGenerationTokenLikelihoodsItem.ts deleted file mode 100644 index 533d9d82..00000000 --- a/src/api/types/SingleGenerationTokenLikelihoodsItem.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface SingleGenerationTokenLikelihoodsItem { - token: string; - likelihood: number; -} diff --git a/src/api/types/Source.ts b/src/api/types/Source.ts index 9375c2f6..e221e1e2 100644 --- a/src/api/types/Source.ts +++ b/src/api/types/Source.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A source object containing information about the source of the data cited. @@ -10,11 +10,11 @@ import * as Cohere from "../index"; export type Source = Cohere.Source.Tool | Cohere.Source.Document; export namespace Source { - export interface Tool extends Cohere.ToolSource { + export interface Tool extends Cohere.ChatToolSource { type: "tool"; } - export interface Document extends Cohere.DocumentSource { + export interface Document extends Cohere.ChatDocumentSource { type: "document"; } } diff --git a/src/api/types/StreamedChatResponse.ts b/src/api/types/StreamedChatResponse.ts index 439783ef..95ebf4bf 100644 --- a/src/api/types/StreamedChatResponse.ts +++ b/src/api/types/StreamedChatResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request). @@ -20,38 +20,38 @@ export type StreamedChatResponse = export namespace StreamedChatResponse { export interface StreamStart extends Cohere.ChatStreamStartEvent { - eventType: "stream-start"; + event_type: "stream-start"; } export interface SearchQueriesGeneration extends Cohere.ChatSearchQueriesGenerationEvent { - eventType: "search-queries-generation"; + event_type: "search-queries-generation"; } export interface SearchResults extends Cohere.ChatSearchResultsEvent { - eventType: "search-results"; + event_type: "search-results"; } export interface TextGeneration extends Cohere.ChatTextGenerationEvent { - eventType: "text-generation"; + event_type: "text-generation"; } export interface CitationGeneration extends Cohere.ChatCitationGenerationEvent { - eventType: "citation-generation"; + event_type: "citation-generation"; } export interface ToolCallsGeneration extends Cohere.ChatToolCallsGenerationEvent { - eventType: "tool-calls-generation"; + event_type: "tool-calls-generation"; } export interface StreamEnd extends Cohere.ChatStreamEndEvent { - eventType: "stream-end"; + event_type: "stream-end"; } export interface ToolCallsChunk extends Cohere.ChatToolCallsChunkEvent { - eventType: "tool-calls-chunk"; + event_type: "tool-calls-chunk"; } export interface Debug extends Cohere.ChatDebugEvent { - eventType: "debug"; + event_type: "debug"; } } diff --git a/src/api/types/StreamedChatResponseV2.ts b/src/api/types/StreamedChatResponseV2.ts index dc8a0556..15ea5b15 100644 --- a/src/api/types/StreamedChatResponseV2.ts +++ b/src/api/types/StreamedChatResponseV2.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request). diff --git a/src/api/types/SummarizeRequestExtractiveness.ts b/src/api/types/SummarizeRequestExtractiveness.ts deleted file mode 100644 index dbf2ca2f..00000000 --- a/src/api/types/SummarizeRequestExtractiveness.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. - */ -export type SummarizeRequestExtractiveness = "low" | "medium" | "high"; -export const SummarizeRequestExtractiveness = { - Low: "low", - Medium: "medium", - High: "high", -} as const; diff --git a/src/api/types/SummarizeRequestFormat.ts b/src/api/types/SummarizeRequestFormat.ts deleted file mode 100644 index aaba1c8a..00000000 --- a/src/api/types/SummarizeRequestFormat.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. - */ -export type SummarizeRequestFormat = "paragraph" | "bullets"; -export const SummarizeRequestFormat = { - Paragraph: "paragraph", - Bullets: "bullets", -} as const; diff --git a/src/api/types/SummarizeRequestLength.ts b/src/api/types/SummarizeRequestLength.ts deleted file mode 100644 index d5a7742a..00000000 --- a/src/api/types/SummarizeRequestLength.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. - */ -export type SummarizeRequestLength = "short" | "medium" | "long"; -export const SummarizeRequestLength = { - Short: "short", - Medium: "medium", - Long: "long", -} as const; diff --git a/src/api/types/SummarizeResponse.ts b/src/api/types/SummarizeResponse.ts index 2dd7da0d..28f8b92e 100644 --- a/src/api/types/SummarizeResponse.ts +++ b/src/api/types/SummarizeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface SummarizeResponse { /** Generated ID for the summary */ diff --git a/src/api/types/SystemMessage.ts b/src/api/types/SystemMessage.ts deleted file mode 100644 index 34731dfd..00000000 --- a/src/api/types/SystemMessage.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * 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/types/SystemMessageContent.ts b/src/api/types/SystemMessageContent.ts deleted file mode 100644 index 4bf64523..00000000 --- a/src/api/types/SystemMessageContent.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * 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/types/SystemMessageContentItem.ts b/src/api/types/SystemMessageContentItem.ts deleted file mode 100644 index ec85c628..00000000 --- a/src/api/types/SystemMessageContentItem.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -export type SystemMessageContentItem = Cohere.SystemMessageContentItem.Text; - -export namespace SystemMessageContentItem { - export interface Text extends Cohere.TextContent { - type: "text"; - } -} diff --git a/src/api/types/SystemMessageV2.ts b/src/api/types/SystemMessageV2.ts new file mode 100644 index 00000000..3f483164 --- /dev/null +++ b/src/api/types/SystemMessageV2.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../index.js"; + +/** + * A message from the system. + */ +export interface SystemMessageV2 { + content: SystemMessageV2.Content; +} + +export namespace SystemMessageV2 { + export type Content = string | Cohere.SystemMessageV2ContentItem[]; +} diff --git a/src/api/types/SystemMessageV2ContentItem.ts b/src/api/types/SystemMessageV2ContentItem.ts new file mode 100644 index 00000000..e2b2a93f --- /dev/null +++ b/src/api/types/SystemMessageV2ContentItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../index.js"; + +export type SystemMessageV2ContentItem = Cohere.SystemMessageV2ContentItem.Text; + +export namespace SystemMessageV2ContentItem { + export interface Text extends Cohere.ChatTextContent { + type: "text"; + } +} diff --git a/src/api/types/TokenizeResponse.ts b/src/api/types/TokenizeResponse.ts index 59d656b0..cc52d0ba 100644 --- a/src/api/types/TokenizeResponse.ts +++ b/src/api/types/TokenizeResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface TokenizeResponse { /** An array of tokens, where each token is an integer. */ - tokens: number[]; - tokenStrings: string[]; + tokens?: number[]; + token_strings: string[]; meta?: Cohere.ApiMeta; } diff --git a/src/api/types/Tool.ts b/src/api/types/Tool.ts index e43ede9a..60418ccf 100644 --- a/src/api/types/Tool.ts +++ b/src/api/types/Tool.ts @@ -2,8 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - export interface Tool { /** The name of the tool to be called. Valid names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit. */ name: string; @@ -21,5 +19,18 @@ export interface Tool { * } * ``` */ - parameterDefinitions?: Record; + parameter_definitions?: Record; +} + +export namespace Tool { + export namespace ParameterDefinitions { + export interface Value { + /** The description of the parameter. */ + description?: string; + /** The type of the parameter. Must be a valid Python type. */ + type: string; + /** Denotes whether the parameter is always present (required) or not. Defaults to not required. */ + required?: boolean; + } + } } diff --git a/src/api/types/ToolCallV2.ts b/src/api/types/ToolCallV2.ts index d9bfba3d..fca1ff27 100644 --- a/src/api/types/ToolCallV2.ts +++ b/src/api/types/ToolCallV2.ts @@ -2,13 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - /** * An array of tool calls to be made. */ export interface ToolCallV2 { id?: string; type?: "function"; - function?: Cohere.ToolCallV2Function; + function?: ToolCallV2.Function; +} + +export namespace ToolCallV2 { + export interface Function { + name?: string; + arguments?: string; + } } diff --git a/src/api/types/ToolCallV2Function.ts b/src/api/types/ToolCallV2Function.ts deleted file mode 100644 index 2c1e8dbf..00000000 --- a/src/api/types/ToolCallV2Function.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ToolCallV2Function { - name?: string; - arguments?: string; -} diff --git a/src/api/types/ToolContent.ts b/src/api/types/ToolContent.ts index 2e757f4c..17e0689a 100644 --- a/src/api/types/ToolContent.ts +++ b/src/api/types/ToolContent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A content block which contains information about the content of a tool result @@ -10,7 +10,7 @@ import * as Cohere from "../index"; export type ToolContent = Cohere.ToolContent.Text | Cohere.ToolContent.Document; export namespace ToolContent { - export interface Text extends Cohere.TextContent { + export interface Text extends Cohere.ChatTextContent { type: "text"; } diff --git a/src/api/types/ToolMessageV2.ts b/src/api/types/ToolMessageV2.ts index 70eb7a4f..354e04d0 100644 --- a/src/api/types/ToolMessageV2.ts +++ b/src/api/types/ToolMessageV2.ts @@ -2,14 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; /** * A message with Tool outputs. */ export interface ToolMessageV2 { /** The id of the associated tool call that has provided the given content */ - toolCallId: string; + tool_call_id: string; /** Outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks */ - content: Cohere.ToolMessageV2Content; + content: ToolMessageV2.Content; +} + +export namespace ToolMessageV2 { + /** + * Outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks + */ + export type Content = string | Cohere.ToolContent[]; } diff --git a/src/api/types/ToolMessageV2Content.ts b/src/api/types/ToolMessageV2Content.ts deleted file mode 100644 index 1a062f6c..00000000 --- a/src/api/types/ToolMessageV2Content.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -/** - * Outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks - */ -export type ToolMessageV2Content = string | Cohere.ToolContent[]; diff --git a/src/api/types/ToolParameterDefinitionsValue.ts b/src/api/types/ToolParameterDefinitionsValue.ts deleted file mode 100644 index 1e3a3478..00000000 --- a/src/api/types/ToolParameterDefinitionsValue.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface ToolParameterDefinitionsValue { - /** The description of the parameter. */ - description?: string; - /** The type of the parameter. Must be a valid Python type. */ - type: string; - /** Denotes whether the parameter is always present (required) or not. Defaults to not required. */ - required?: boolean; -} diff --git a/src/api/types/ToolResult.ts b/src/api/types/ToolResult.ts index 8df9eb54..c4f85442 100644 --- a/src/api/types/ToolResult.ts +++ b/src/api/types/ToolResult.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface ToolResult { call: Cohere.ToolCall; diff --git a/src/api/types/ToolV2.ts b/src/api/types/ToolV2.ts index e4f951b3..0ea825cc 100644 --- a/src/api/types/ToolV2.ts +++ b/src/api/types/ToolV2.ts @@ -2,10 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; - export interface ToolV2 { type?: "function"; /** The function to be executed. */ - function?: Cohere.ToolV2Function; + function?: ToolV2.Function; +} + +export namespace ToolV2 { + /** + * The function to be executed. + */ + export interface Function { + /** The name of the function. */ + name: string; + /** The description of the function. */ + description?: string; + /** The parameters of the function as a JSON schema. */ + parameters: Record; + } } diff --git a/src/api/types/ToolV2Function.ts b/src/api/types/ToolV2Function.ts deleted file mode 100644 index b02383cf..00000000 --- a/src/api/types/ToolV2Function.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The function to be executed. - */ -export interface ToolV2Function { - /** The name of the function. */ - name: string; - /** The description of the function. */ - description?: string; - /** The parameters of the function as a JSON schema. */ - parameters: Record; -} diff --git a/src/api/types/TruncationStrategy.ts b/src/api/types/TruncationStrategy.ts deleted file mode 100644 index 98ad4b62..00000000 --- a/src/api/types/TruncationStrategy.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -/** - * Describes the truncation strategy for when the prompt exceeds the context length. Defaults to 'none' - */ -export type TruncationStrategy = Cohere.TruncationStrategy.Auto | Cohere.TruncationStrategy.None; - -export namespace TruncationStrategy { - export interface Auto extends Cohere.TruncationStrategyAutoPreserveOrder { - type: "auto"; - } - - export interface None extends Cohere.TruncationStrategyNone { - type: "none"; - } -} diff --git a/src/api/types/TruncationStrategyAutoPreserveOrder.ts b/src/api/types/TruncationStrategyAutoPreserveOrder.ts deleted file mode 100644 index 0b0bc76a..00000000 --- a/src/api/types/TruncationStrategyAutoPreserveOrder.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * If the prompt exceeds the context length, this truncation strategy will continuously omit the oldest tool call and tool result pairs until the prompt fits. If the prompt does not fit with only the last tool call and tool result pair, an error will be returned. - */ -export interface TruncationStrategyAutoPreserveOrder {} diff --git a/src/api/types/TruncationStrategyNone.ts b/src/api/types/TruncationStrategyNone.ts deleted file mode 100644 index 5c233e46..00000000 --- a/src/api/types/TruncationStrategyNone.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Prohibits any prompt truncation; if the context length is exceeded, an error will be returned. - */ -export interface TruncationStrategyNone {} diff --git a/src/api/types/UpdateConnectorResponse.ts b/src/api/types/UpdateConnectorResponse.ts index 06197505..f6aeb948 100644 --- a/src/api/types/UpdateConnectorResponse.ts +++ b/src/api/types/UpdateConnectorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Cohere from "../index"; +import * as Cohere from "../index.js"; export interface UpdateConnectorResponse { connector: Cohere.Connector; diff --git a/src/api/types/Usage.ts b/src/api/types/Usage.ts index 5eea78aa..fc13104d 100644 --- a/src/api/types/Usage.ts +++ b/src/api/types/Usage.ts @@ -2,9 +2,27 @@ * 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; + billed_units?: Usage.BilledUnits; + tokens?: Usage.Tokens; +} + +export namespace Usage { + export interface BilledUnits { + /** The number of billed input tokens. */ + input_tokens?: number; + /** The number of billed output tokens. */ + output_tokens?: number; + /** The number of billed search units. */ + search_units?: number; + /** The number of billed classifications units. */ + classifications?: number; + } + + export interface Tokens { + /** The number of tokens used as input to the model. */ + input_tokens?: number; + /** The number of tokens produced by the model. */ + output_tokens?: number; + } } diff --git a/src/api/types/UsageBilledUnits.ts b/src/api/types/UsageBilledUnits.ts deleted file mode 100644 index b8c39f80..00000000 --- a/src/api/types/UsageBilledUnits.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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/types/UsageTokens.ts b/src/api/types/UsageTokens.ts deleted file mode 100644 index 851e2cac..00000000 --- a/src/api/types/UsageTokens.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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/types/UserMessage.ts b/src/api/types/UserMessage.ts deleted file mode 100644 index 2829b540..00000000 --- a/src/api/types/UserMessage.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -/** - * A message from the user. - */ -export interface UserMessage { - /** - * The content of the message. This can be a string or a list of content blocks. - * If a string is provided, it will be treated as a text content block. - */ - content: Cohere.UserMessageContent; -} diff --git a/src/api/types/UserMessageContent.ts b/src/api/types/UserMessageContent.ts deleted file mode 100644 index 7b676d17..00000000 --- a/src/api/types/UserMessageContent.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Cohere from "../index"; - -/** - * The content of the message. This can be a string or a list of content blocks. - * If a string is provided, it will be treated as a text content block. - */ -export type UserMessageContent = string | Cohere.Content[]; diff --git a/src/api/types/UserMessageV2.ts b/src/api/types/UserMessageV2.ts new file mode 100644 index 00000000..81656e48 --- /dev/null +++ b/src/api/types/UserMessageV2.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../index.js"; + +/** + * A message from the user. + */ +export interface UserMessageV2 { + /** + * The content of the message. This can be a string or a list of content blocks. + * If a string is provided, it will be treated as a text content block. + */ + content: UserMessageV2.Content; +} + +export namespace UserMessageV2 { + /** + * The content of the message. This can be a string or a list of content blocks. + * If a string is provided, it will be treated as a text content block. + */ + export type Content = string | Cohere.Content[]; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index e13942c0..b236e9b9 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,199 +1,131 @@ -export * from "./ChatStreamRequestPromptTruncation"; -export * from "./ChatStreamRequestCitationQuality"; -export * from "./ChatStreamRequestConnectorsSearchOptions"; -export * from "./ChatStreamRequestSafetyMode"; -export * from "./ChatRequestPromptTruncation"; -export * from "./ChatRequestCitationQuality"; -export * from "./ChatRequestConnectorsSearchOptions"; -export * from "./ChatRequestSafetyMode"; -export * from "./GenerateStreamRequestTruncate"; -export * from "./GenerateStreamRequestReturnLikelihoods"; -export * from "./GenerateRequestTruncate"; -export * from "./GenerateRequestReturnLikelihoods"; -export * from "./EmbedRequestTruncate"; -export * from "./EmbedResponse"; -export * from "./RerankRequestDocumentsItem"; -export * from "./RerankResponseResultsItemDocument"; -export * from "./RerankResponseResultsItem"; -export * from "./RerankResponse"; -export * from "./ClassifyRequestTruncate"; -export * from "./ClassifyResponseClassificationsItemLabelsValue"; -export * from "./ClassifyResponseClassificationsItemClassificationType"; -export * from "./ClassifyResponseClassificationsItem"; -export * from "./ClassifyResponse"; -export * from "./SummarizeRequestLength"; -export * from "./SummarizeRequestFormat"; -export * from "./SummarizeRequestExtractiveness"; -export * from "./SummarizeResponse"; -export * from "./TokenizeResponse"; -export * from "./DetokenizeResponse"; -export * from "./CheckApiKeyResponse"; -export * from "./ToolCall"; -export * from "./ChatMessage"; -export * from "./ToolResult"; -export * from "./ToolMessage"; -export * from "./Message"; -export * from "./ChatConnector"; -export * from "./ChatDocument"; -export * from "./ToolParameterDefinitionsValue"; -export * from "./Tool"; -export * from "./TextResponseFormat"; -export * from "./JsonResponseFormat"; -export * from "./ResponseFormat"; -export * from "./ChatCitationType"; -export * from "./ChatCitation"; -export * from "./ChatSearchQuery"; -export * from "./ChatSearchResultConnector"; -export * from "./ChatSearchResult"; -export * from "./FinishReason"; -export * from "./ApiMetaApiVersion"; -export * from "./ApiMetaBilledUnits"; -export * from "./ApiMetaTokens"; -export * from "./ApiMeta"; -export * from "./NonStreamedChatResponse"; -export * from "./ChatStreamEvent"; -export * from "./ChatStreamStartEvent"; -export * from "./ChatSearchQueriesGenerationEvent"; -export * from "./ChatSearchResultsEvent"; -export * from "./ChatTextGenerationEvent"; -export * from "./ChatCitationGenerationEvent"; -export * from "./ChatToolCallsGenerationEvent"; -export * from "./ChatStreamEndEventFinishReason"; -export * from "./ChatStreamEndEvent"; -export * from "./ToolCallDelta"; -export * from "./ChatToolCallsChunkEvent"; -export * from "./ChatDebugEvent"; -export * from "./StreamedChatResponse"; -export * from "./TextContent"; -export * from "./ImageUrl"; -export * from "./ImageContent"; -export * from "./Content"; -export * from "./UserMessageContent"; -export * from "./UserMessage"; -export * from "./ToolCallV2Function"; -export * from "./ToolCallV2"; -export * from "./ToolSource"; -export * from "./DocumentSource"; -export * from "./Source"; -export * from "./CitationType"; -export * from "./Citation"; -export * from "./AssistantMessageContentItem"; -export * from "./AssistantMessageContent"; -export * from "./AssistantMessage"; -export * from "./SystemMessageContentItem"; -export * from "./SystemMessageContent"; -export * from "./SystemMessage"; -export * from "./Document"; -export * from "./DocumentContent"; -export * from "./ToolContent"; -export * from "./ToolMessageV2Content"; -export * from "./ToolMessageV2"; -export * from "./ChatMessageV2"; -export * from "./ChatMessages"; -export * from "./ReasoningEffort"; -export * from "./ToolV2Function"; -export * from "./ToolV2"; -export * from "./CitationOptionsMode"; -export * from "./CitationOptions"; -export * from "./TruncationStrategyAutoPreserveOrder"; -export * from "./TruncationStrategyNone"; -export * from "./TruncationStrategy"; -export * from "./TextResponseFormatV2"; -export * from "./JsonResponseFormatV2"; -export * from "./ResponseFormatV2"; -export * from "./ChatFinishReason"; -export * from "./AssistantMessageResponseContentItem"; -export * from "./AssistantMessageResponse"; -export * from "./UsageBilledUnits"; -export * from "./UsageTokens"; -export * from "./Usage"; -export * from "./LogprobItem"; -export * from "./ChatResponse"; -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 "./ChatToolPlanDeltaEventDeltaMessage"; -export * from "./ChatToolPlanDeltaEventDelta"; -export * from "./ChatToolPlanDeltaEvent"; -export * from "./ChatToolCallStartEventDeltaMessage"; -export * from "./ChatToolCallStartEventDelta"; -export * from "./ChatToolCallStartEvent"; -export * from "./ChatToolCallDeltaEventDeltaMessageToolCallsFunction"; -export * from "./ChatToolCallDeltaEventDeltaMessageToolCalls"; -export * from "./ChatToolCallDeltaEventDeltaMessage"; -export * from "./ChatToolCallDeltaEventDelta"; -export * from "./ChatToolCallDeltaEvent"; -export * from "./ChatToolCallEndEvent"; -export * from "./CitationStartEventDeltaMessage"; -export * from "./CitationStartEventDelta"; -export * from "./CitationStartEvent"; -export * from "./CitationEndEvent"; -export * from "./ChatMessageEndEventDelta"; -export * from "./ChatMessageEndEvent"; -export * from "./StreamedChatResponseV2"; -export * from "./SingleGenerationTokenLikelihoodsItem"; -export * from "./SingleGeneration"; -export * from "./Generation"; -export * from "./GenerateStreamEvent"; -export * from "./GenerateStreamText"; -export * from "./SingleGenerationInStream"; -export * from "./GenerateStreamEndResponse"; -export * from "./GenerateStreamEnd"; -export * from "./GenerateStreamError"; -export * from "./GenerateStreamedResponse"; -export * from "./EmbedInputType"; -export * from "./EmbeddingType"; -export * from "./Image"; -export * from "./EmbedFloatsResponse"; -export * from "./EmbedByTypeResponseEmbeddings"; -export * from "./EmbedByTypeResponse"; -export * from "./EmbedImageUrl"; -export * from "./EmbedImage"; -export * from "./EmbedText"; -export * from "./EmbedContent"; -export * from "./EmbedInput"; -export * from "./EmbedJobStatus"; -export * from "./EmbedJobTruncate"; -export * from "./EmbedJob"; -export * from "./ListEmbedJobResponse"; -export * from "./CreateEmbedJobResponse"; -export * from "./RerankDocument"; -export * from "./ClassifyExample"; -export * from "./DatasetValidationStatus"; -export * from "./DatasetType"; -export * from "./DatasetPart"; -export * from "./ParseInfo"; -export * from "./RerankerDataMetrics"; -export * from "./ChatDataMetrics"; -export * from "./LabelMetric"; -export * from "./ClassifyDataMetrics"; -export * from "./FinetuneDatasetMetrics"; -export * from "./MetricsEmbedDataFieldsItem"; -export * from "./MetricsEmbedData"; -export * from "./Metrics"; -export * from "./Dataset"; -export * from "./ConnectorOAuth"; -export * from "./ConnectorAuthStatus"; -export * from "./Connector"; -export * from "./ListConnectorsResponse"; -export * from "./CreateConnectorOAuth"; -export * from "./AuthTokenType"; -export * from "./CreateConnectorServiceAuth"; -export * from "./CreateConnectorResponse"; -export * from "./GetConnectorResponse"; -export * from "./DeleteConnectorResponse"; -export * from "./UpdateConnectorResponse"; -export * from "./OAuthAuthorizeResponse"; -export * from "./CompatibleEndpoint"; -export * from "./GetModelResponse"; -export * from "./ListModelsResponse"; +export * from "./StreamedChatResponse.js"; +export * from "./NonStreamedChatResponse.js"; +export * from "./GenerateStreamedResponse.js"; +export * from "./Generation.js"; +export * from "./EmbedResponse.js"; +export * from "./RerankResponse.js"; +export * from "./ClassifyResponse.js"; +export * from "./SummarizeResponse.js"; +export * from "./TokenizeResponse.js"; +export * from "./DetokenizeResponse.js"; +export * from "./CheckApiKeyResponse.js"; +export * from "./ToolCall.js"; +export * from "./ChatMessage.js"; +export * from "./ToolResult.js"; +export * from "./ChatToolMessage.js"; +export * from "./Message.js"; +export * from "./ChatConnector.js"; +export * from "./ChatDocument.js"; +export * from "./Tool.js"; +export * from "./ChatTextResponseFormat.js"; +export * from "./JsonResponseFormat.js"; +export * from "./ResponseFormat.js"; +export * from "./ChatCitation.js"; +export * from "./ChatSearchQuery.js"; +export * from "./ChatSearchResultConnector.js"; +export * from "./ChatSearchResult.js"; +export * from "./FinishReason.js"; +export * from "./ApiMeta.js"; +export * from "./ChatStreamEvent.js"; +export * from "./ChatStreamStartEvent.js"; +export * from "./ChatSearchQueriesGenerationEvent.js"; +export * from "./ChatSearchResultsEvent.js"; +export * from "./ChatTextGenerationEvent.js"; +export * from "./ChatCitationGenerationEvent.js"; +export * from "./ChatToolCallsGenerationEvent.js"; +export * from "./ChatStreamEndEvent.js"; +export * from "./ToolCallDelta.js"; +export * from "./ChatToolCallsChunkEvent.js"; +export * from "./ChatDebugEvent.js"; +export * from "./ChatTextContent.js"; +export * from "./ImageUrl.js"; +export * from "./ImageContent.js"; +export * from "./Content.js"; +export * from "./UserMessageV2.js"; +export * from "./ToolCallV2.js"; +export * from "./ChatToolSource.js"; +export * from "./ChatDocumentSource.js"; +export * from "./Source.js"; +export * from "./CitationType.js"; +export * from "./Citation.js"; +export * from "./AssistantMessageContentItem.js"; +export * from "./AssistantMessage.js"; +export * from "./SystemMessageV2ContentItem.js"; +export * from "./SystemMessageV2.js"; +export * from "./Document.js"; +export * from "./DocumentContent.js"; +export * from "./ToolContent.js"; +export * from "./ToolMessageV2.js"; +export * from "./ChatMessageV2.js"; +export * from "./ChatMessages.js"; +export * from "./ReasoningEffort.js"; +export * from "./ToolV2.js"; +export * from "./CitationOptions.js"; +export * from "./ChatTextResponseFormatV2.js"; +export * from "./JsonResponseFormatV2.js"; +export * from "./ResponseFormatV2.js"; +export * from "./ChatFinishReason.js"; +export * from "./AssistantMessageResponseContentItem.js"; +export * from "./AssistantMessageResponse.js"; +export * from "./Usage.js"; +export * from "./LogprobItem.js"; +export * from "./ChatResponse.js"; +export * from "./ChatStreamEventType.js"; +export * from "./ChatMessageStartEvent.js"; +export * from "./ChatContentStartEvent.js"; +export * from "./ChatContentDeltaEvent.js"; +export * from "./ChatContentEndEvent.js"; +export * from "./ChatToolPlanDeltaEvent.js"; +export * from "./ChatToolCallStartEvent.js"; +export * from "./ChatToolCallDeltaEvent.js"; +export * from "./ChatToolCallEndEvent.js"; +export * from "./CitationStartEvent.js"; +export * from "./CitationEndEvent.js"; +export * from "./ChatMessageEndEvent.js"; +export * from "./StreamedChatResponseV2.js"; +export * from "./SingleGeneration.js"; +export * from "./GenerateStreamEvent.js"; +export * from "./GenerateStreamText.js"; +export * from "./SingleGenerationInStream.js"; +export * from "./GenerateStreamEnd.js"; +export * from "./GenerateStreamError.js"; +export * from "./EmbedInputType.js"; +export * from "./EmbeddingType.js"; +export * from "./Image.js"; +export * from "./EmbedFloatsResponse.js"; +export * from "./EmbedByTypeResponse.js"; +export * from "./EmbedImageUrl.js"; +export * from "./EmbedImage.js"; +export * from "./EmbedText.js"; +export * from "./EmbedContent.js"; +export * from "./EmbedInput.js"; +export * from "./EmbedJob.js"; +export * from "./ListEmbedJobResponse.js"; +export * from "./CreateEmbedJobResponse.js"; +export * from "./RerankDocument.js"; +export * from "./ClassifyExample.js"; +export * from "./DatasetValidationStatus.js"; +export * from "./DatasetType.js"; +export * from "./DatasetPart.js"; +export * from "./ParseInfo.js"; +export * from "./RerankerDataMetrics.js"; +export * from "./ChatDataMetrics.js"; +export * from "./LabelMetric.js"; +export * from "./ClassifyDataMetrics.js"; +export * from "./FinetuneDatasetMetrics.js"; +export * from "./Metrics.js"; +export * from "./Dataset.js"; +export * from "./ConnectorOAuth.js"; +export * from "./Connector.js"; +export * from "./ListConnectorsResponse.js"; +export * from "./CreateConnectorOAuth.js"; +export * from "./AuthTokenType.js"; +export * from "./CreateConnectorServiceAuth.js"; +export * from "./CreateConnectorResponse.js"; +export * from "./GetConnectorResponse.js"; +export * from "./DeleteConnectorResponse.js"; +export * from "./UpdateConnectorResponse.js"; +export * from "./OAuthAuthorizeResponse.js"; +export * from "./CompatibleEndpoint.js"; +export * from "./GetModelResponse.js"; +export * from "./ListModelsResponse.js"; diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index ee293b34..59c0fe7a 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,2 +1,2 @@ -export { BasicAuth } from "./BasicAuth"; -export { BearerToken } from "./BearerToken"; +export { BasicAuth } from "./BasicAuth.js"; +export { BearerToken } from "./BearerToken.js"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index 3664d09e..dd4b9466 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -1,12 +1,23 @@ +import { RawResponse } from "./RawResponse.js"; + +/** + * The response of an API call. + * It is a successful response or a failed response. + */ export type APIResponse = SuccessfulResponse | FailedResponse; export interface SuccessfulResponse { ok: true; body: T; + /** + * @deprecated Use `rawResponse` instead + */ headers?: Record; + rawResponse: RawResponse; } export interface FailedResponse { ok: false; error: T; + rawResponse: RawResponse; } diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index b8f23717..4414ed79 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,10 +1,12 @@ -import { APIResponse } from "./APIResponse"; -import { createRequestUrl } from "./createRequestUrl"; -import { getFetchFn } from "./getFetchFn"; -import { getRequestBody } from "./getRequestBody"; -import { getResponseBody } from "./getResponseBody"; -import { makeRequest } from "./makeRequest"; -import { requestWithRetries } from "./requestWithRetries"; +import { toJson } from "../json.js"; +import { APIResponse } from "./APIResponse.js"; +import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +import { createRequestUrl } from "./createRequestUrl.js"; +import { getFetchFn } from "./getFetchFn.js"; +import { getRequestBody } from "./getRequestBody.js"; +import { getResponseBody } from "./getResponseBody.js"; +import { makeRequest } from "./makeRequest.js"; +import { requestWithRetries } from "./requestWithRetries.js"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -14,7 +16,7 @@ export declare namespace Fetcher { method: string; contentType?: string; headers?: Record; - queryParameters?: Record; + queryParameters?: Record; body?: unknown; timeoutMs?: number; maxRetries?: number; @@ -64,7 +66,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise= 200 && response.status < 400) { return { ok: true, body: responseBody as R, headers: response.headers, + rawResponse: toRawResponse(response), }; } else { return { @@ -102,6 +105,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise; + + constructor(init?: HeadersInit) { + this.headers = new Map(); + + if (init) { + if (init instanceof Headers) { + init.forEach((value, key) => this.append(key, value)); + } else if (Array.isArray(init)) { + for (const [key, value] of init) { + if (typeof key === "string" && typeof value === "string") { + this.append(key, value); + } else { + throw new TypeError("Each header entry must be a [string, string] tuple"); + } + } + } else { + for (const [key, value] of Object.entries(init)) { + if (typeof value === "string") { + this.append(key, value); + } else { + throw new TypeError("Header values must be strings"); + } + } + } + } + } + + append(name: string, value: string): void { + const key = name.toLowerCase(); + const existing = this.headers.get(key) || []; + this.headers.set(key, [...existing, value]); + } + + delete(name: string): void { + const key = name.toLowerCase(); + this.headers.delete(key); + } + + get(name: string): string | null { + const key = name.toLowerCase(); + const values = this.headers.get(key); + return values ? values.join(", ") : null; + } + + has(name: string): boolean { + const key = name.toLowerCase(); + return this.headers.has(key); + } + + set(name: string, value: string): void { + const key = name.toLowerCase(); + this.headers.set(key, [value]); + } + + forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: unknown): void { + const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn; + this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this)); + } + + getSetCookie(): string[] { + return this.headers.get("set-cookie") || []; + } + + *entries(): HeadersIterator<[string, string]> { + for (const [key, values] of this.headers.entries()) { + yield [key, values.join(", ")]; + } + } + + *keys(): HeadersIterator { + yield* this.headers.keys(); + } + + *values(): HeadersIterator { + for (const values of this.headers.values()) { + yield values.join(", "); + } + } + + [Symbol.iterator](): HeadersIterator<[string, string]> { + return this.entries(); + } + }; +} + +export { Headers }; diff --git a/src/core/fetcher/HttpResponsePromise.ts b/src/core/fetcher/HttpResponsePromise.ts new file mode 100644 index 00000000..026d88f1 --- /dev/null +++ b/src/core/fetcher/HttpResponsePromise.ts @@ -0,0 +1,116 @@ +import { WithRawResponse } from "./RawResponse.js"; + +/** + * A promise that returns the parsed response and lets you retrieve the raw response too. + */ +export class HttpResponsePromise extends Promise { + private innerPromise: Promise>; + private unwrappedPromise: Promise | undefined; + + private constructor(promise: Promise>) { + // Initialize with a no-op to avoid premature parsing + super((resolve) => { + resolve(undefined as unknown as T); + }); + this.innerPromise = promise; + } + + /** + * Creates an `HttpResponsePromise` from a function that returns a promise. + * + * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. + * @param args - Arguments to pass to the function. + * @returns An `HttpResponsePromise` instance. + */ + public static fromFunction Promise>, T>( + fn: F, + ...args: Parameters + ): HttpResponsePromise { + return new HttpResponsePromise(fn(...args)); + } + + /** + * Creates a function that returns an `HttpResponsePromise` from a function that returns a promise. + * + * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. + * @returns A function that returns an `HttpResponsePromise` instance. + */ + public static interceptFunction< + F extends (...args: never[]) => Promise>, + T = Awaited>["data"], + >(fn: F): (...args: Parameters) => HttpResponsePromise { + return (...args: Parameters): HttpResponsePromise => { + return HttpResponsePromise.fromPromise(fn(...args)); + }; + } + + /** + * Creates an `HttpResponsePromise` from an existing promise. + * + * @param promise - A promise resolving to a `WithRawResponse` object. + * @returns An `HttpResponsePromise` instance. + */ + public static fromPromise(promise: Promise>): HttpResponsePromise { + return new HttpResponsePromise(promise); + } + + /** + * Creates an `HttpResponsePromise` from an executor function. + * + * @param executor - A function that takes resolve and reject callbacks to create a promise. + * @returns An `HttpResponsePromise` instance. + */ + public static fromExecutor( + executor: (resolve: (value: WithRawResponse) => void, reject: (reason?: unknown) => void) => void, + ): HttpResponsePromise { + const promise = new Promise>(executor); + return new HttpResponsePromise(promise); + } + + /** + * Creates an `HttpResponsePromise` from a resolved result. + * + * @param result - A `WithRawResponse` object to resolve immediately. + * @returns An `HttpResponsePromise` instance. + */ + public static fromResult(result: WithRawResponse): HttpResponsePromise { + const promise = Promise.resolve(result); + return new HttpResponsePromise(promise); + } + + private unwrap(): Promise { + if (!this.unwrappedPromise) { + this.unwrappedPromise = this.innerPromise.then(({ data }) => data); + } + return this.unwrappedPromise; + } + + /** @inheritdoc */ + public override then( + onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null, + ): Promise { + return this.unwrap().then(onfulfilled, onrejected); + } + + /** @inheritdoc */ + public override catch( + onrejected?: ((reason: unknown) => TResult | PromiseLike) | null, + ): Promise { + return this.unwrap().catch(onrejected); + } + + /** @inheritdoc */ + public override finally(onfinally?: (() => void) | null): Promise { + return this.unwrap().finally(onfinally); + } + + /** + * Retrieves the data and raw response. + * + * @returns A promise resolving to a `WithRawResponse` object. + */ + public async withRawResponse(): Promise> { + return await this.innerPromise; + } +} diff --git a/src/core/fetcher/RawResponse.ts b/src/core/fetcher/RawResponse.ts new file mode 100644 index 00000000..37fb44e2 --- /dev/null +++ b/src/core/fetcher/RawResponse.ts @@ -0,0 +1,61 @@ +import { Headers } from "./Headers.js"; + +/** + * The raw response from the fetch call excluding the body. + */ +export type RawResponse = Omit< + { + [K in keyof Response as Response[K] extends Function ? never : K]: Response[K]; // strips out functions + }, + "ok" | "body" | "bodyUsed" +>; // strips out body and bodyUsed + +/** + * A raw response indicating that the request was aborted. + */ +export const abortRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 499, + statusText: "Client Closed Request", + type: "error", + url: "", +} as const; + +/** + * A raw response indicating an unknown error. + */ +export const unknownRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 0, + statusText: "Unknown Error", + type: "error", + url: "", +} as const; + +/** + * Converts a `RawResponse` object into a `RawResponse` by extracting its properties, + * excluding the `body` and `bodyUsed` fields. + * + * @param response - The `RawResponse` object to convert. + * @returns A `RawResponse` object containing the extracted properties of the input response. + */ +export function toRawResponse(response: Response): RawResponse { + return { + headers: response.headers, + redirected: response.redirected, + status: response.status, + statusText: response.statusText, + type: response.type, + url: response.url, + }; +} + +/** + * Creates a `RawResponse` from a standard `Response` object. + */ +export interface WithRawResponse { + readonly data: T; + readonly rawResponse: RawResponse; +} diff --git a/src/core/fetcher/createRequestUrl.ts b/src/core/fetcher/createRequestUrl.ts index 9288a99b..f1157ce7 100644 --- a/src/core/fetcher/createRequestUrl.ts +++ b/src/core/fetcher/createRequestUrl.ts @@ -2,7 +2,7 @@ import qs from "qs"; export function createRequestUrl( baseUrl: string, - queryParameters?: Record + queryParameters?: Record, ): string { return Object.keys(queryParameters ?? {}).length > 0 ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` diff --git a/src/core/fetcher/getFetchFn.ts b/src/core/fetcher/getFetchFn.ts index 9fd9bfc4..3b27d49a 100644 --- a/src/core/fetcher/getFetchFn.ts +++ b/src/core/fetcher/getFetchFn.ts @@ -1,4 +1,4 @@ -import { RUNTIME } from "../runtime"; +import { RUNTIME } from "../runtime/index.js"; /** * Returns a fetch function based on the runtime diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts index 1138414b..e38457c5 100644 --- a/src/core/fetcher/getRequestBody.ts +++ b/src/core/fetcher/getRequestBody.ts @@ -1,3 +1,5 @@ +import { toJson } from "../json.js"; + export declare namespace GetRequestBody { interface Args { body: unknown; @@ -7,7 +9,7 @@ export declare namespace GetRequestBody { export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { if (type.includes("json")) { - return JSON.stringify(body); + return toJson(body); } else { return body as BodyInit; } diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts index d046e6ea..cc123940 100644 --- a/src/core/fetcher/getResponseBody.ts +++ b/src/core/fetcher/getResponseBody.ts @@ -1,4 +1,4 @@ -import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper"; +import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper.js"; export async function getResponseBody(response: Response, responseType?: string): Promise { if (response.body != null && responseType === "blob") { diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 2d658ca4..d6ce43b0 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,5 +1,8 @@ -export type { APIResponse } from "./APIResponse"; -export { fetcher } from "./Fetcher"; -export type { Fetcher, FetchFunction } from "./Fetcher"; -export { getHeader } from "./getHeader"; -export { Supplier } from "./Supplier"; +export type { APIResponse } from "./APIResponse.js"; +export { fetcher } from "./Fetcher.js"; +export type { Fetcher, FetchFunction } from "./Fetcher.js"; +export { getHeader } from "./getHeader.js"; +export { Supplier } from "./Supplier.js"; +export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +export type { RawResponse, WithRawResponse } from "./RawResponse.js"; +export { HttpResponsePromise } from "./HttpResponsePromise.js"; diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 8fb4bace..1a5ffd3c 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -1,4 +1,4 @@ -import { anySignal, getTimeoutSignal } from "./signals"; +import { anySignal, getTimeoutSignal } from "./signals.js"; export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, @@ -9,7 +9,7 @@ export const makeRequest = async ( timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, - duplex?: "half" + duplex?: "half", ): Promise => { const signals: AbortSignal[] = []; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index 8d5af9d5..add3cce0 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -11,12 +11,12 @@ function addJitter(delay: number): number { export async function requestWithRetries( requestFn: () => Promise, - maxRetries: number = DEFAULT_MAX_RETRIES + maxRetries: number = DEFAULT_MAX_RETRIES, ): Promise { let response: Response = await requestFn(); for (let i = 0; i < maxRetries; ++i) { - if ([408, 409, 429].includes(response.status) || response.status >= 500) { + if ([408, 429].includes(response.status) || response.status >= 500) { // Calculate base delay using exponential backoff (in milliseconds) const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts index 6c124ff7..a8d32a2e 100644 --- a/src/core/fetcher/signals.ts +++ b/src/core/fetcher/signals.ts @@ -15,7 +15,7 @@ export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abor export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { // Allowing signals to be passed either as array // of signals or as multiple arguments. - const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as AbortSignal[]; const controller = new AbortController(); diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts index 4d7b7d52..289085fb 100644 --- a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -1,5 +1,6 @@ import type { Writable } from "readable-stream"; -import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper.js"; export class Node18UniversalStreamWrapper implements @@ -38,7 +39,7 @@ export class Node18UniversalStreamWrapper | Writable | WritableStream + dest: Node18UniversalStreamWrapper | Writable | WritableStream, ): Node18UniversalStreamWrapper | Writable | WritableStream { this.on("data", async (chunk) => { if (dest instanceof Node18UniversalStreamWrapper) { @@ -79,7 +80,7 @@ export class Node18UniversalStreamWrapper | Writable | WritableStream + dest: Node18UniversalStreamWrapper | Writable | WritableStream, ): Node18UniversalStreamWrapper | Writable | WritableStream { return this.pipe(dest); } diff --git a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts index ba5f7276..c7b3e4f4 100644 --- a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -1,5 +1,6 @@ import type { Readable, Writable } from "readable-stream"; -import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper.js"; export class NodePre18StreamWrapper implements StreamWrapper { private readableStream: Readable; diff --git a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts index 263af009..951b1d63 100644 --- a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -1,4 +1,4 @@ -import { StreamWrapper } from "./chooseStreamWrapper"; +import { StreamWrapper } from "./chooseStreamWrapper.js"; type EventCallback = (data?: any) => void; @@ -38,7 +38,7 @@ export class UndiciStreamWrapper | WritableStream + dest: UndiciStreamWrapper | WritableStream, ): UndiciStreamWrapper | WritableStream { this.on("data", (chunk) => { if (dest instanceof UndiciStreamWrapper) { @@ -73,7 +73,7 @@ export class UndiciStreamWrapper | WritableStream + dest: UndiciStreamWrapper | WritableStream, ): UndiciStreamWrapper | WritableStream { return this.pipe(dest); } diff --git a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts index 2abd6b2b..c20d18b5 100644 --- a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -1,5 +1,6 @@ import type { Readable } from "readable-stream"; -import { RUNTIME } from "../../runtime"; + +import { RUNTIME } from "../../runtime/index.js"; export type EventCallback = (data?: any) => void; @@ -23,7 +24,7 @@ export interface StreamWrapper { export async function chooseStreamWrapper(responseBody: any): Promise>> { if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { return new (await import("./Node18UniversalStreamWrapper")).Node18UniversalStreamWrapper( - responseBody as ReadableStream + responseBody as ReadableStream, ); } else if (RUNTIME.type !== "node" && typeof fetch === "function") { return new (await import("./UndiciStreamWrapper")).UndiciStreamWrapper(responseBody as ReadableStream); diff --git a/src/core/form-data-utils/encodeAsFormParameter.ts b/src/core/form-data-utils/encodeAsFormParameter.ts new file mode 100644 index 00000000..3b3f4c12 --- /dev/null +++ b/src/core/form-data-utils/encodeAsFormParameter.ts @@ -0,0 +1,15 @@ +import qs from "qs"; + +/** + * Takes an unknown value, stringifies it using qs, and parses it into a key-value record + */ +export function encodeAsFormParameter(value: unknown): Record { + const stringified = qs.stringify(value, { encode: false }); + + const keyValuePairs = stringified.split("&").map((pair) => { + const [key, value] = pair.split("="); + return [key, value] as const; + }); + + return Object.fromEntries(keyValuePairs); +} diff --git a/src/core/form-data-utils/index.ts b/src/core/form-data-utils/index.ts index f210ac40..1188f80c 100644 --- a/src/core/form-data-utils/index.ts +++ b/src/core/form-data-utils/index.ts @@ -1 +1,2 @@ -export * from "./FormDataWrapper"; +export { encodeAsFormParameter } from "./encodeAsFormParameter.js"; +export * from "./FormDataWrapper.js"; diff --git a/src/core/index.ts b/src/core/index.ts index ffbe8d17..9f65b603 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,6 +1,5 @@ -export * from "./fetcher"; -export * from "./auth"; -export * from "./streaming-fetcher"; -export * from "./runtime"; -export * from "./form-data-utils"; -export * as serialization from "./schemas"; +export * from "./fetcher/index.js"; +export * from "./runtime/index.js"; +export * from "./auth/index.js"; +export * from "./streaming-fetcher/index.js"; +export * from "./form-data-utils/index.js"; diff --git a/src/core/json.ts b/src/core/json.ts new file mode 100644 index 00000000..c052f324 --- /dev/null +++ b/src/core/json.ts @@ -0,0 +1,27 @@ +/** + * Serialize a value to JSON + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + * @returns JSON string + */ +export const toJson = ( + value: unknown, + replacer?: (this: unknown, key: string, value: unknown) => unknown, + space?: string | number, +): string => { + return JSON.stringify(value, replacer, space); +}; + +/** + * Parse JSON string to object, array, or other type + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is. + * @returns Parsed object, array, or other type + */ +export function fromJson( + text: string, + reviver?: (this: unknown, key: string, value: unknown) => unknown, +): T { + return JSON.parse(text, reviver); +} diff --git a/src/core/runtime/index.ts b/src/core/runtime/index.ts index 5c76dbb1..cfab23f9 100644 --- a/src/core/runtime/index.ts +++ b/src/core/runtime/index.ts @@ -1 +1 @@ -export { RUNTIME } from "./runtime"; +export { RUNTIME } from "./runtime.js"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 4d0687e8..a9750175 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -8,58 +8,9 @@ interface BunGlobal { version: string; } -declare const Deno: DenoGlobal; -declare const Bun: BunGlobal; - -/** - * A constant that indicates whether the environment the code is running is a Web Browser. - */ -const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is a Web Worker. - */ -const isWebWorker = - typeof self === "object" && - // @ts-ignore - typeof self?.importScripts === "function" && - (self.constructor?.name === "DedicatedWorkerGlobalScope" || - self.constructor?.name === "ServiceWorkerGlobalScope" || - self.constructor?.name === "SharedWorkerGlobalScope"); - -/** - * A constant that indicates whether the environment the code is running is Deno. - */ -const isDeno = - typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is Bun.sh. - */ -const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is Node.JS. - */ -const isNode = - typeof process !== "undefined" && - Boolean(process.version) && - Boolean(process.versions?.node) && - // Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions - !isDeno && - !isBun; - -/** - * A constant that indicates whether the environment the code is running is in React-Native. - * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js - */ -const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; - -/** - * A constant that indicates whether the environment the code is running is Cloudflare. - * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent - */ -const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; +declare const Deno: DenoGlobal | undefined; +declare const Bun: BunGlobal | undefined; +declare const EdgeRuntime: string | undefined; /** * A constant that indicates which environment and version the SDK is running in. @@ -67,12 +18,16 @@ const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator? export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { - type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; + type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime"; version?: string; parsedVersion?: number; } function evaluateRuntime(): Runtime { + /** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ + const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; if (isBrowser) { return { type: "browser", @@ -80,18 +35,50 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Cloudflare. + * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent + */ + const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; if (isCloudflare) { return { type: "workerd", }; } + /** + * A constant that indicates whether the environment the code is running is Edge Runtime. + * https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime + */ + const isEdgeRuntime = typeof EdgeRuntime === "string"; + if (isEdgeRuntime) { + return { + type: "edge-runtime", + }; + } + + /** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ + const isWebWorker = + typeof self === "object" && + // @ts-ignore + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); if (isWebWorker) { return { type: "web-worker", }; } + /** + * A constant that indicates whether the environment the code is running is Deno. + * FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + */ + const isDeno = + typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; if (isDeno) { return { type: "deno", @@ -99,6 +86,10 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ + const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; if (isBun) { return { type: "bun", @@ -106,6 +97,15 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Node.JS. + */ + const isNode = + typeof process !== "undefined" && + "version" in process && + !!process.version && + "versions" in process && + !!process.versions?.node; if (isNode) { return { type: "node", @@ -114,6 +114,11 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is in React-Native. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ + const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; if (isReactNative) { return { type: "react-native", diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts deleted file mode 100644 index 2a72eace..00000000 --- a/src/core/schemas/Schema.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { SchemaUtils } from "./builders"; - -export type Schema = BaseSchema & SchemaUtils; - -export type inferRaw = S extends Schema ? Raw : never; -export type inferParsed = S extends Schema ? Parsed : never; - -export interface BaseSchema { - parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid; - json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid; - getType: () => SchemaType | SchemaType; -} - -export const SchemaType = { - BIGINT: "bigint", - DATE: "date", - ENUM: "enum", - LIST: "list", - STRING_LITERAL: "stringLiteral", - BOOLEAN_LITERAL: "booleanLiteral", - OBJECT: "object", - ANY: "any", - BOOLEAN: "boolean", - NUMBER: "number", - STRING: "string", - UNKNOWN: "unknown", - RECORD: "record", - SET: "set", - UNION: "union", - UNDISCRIMINATED_UNION: "undiscriminatedUnion", - OPTIONAL: "optional", -} as const; -export type SchemaType = typeof SchemaType[keyof typeof SchemaType]; - -export type MaybeValid = Valid | Invalid; - -export interface Valid { - ok: true; - value: T; -} - -export interface Invalid { - ok: false; - errors: ValidationError[]; -} - -export interface ValidationError { - path: string[]; - message: string; -} - -export interface SchemaOptions { - /** - * how to handle unrecognized keys in objects - * - * @default "fail" - */ - unrecognizedObjectKeys?: "fail" | "passthrough" | "strip"; - - /** - * whether to fail when an unrecognized discriminant value is - * encountered in a union - * - * @default false - */ - allowUnrecognizedUnionMembers?: boolean; - - /** - * whether to fail when an unrecognized enum value is encountered - * - * @default false - */ - allowUnrecognizedEnumValues?: boolean; - - /** - * whether to allow data that doesn't conform to the schema. - * invalid data is passed through without transformation. - * - * when this is enabled, .parse() and .json() will always - * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()` - * will never fail. - * - * @default false - */ - skipValidation?: boolean; - - /** - * each validation failure contains a "path" property, which is - * the breadcrumbs to the offending node in the JSON. you can supply - * a prefix that is prepended to all the errors' paths. this can be - * helpful for zurg's internal debug logging. - */ - breadcrumbsPrefix?: string[]; - - /** - * whether to send 'null' for optional properties explicitly set to 'undefined'. - */ - omitUndefined?: boolean; -} diff --git a/src/core/schemas/builders/bigint/bigint.ts b/src/core/schemas/builders/bigint/bigint.ts deleted file mode 100644 index dc9c742e..00000000 --- a/src/core/schemas/builders/bigint/bigint.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { getSchemaUtils } from "../schema-utils"; - -export function bigint(): Schema { - const baseSchema: BaseSchema = { - parse: (raw, { breadcrumbsPrefix = [] } = {}) => { - if (typeof raw !== "string") { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(raw, "string"), - }, - ], - }; - } - return { - ok: true, - value: BigInt(raw), - }; - }, - json: (bigint, { breadcrumbsPrefix = [] } = {}) => { - if (typeof bigint === "bigint") { - return { - ok: true, - value: bigint.toString(), - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(bigint, "bigint"), - }, - ], - }; - } - }, - getType: () => SchemaType.BIGINT, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} diff --git a/src/core/schemas/builders/bigint/index.ts b/src/core/schemas/builders/bigint/index.ts deleted file mode 100644 index e5843043..00000000 --- a/src/core/schemas/builders/bigint/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { bigint } from "./bigint"; diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts deleted file mode 100644 index b70f24b0..00000000 --- a/src/core/schemas/builders/date/date.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { getSchemaUtils } from "../schema-utils"; - -// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime -const ISO_8601_REGEX = - /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; - -export function date(): Schema { - const baseSchema: BaseSchema = { - parse: (raw, { breadcrumbsPrefix = [] } = {}) => { - if (typeof raw !== "string") { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(raw, "string"), - }, - ], - }; - } - if (!ISO_8601_REGEX.test(raw)) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"), - }, - ], - }; - } - return { - ok: true, - value: new Date(raw), - }; - }, - json: (date, { breadcrumbsPrefix = [] } = {}) => { - if (date instanceof Date) { - return { - ok: true, - value: date.toISOString(), - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(date, "Date object"), - }, - ], - }; - } - }, - getType: () => SchemaType.DATE, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} diff --git a/src/core/schemas/builders/date/index.ts b/src/core/schemas/builders/date/index.ts deleted file mode 100644 index 187b2904..00000000 --- a/src/core/schemas/builders/date/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { date } from "./date"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts deleted file mode 100644 index c1e24d69..00000000 --- a/src/core/schemas/builders/enum/enum.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Schema, SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export function enum_(values: E): Schema { - const validValues = new Set(values); - - const schemaCreator = createIdentitySchemaCreator( - SchemaType.ENUM, - (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => { - if (typeof value !== "string") { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "string"), - }, - ], - }; - } - - if (!validValues.has(value) && !allowUnrecognizedEnumValues) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "enum"), - }, - ], - }; - } - - return { - ok: true, - value: value as U, - }; - } - ); - - return schemaCreator(); -} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts deleted file mode 100644 index fe6faed9..00000000 --- a/src/core/schemas/builders/enum/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { enum_ } from "./enum"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts deleted file mode 100644 index 65211f92..00000000 --- a/src/core/schemas/builders/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export * from "./bigint"; -export * from "./date"; -export * from "./enum"; -export * from "./lazy"; -export * from "./list"; -export * from "./literals"; -export * from "./object"; -export * from "./object-like"; -export * from "./primitives"; -export * from "./record"; -export * from "./schema-utils"; -export * from "./set"; -export * from "./undiscriminated-union"; -export * from "./union"; diff --git a/src/core/schemas/builders/lazy/index.ts b/src/core/schemas/builders/lazy/index.ts deleted file mode 100644 index 77420fb0..00000000 --- a/src/core/schemas/builders/lazy/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { lazy } from "./lazy"; -export type { SchemaGetter } from "./lazy"; -export { lazyObject } from "./lazyObject"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts deleted file mode 100644 index 835c61f8..00000000 --- a/src/core/schemas/builders/lazy/lazy.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { BaseSchema, Schema } from "../../Schema"; -import { getSchemaUtils } from "../schema-utils"; - -export type SchemaGetter> = () => SchemaType; - -export function lazy(getter: SchemaGetter>): Schema { - const baseSchema = constructLazyBaseSchema(getter); - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - }; -} - -export function constructLazyBaseSchema( - getter: SchemaGetter> -): BaseSchema { - return { - parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts), - json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts), - getType: () => getMemoizedSchema(getter).getType(), - }; -} - -type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; - -export function getMemoizedSchema>(getter: SchemaGetter): SchemaType { - const castedGetter = getter as MemoizedGetter; - if (castedGetter.__zurg_memoized == null) { - castedGetter.__zurg_memoized = getter(); - } - return castedGetter.__zurg_memoized; -} diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts deleted file mode 100644 index 38c9e284..00000000 --- a/src/core/schemas/builders/lazy/lazyObject.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { getObjectUtils } from "../object"; -import { getObjectLikeUtils } from "../object-like"; -import { BaseObjectSchema, ObjectSchema } from "../object/types"; -import { getSchemaUtils } from "../schema-utils"; -import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy"; - -export function lazyObject(getter: SchemaGetter>): ObjectSchema { - const baseSchema: BaseObjectSchema = { - ...constructLazyBaseSchema(getter), - _getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(), - _getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties(), - }; - - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - ...getObjectLikeUtils(baseSchema), - ...getObjectUtils(baseSchema), - }; -} diff --git a/src/core/schemas/builders/list/index.ts b/src/core/schemas/builders/list/index.ts deleted file mode 100644 index 25f4bcc1..00000000 --- a/src/core/schemas/builders/list/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { list } from "./list"; diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts deleted file mode 100644 index e4c5c4a4..00000000 --- a/src/core/schemas/builders/list/list.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { getSchemaUtils } from "../schema-utils"; - -export function list(schema: Schema): Schema { - const baseSchema: BaseSchema = { - parse: (raw, opts) => - validateAndTransformArray(raw, (item, index) => - schema.parse(item, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], - }) - ), - json: (parsed, opts) => - validateAndTransformArray(parsed, (item, index) => - schema.json(item, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], - }) - ), - getType: () => SchemaType.LIST, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} - -function validateAndTransformArray( - value: unknown, - transformItem: (item: Raw, index: number) => MaybeValid -): MaybeValid { - if (!Array.isArray(value)) { - return { - ok: false, - errors: [ - { - message: getErrorMessageForIncorrectType(value, "list"), - path: [], - }, - ], - }; - } - - const maybeValidItems = value.map((item, index) => transformItem(item, index)); - - return maybeValidItems.reduce>( - (acc, item) => { - if (acc.ok && item.ok) { - return { - ok: true, - value: [...acc.value, item.value], - }; - } - - const errors: ValidationError[] = []; - if (!acc.ok) { - errors.push(...acc.errors); - } - if (!item.ok) { - errors.push(...item.errors); - } - - return { - ok: false, - errors, - }; - }, - { ok: true, value: [] } - ); -} diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts deleted file mode 100644 index a83d22cd..00000000 --- a/src/core/schemas/builders/literals/booleanLiteral.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Schema, SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export function booleanLiteral(literal: V): Schema { - const schemaCreator = createIdentitySchemaCreator( - SchemaType.BOOLEAN_LITERAL, - (value, { breadcrumbsPrefix = [] } = {}) => { - if (value === literal) { - return { - ok: true, - value: literal, - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), - }, - ], - }; - } - } - ); - - return schemaCreator(); -} diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts deleted file mode 100644 index d2bf08fc..00000000 --- a/src/core/schemas/builders/literals/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { stringLiteral } from "./stringLiteral"; -export { booleanLiteral } from "./booleanLiteral"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts deleted file mode 100644 index 3939b76b..00000000 --- a/src/core/schemas/builders/literals/stringLiteral.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Schema, SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export function stringLiteral(literal: V): Schema { - const schemaCreator = createIdentitySchemaCreator( - SchemaType.STRING_LITERAL, - (value, { breadcrumbsPrefix = [] } = {}) => { - if (value === literal) { - return { - ok: true, - value: literal, - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, `"${literal}"`), - }, - ], - }; - } - } - ); - - return schemaCreator(); -} diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts deleted file mode 100644 index 8331d08d..00000000 --- a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { BaseSchema } from "../../Schema"; -import { filterObject } from "../../utils/filterObject"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { isPlainObject } from "../../utils/isPlainObject"; -import { getSchemaUtils } from "../schema-utils"; -import { ObjectLikeSchema, ObjectLikeUtils } from "./types"; - -export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { - return { - withParsedProperties: (properties) => withParsedProperties(schema, properties), - }; -} - -/** - * object-like utils are defined in one file to resolve issues with circular imports - */ - -export function withParsedProperties( - objectLike: BaseSchema, - properties: { [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]) } -): ObjectLikeSchema { - const objectSchema: BaseSchema = { - parse: (raw, opts) => { - const parsedObject = objectLike.parse(raw, opts); - if (!parsedObject.ok) { - return parsedObject; - } - - const additionalProperties = Object.entries(properties).reduce>( - (processed, [key, value]) => { - return { - ...processed, - [key]: typeof value === "function" ? value(parsedObject.value) : value, - }; - }, - {} - ); - - return { - ok: true, - value: { - ...parsedObject.value, - ...(additionalProperties as Properties), - }, - }; - }, - - json: (parsed, opts) => { - if (!isPlainObject(parsed)) { - return { - ok: false, - errors: [ - { - path: opts?.breadcrumbsPrefix ?? [], - message: getErrorMessageForIncorrectType(parsed, "object"), - }, - ], - }; - } - - // strip out added properties - const addedPropertyKeys = new Set(Object.keys(properties)); - const parsedWithoutAddedProperties = filterObject( - parsed, - Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)) - ); - - return objectLike.json(parsedWithoutAddedProperties as ParsedObjectShape, opts); - }, - - getType: () => objectLike.getType(), - }; - - return { - ...objectSchema, - ...getSchemaUtils(objectSchema), - ...getObjectLikeUtils(objectSchema), - }; -} diff --git a/src/core/schemas/builders/object-like/index.ts b/src/core/schemas/builders/object-like/index.ts deleted file mode 100644 index c342e72c..00000000 --- a/src/core/schemas/builders/object-like/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; -export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; diff --git a/src/core/schemas/builders/object-like/types.ts b/src/core/schemas/builders/object-like/types.ts deleted file mode 100644 index 75b36987..00000000 --- a/src/core/schemas/builders/object-like/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseSchema, Schema } from "../../Schema"; - -export type ObjectLikeSchema = Schema & - BaseSchema & - ObjectLikeUtils; - -export interface ObjectLikeUtils { - withParsedProperties: >(properties: { - [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); - }) => ObjectLikeSchema; -} diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts deleted file mode 100644 index e3f4388d..00000000 --- a/src/core/schemas/builders/object/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -export { getObjectUtils, object } from "./object"; -export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; -export type { - inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, - inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, -} from "./objectWithoutOptionalProperties"; -export { isProperty, property } from "./property"; -export type { Property } from "./property"; -export type { - BaseObjectSchema, - inferObjectSchemaFromPropertySchemas, - inferParsedObject, - inferParsedObjectFromPropertySchemas, - inferParsedPropertySchema, - inferRawKey, - inferRawObject, - inferRawObjectFromPropertySchemas, - inferRawPropertySchema, - ObjectSchema, - ObjectUtils, - PropertySchemas, -} from "./types"; diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts deleted file mode 100644 index 8d40c33c..00000000 --- a/src/core/schemas/builders/object/object.ts +++ /dev/null @@ -1,365 +0,0 @@ -import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; -import { entries } from "../../utils/entries"; -import { filterObject } from "../../utils/filterObject"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { isPlainObject } from "../../utils/isPlainObject"; -import { keys } from "../../utils/keys"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { partition } from "../../utils/partition"; -import { getObjectLikeUtils } from "../object-like"; -import { getSchemaUtils } from "../schema-utils"; -import { isProperty } from "./property"; -import { - BaseObjectSchema, - inferObjectSchemaFromPropertySchemas, - inferParsedObjectFromPropertySchemas, - inferRawObjectFromPropertySchemas, - ObjectSchema, - ObjectUtils, - PropertySchemas, -} from "./types"; - -interface ObjectPropertyWithRawKey { - rawKey: string; - parsedKey: string; - valueSchema: Schema; -} - -export function object>( - schemas: T -): inferObjectSchemaFromPropertySchemas { - const baseSchema: BaseObjectSchema< - inferRawObjectFromPropertySchemas, - inferParsedObjectFromPropertySchemas - > = { - _getRawProperties: () => - Object.entries(schemas).map(([parsedKey, propertySchema]) => - isProperty(propertySchema) ? propertySchema.rawKey : parsedKey - ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], - _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], - - parse: (raw, opts) => { - const rawKeyToProperty: Record = {}; - const requiredKeys: string[] = []; - - for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { - const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey; - const valueSchema: Schema = isProperty(schemaOrObjectProperty) - ? schemaOrObjectProperty.valueSchema - : schemaOrObjectProperty; - - const property: ObjectPropertyWithRawKey = { - rawKey, - parsedKey: parsedKey as string, - valueSchema, - }; - - rawKeyToProperty[rawKey] = property; - - if (isSchemaRequired(valueSchema)) { - requiredKeys.push(rawKey); - } - } - - return validateAndTransformObject({ - value: raw, - requiredKeys, - getProperty: (rawKey) => { - const property = rawKeyToProperty[rawKey]; - if (property == null) { - return undefined; - } - return { - transformedKey: property.parsedKey, - transform: (propertyValue) => - property.valueSchema.parse(propertyValue, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawKey], - }), - }; - }, - unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, - skipValidation: opts?.skipValidation, - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - omitUndefined: opts?.omitUndefined, - }); - }, - - json: (parsed, opts) => { - const requiredKeys: string[] = []; - - for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { - const valueSchema: Schema = isProperty(schemaOrObjectProperty) - ? schemaOrObjectProperty.valueSchema - : schemaOrObjectProperty; - - if (isSchemaRequired(valueSchema)) { - requiredKeys.push(parsedKey as string); - } - } - - return validateAndTransformObject({ - value: parsed, - requiredKeys, - getProperty: ( - parsedKey - ): { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined => { - const property = schemas[parsedKey as keyof T]; - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (property == null) { - return undefined; - } - - if (isProperty(property)) { - return { - transformedKey: property.rawKey, - transform: (propertyValue) => - property.valueSchema.json(propertyValue, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], - }), - }; - } else { - return { - transformedKey: parsedKey, - transform: (propertyValue) => - property.json(propertyValue, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], - }), - }; - } - }, - unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, - skipValidation: opts?.skipValidation, - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - omitUndefined: opts?.omitUndefined, - }); - }, - - getType: () => SchemaType.OBJECT, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - ...getObjectLikeUtils(baseSchema), - ...getObjectUtils(baseSchema), - }; -} - -function validateAndTransformObject({ - value, - requiredKeys, - getProperty, - unrecognizedObjectKeys = "fail", - skipValidation = false, - breadcrumbsPrefix = [], -}: { - value: unknown; - requiredKeys: string[]; - getProperty: ( - preTransformedKey: string - ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined; - unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; - skipValidation: boolean | undefined; - breadcrumbsPrefix: string[] | undefined; - omitUndefined: boolean | undefined; -}): MaybeValid { - if (!isPlainObject(value)) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "object"), - }, - ], - }; - } - - const missingRequiredKeys = new Set(requiredKeys); - const errors: ValidationError[] = []; - const transformed: Record = {}; - - for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) { - const property = getProperty(preTransformedKey); - - if (property != null) { - missingRequiredKeys.delete(preTransformedKey); - - const value = property.transform(preTransformedItemValue); - if (value.ok) { - transformed[property.transformedKey] = value.value; - } else { - transformed[preTransformedKey] = preTransformedItemValue; - errors.push(...value.errors); - } - } else { - switch (unrecognizedObjectKeys) { - case "fail": - errors.push({ - path: [...breadcrumbsPrefix, preTransformedKey], - message: `Unexpected key "${preTransformedKey}"`, - }); - break; - case "strip": - break; - case "passthrough": - transformed[preTransformedKey] = preTransformedItemValue; - break; - } - } - } - - errors.push( - ...requiredKeys - .filter((key) => missingRequiredKeys.has(key)) - .map((key) => ({ - path: breadcrumbsPrefix, - message: `Missing required key "${key}"`, - })) - ); - - if (errors.length === 0 || skipValidation) { - return { - ok: true, - value: transformed as Transformed, - }; - } else { - return { - ok: false, - errors, - }; - } -} - -export function getObjectUtils(schema: BaseObjectSchema): ObjectUtils { - return { - extend: (extension: ObjectSchema) => { - const baseSchema: BaseObjectSchema = { - _getParsedProperties: () => [...schema._getParsedProperties(), ...extension._getParsedProperties()], - _getRawProperties: () => [...schema._getRawProperties(), ...extension._getRawProperties()], - parse: (raw, opts) => { - return validateAndTransformExtendedObject({ - extensionKeys: extension._getRawProperties(), - value: raw, - transformBase: (rawBase) => schema.parse(rawBase, opts), - transformExtension: (rawExtension) => extension.parse(rawExtension, opts), - }); - }, - json: (parsed, opts) => { - return validateAndTransformExtendedObject({ - extensionKeys: extension._getParsedProperties(), - value: parsed, - transformBase: (parsedBase) => schema.json(parsedBase, opts), - transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), - }); - }, - getType: () => SchemaType.OBJECT, - }; - - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - ...getObjectLikeUtils(baseSchema), - ...getObjectUtils(baseSchema), - }; - }, - passthrough: () => { - const baseSchema: BaseObjectSchema = - { - _getParsedProperties: () => schema._getParsedProperties(), - _getRawProperties: () => schema._getRawProperties(), - parse: (raw, opts) => { - const transformed = schema.parse(raw, { ...opts, unrecognizedObjectKeys: "passthrough" }); - if (!transformed.ok) { - return transformed; - } - return { - ok: true, - value: { - ...(raw as any), - ...transformed.value, - }, - }; - }, - json: (parsed, opts) => { - const transformed = schema.json(parsed, { ...opts, unrecognizedObjectKeys: "passthrough" }); - if (!transformed.ok) { - return transformed; - } - return { - ok: true, - value: { - ...(parsed as any), - ...transformed.value, - }, - }; - }, - getType: () => SchemaType.OBJECT, - }; - - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - ...getObjectLikeUtils(baseSchema), - ...getObjectUtils(baseSchema), - }; - }, - }; -} - -function validateAndTransformExtendedObject({ - extensionKeys, - value, - transformBase, - transformExtension, -}: { - extensionKeys: (keyof PreTransformedExtension)[]; - value: unknown; - transformBase: (value: unknown) => MaybeValid; - transformExtension: (value: unknown) => MaybeValid; -}): MaybeValid { - const extensionPropertiesSet = new Set(extensionKeys); - const [extensionProperties, baseProperties] = partition(keys(value), (key) => - extensionPropertiesSet.has(key as keyof PreTransformedExtension) - ); - - const transformedBase = transformBase(filterObject(value, baseProperties)); - const transformedExtension = transformExtension(filterObject(value, extensionProperties)); - - if (transformedBase.ok && transformedExtension.ok) { - return { - ok: true, - value: { - ...transformedBase.value, - ...transformedExtension.value, - }, - }; - } else { - return { - ok: false, - errors: [ - ...(transformedBase.ok ? [] : transformedBase.errors), - ...(transformedExtension.ok ? [] : transformedExtension.errors), - ], - }; - } -} - -function isSchemaRequired(schema: Schema): boolean { - return !isSchemaOptional(schema); -} - -function isSchemaOptional(schema: Schema): boolean { - switch (schema.getType()) { - case SchemaType.ANY: - case SchemaType.UNKNOWN: - case SchemaType.OPTIONAL: - return true; - default: - return false; - } -} diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts deleted file mode 100644 index a0951f48..00000000 --- a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { object } from "./object"; -import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types"; - -export function objectWithoutOptionalProperties>( - schemas: T -): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { - return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; -} - -export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = - ObjectSchema< - inferRawObjectFromPropertySchemas, - inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas - >; - -export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { - [K in keyof T]: inferParsedPropertySchema; -}; diff --git a/src/core/schemas/builders/object/property.ts b/src/core/schemas/builders/object/property.ts deleted file mode 100644 index d245c4b1..00000000 --- a/src/core/schemas/builders/object/property.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Schema } from "../../Schema"; - -export function property( - rawKey: RawKey, - valueSchema: Schema -): Property { - return { - rawKey, - valueSchema, - isProperty: true, - }; -} - -export interface Property { - rawKey: RawKey; - valueSchema: Schema; - isProperty: true; -} - -export function isProperty>(maybeProperty: unknown): maybeProperty is O { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - return (maybeProperty as O).isProperty; -} diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts deleted file mode 100644 index 9f87cbb7..00000000 --- a/src/core/schemas/builders/object/types.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema"; -import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties"; -import { ObjectLikeUtils } from "../object-like"; -import { SchemaUtils } from "../schema-utils"; -import { Property } from "./property"; - -export type ObjectSchema = BaseObjectSchema & - ObjectLikeUtils & - ObjectUtils & - SchemaUtils; - -export interface BaseObjectSchema extends BaseSchema { - _getRawProperties: () => (keyof Raw)[]; - _getParsedProperties: () => (keyof Parsed)[]; -} - -export interface ObjectUtils { - extend: ( - schemas: ObjectSchema - ) => ObjectSchema; - passthrough: () => ObjectSchema; -} - -export type inferRawObject> = O extends ObjectSchema ? Raw : never; - -export type inferParsedObject> = O extends ObjectSchema - ? Parsed - : never; - -export type inferObjectSchemaFromPropertySchemas> = ObjectSchema< - inferRawObjectFromPropertySchemas, - inferParsedObjectFromPropertySchemas ->; - -export type inferRawObjectFromPropertySchemas> = - addQuestionMarksToNullableProperties<{ - [ParsedKey in keyof T as inferRawKey]: inferRawPropertySchema; - }>; - -export type inferParsedObjectFromPropertySchemas> = - addQuestionMarksToNullableProperties<{ - [K in keyof T]: inferParsedPropertySchema; - }>; - -export type PropertySchemas = Record< - ParsedKeys, - Property | Schema ->; - -export type inferRawPropertySchema

| Schema> = P extends Property< - any, - infer Raw, - any -> - ? Raw - : P extends Schema - ? inferRaw

- : never; - -export type inferParsedPropertySchema

| Schema> = P extends Property< - any, - any, - infer Parsed -> - ? Parsed - : P extends Schema - ? inferParsed

- : never; - -export type inferRawKey< - ParsedKey extends string | number | symbol, - P extends Property | Schema -> = P extends Property ? Raw : ParsedKey; diff --git a/src/core/schemas/builders/primitives/any.ts b/src/core/schemas/builders/primitives/any.ts deleted file mode 100644 index fcaeb042..00000000 --- a/src/core/schemas/builders/primitives/any.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; - -export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/primitives/boolean.ts b/src/core/schemas/builders/primitives/boolean.ts deleted file mode 100644 index fad60562..00000000 --- a/src/core/schemas/builders/primitives/boolean.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export const boolean = createIdentitySchemaCreator( - SchemaType.BOOLEAN, - (value, { breadcrumbsPrefix = [] } = {}) => { - if (typeof value === "boolean") { - return { - ok: true, - value, - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "boolean"), - }, - ], - }; - } - } -); diff --git a/src/core/schemas/builders/primitives/index.ts b/src/core/schemas/builders/primitives/index.ts deleted file mode 100644 index 788f9416..00000000 --- a/src/core/schemas/builders/primitives/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { any } from "./any"; -export { boolean } from "./boolean"; -export { number } from "./number"; -export { string } from "./string"; -export { unknown } from "./unknown"; diff --git a/src/core/schemas/builders/primitives/number.ts b/src/core/schemas/builders/primitives/number.ts deleted file mode 100644 index c2689456..00000000 --- a/src/core/schemas/builders/primitives/number.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export const number = createIdentitySchemaCreator( - SchemaType.NUMBER, - (value, { breadcrumbsPrefix = [] } = {}) => { - if (typeof value === "number") { - return { - ok: true, - value, - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "number"), - }, - ], - }; - } - } -); diff --git a/src/core/schemas/builders/primitives/string.ts b/src/core/schemas/builders/primitives/string.ts deleted file mode 100644 index 949f1f2a..00000000 --- a/src/core/schemas/builders/primitives/string.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; - -export const string = createIdentitySchemaCreator( - SchemaType.STRING, - (value, { breadcrumbsPrefix = [] } = {}) => { - if (typeof value === "string") { - return { - ok: true, - value, - }; - } else { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "string"), - }, - ], - }; - } - } -); diff --git a/src/core/schemas/builders/primitives/unknown.ts b/src/core/schemas/builders/primitives/unknown.ts deleted file mode 100644 index 4d524957..00000000 --- a/src/core/schemas/builders/primitives/unknown.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { SchemaType } from "../../Schema"; -import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; - -export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/record/index.ts b/src/core/schemas/builders/record/index.ts deleted file mode 100644 index 82e25c5c..00000000 --- a/src/core/schemas/builders/record/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { record } from "./record"; -export type { BaseRecordSchema, RecordSchema } from "./types"; diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts deleted file mode 100644 index 6683ac36..00000000 --- a/src/core/schemas/builders/record/record.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; -import { entries } from "../../utils/entries"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { isPlainObject } from "../../utils/isPlainObject"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { getSchemaUtils } from "../schema-utils"; -import { BaseRecordSchema, RecordSchema } from "./types"; - -export function record( - keySchema: Schema, - valueSchema: Schema -): RecordSchema { - const baseSchema: BaseRecordSchema = { - parse: (raw, opts) => { - return validateAndTransformRecord({ - value: raw, - isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, - transformKey: (key) => - keySchema.parse(key, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], - }), - transformValue: (value, key) => - valueSchema.parse(value, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], - }), - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - }); - }, - json: (parsed, opts) => { - return validateAndTransformRecord({ - value: parsed, - isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, - transformKey: (key) => - keySchema.json(key, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], - }), - transformValue: (value, key) => - valueSchema.json(value, { - ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], - }), - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - }); - }, - getType: () => SchemaType.RECORD, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} - -function validateAndTransformRecord({ - value, - isKeyNumeric, - transformKey, - transformValue, - breadcrumbsPrefix = [], -}: { - value: unknown; - isKeyNumeric: boolean; - transformKey: (key: string | number) => MaybeValid; - transformValue: (value: unknown, key: string | number) => MaybeValid; - breadcrumbsPrefix: string[] | undefined; -}): MaybeValid> { - if (!isPlainObject(value)) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "object"), - }, - ], - }; - } - - return entries(value).reduce>>( - (accPromise, [stringKey, value]) => { - // skip nullish keys - if (value == null) { - return accPromise; - } - - const acc = accPromise; - - let key: string | number = stringKey; - if (isKeyNumeric) { - const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; - if (!isNaN(numberKey)) { - key = numberKey; - } - } - const transformedKey = transformKey(key); - - const transformedValue = transformValue(value, key); - - if (acc.ok && transformedKey.ok && transformedValue.ok) { - return { - ok: true, - value: { - ...acc.value, - [transformedKey.value]: transformedValue.value, - }, - }; - } - - const errors: ValidationError[] = []; - if (!acc.ok) { - errors.push(...acc.errors); - } - if (!transformedKey.ok) { - errors.push(...transformedKey.errors); - } - if (!transformedValue.ok) { - errors.push(...transformedValue.errors); - } - - return { - ok: false, - errors, - }; - }, - { ok: true, value: {} as Record } - ); -} diff --git a/src/core/schemas/builders/record/types.ts b/src/core/schemas/builders/record/types.ts deleted file mode 100644 index eb82cc7f..00000000 --- a/src/core/schemas/builders/record/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { BaseSchema } from "../../Schema"; -import { SchemaUtils } from "../schema-utils"; - -export type RecordSchema< - RawKey extends string | number, - RawValue, - ParsedKey extends string | number, - ParsedValue -> = BaseRecordSchema & - SchemaUtils, Record>; - -export type BaseRecordSchema< - RawKey extends string | number, - RawValue, - ParsedKey extends string | number, - ParsedValue -> = BaseSchema, Record>; diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts deleted file mode 100644 index 2b89ca0e..00000000 --- a/src/core/schemas/builders/schema-utils/JsonError.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ValidationError } from "../../Schema"; -import { stringifyValidationError } from "./stringifyValidationErrors"; - -export class JsonError extends Error { - constructor(public readonly errors: ValidationError[]) { - super(errors.map(stringifyValidationError).join("; ")); - Object.setPrototypeOf(this, JsonError.prototype); - } -} diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts deleted file mode 100644 index d056eb45..00000000 --- a/src/core/schemas/builders/schema-utils/ParseError.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ValidationError } from "../../Schema"; -import { stringifyValidationError } from "./stringifyValidationErrors"; - -export class ParseError extends Error { - constructor(public readonly errors: ValidationError[]) { - super(errors.map(stringifyValidationError).join("; ")); - Object.setPrototypeOf(this, ParseError.prototype); - } -} diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts deleted file mode 100644 index 79ecad92..00000000 --- a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema"; -import { JsonError } from "./JsonError"; -import { ParseError } from "./ParseError"; - -export interface SchemaUtils { - optional: () => Schema; - transform: (transformer: SchemaTransformer) => Schema; - parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed; - jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw; -} - -export interface SchemaTransformer { - transform: (parsed: Parsed) => Transformed; - untransform: (transformed: any) => Parsed; -} - -export function getSchemaUtils(schema: BaseSchema): SchemaUtils { - return { - optional: () => optional(schema), - transform: (transformer) => transform(schema, transformer), - parseOrThrow: (raw, opts) => { - const parsed = schema.parse(raw, opts); - if (parsed.ok) { - return parsed.value; - } - throw new ParseError(parsed.errors); - }, - jsonOrThrow: (parsed, opts) => { - const raw = schema.json(parsed, opts); - if (raw.ok) { - return raw.value; - } - throw new JsonError(raw.errors); - }, - }; -} - -/** - * schema utils are defined in one file to resolve issues with circular imports - */ - -export function optional( - schema: BaseSchema -): Schema { - const baseSchema: BaseSchema = { - parse: (raw, opts) => { - if (raw == null) { - return { - ok: true, - value: undefined, - }; - } - return schema.parse(raw, opts); - }, - json: (parsed, opts) => { - if (opts?.omitUndefined && parsed === undefined) { - return { - ok: true, - value: undefined, - }; - } - if (parsed == null) { - return { - ok: true, - value: null, - }; - } - return schema.json(parsed, opts); - }, - getType: () => SchemaType.OPTIONAL, - }; - - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - }; -} - -export function transform( - schema: BaseSchema, - transformer: SchemaTransformer -): Schema { - const baseSchema: BaseSchema = { - parse: (raw, opts) => { - const parsed = schema.parse(raw, opts); - if (!parsed.ok) { - return parsed; - } - return { - ok: true, - value: transformer.transform(parsed.value), - }; - }, - json: (transformed, opts) => { - const parsed = transformer.untransform(transformed); - return schema.json(parsed, opts); - }, - getType: () => schema.getType(), - }; - - return { - ...baseSchema, - ...getSchemaUtils(baseSchema), - }; -} diff --git a/src/core/schemas/builders/schema-utils/index.ts b/src/core/schemas/builders/schema-utils/index.ts deleted file mode 100644 index aa04e051..00000000 --- a/src/core/schemas/builders/schema-utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; -export type { SchemaUtils } from "./getSchemaUtils"; -export { JsonError } from "./JsonError"; -export { ParseError } from "./ParseError"; diff --git a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts deleted file mode 100644 index 4160f0a2..00000000 --- a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ValidationError } from "../../Schema"; - -export function stringifyValidationError(error: ValidationError): string { - if (error.path.length === 0) { - return error.message; - } - return `${error.path.join(" -> ")}: ${error.message}`; -} diff --git a/src/core/schemas/builders/set/index.ts b/src/core/schemas/builders/set/index.ts deleted file mode 100644 index f3310e8b..00000000 --- a/src/core/schemas/builders/set/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { set } from "./set"; diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts deleted file mode 100644 index e9e6bb7e..00000000 --- a/src/core/schemas/builders/set/set.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { list } from "../list"; -import { getSchemaUtils } from "../schema-utils"; - -export function set(schema: Schema): Schema> { - const listSchema = list(schema); - const baseSchema: BaseSchema> = { - parse: (raw, opts) => { - const parsedList = listSchema.parse(raw, opts); - if (parsedList.ok) { - return { - ok: true, - value: new Set(parsedList.value), - }; - } else { - return parsedList; - } - }, - json: (parsed, opts) => { - if (!(parsed instanceof Set)) { - return { - ok: false, - errors: [ - { - path: opts?.breadcrumbsPrefix ?? [], - message: getErrorMessageForIncorrectType(parsed, "Set"), - }, - ], - }; - } - const jsonList = listSchema.json([...parsed], opts); - return jsonList; - }, - getType: () => SchemaType.SET, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} diff --git a/src/core/schemas/builders/undiscriminated-union/index.ts b/src/core/schemas/builders/undiscriminated-union/index.ts deleted file mode 100644 index 75b71cb3..00000000 --- a/src/core/schemas/builders/undiscriminated-union/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type { - inferParsedUnidiscriminatedUnionSchema, - inferRawUnidiscriminatedUnionSchema, - UndiscriminatedUnionSchema, -} from "./types"; -export { undiscriminatedUnion } from "./undiscriminatedUnion"; diff --git a/src/core/schemas/builders/undiscriminated-union/types.ts b/src/core/schemas/builders/undiscriminated-union/types.ts deleted file mode 100644 index 43e7108a..00000000 --- a/src/core/schemas/builders/undiscriminated-union/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { inferParsed, inferRaw, Schema } from "../../Schema"; - -export type UndiscriminatedUnionSchema = Schema< - inferRawUnidiscriminatedUnionSchema, - inferParsedUnidiscriminatedUnionSchema ->; - -export type inferRawUnidiscriminatedUnionSchema = inferRaw; - -export type inferParsedUnidiscriminatedUnionSchema = inferParsed; diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts deleted file mode 100644 index 21ed3df0..00000000 --- a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { getSchemaUtils } from "../schema-utils"; -import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; - -export function undiscriminatedUnion, ...Schema[]]>( - schemas: Schemas -): Schema, inferParsedUnidiscriminatedUnionSchema> { - const baseSchema: BaseSchema< - inferRawUnidiscriminatedUnionSchema, - inferParsedUnidiscriminatedUnionSchema - > = { - parse: (raw, opts) => { - return validateAndTransformUndiscriminatedUnion>( - (schema, opts) => schema.parse(raw, opts), - schemas, - opts - ); - }, - json: (parsed, opts) => { - return validateAndTransformUndiscriminatedUnion>( - (schema, opts) => schema.json(parsed, opts), - schemas, - opts - ); - }, - getType: () => SchemaType.UNDISCRIMINATED_UNION, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; -} - -function validateAndTransformUndiscriminatedUnion( - transform: (schema: Schema, opts: SchemaOptions) => MaybeValid, - schemas: Schema[], - opts: SchemaOptions | undefined -): MaybeValid { - const errors: ValidationError[] = []; - for (const [index, schema] of schemas.entries()) { - const transformed = transform(schema, { ...opts, skipValidation: false }); - if (transformed.ok) { - return transformed; - } else { - for (const error of transformed.errors) { - errors.push({ - path: error.path, - message: `[Variant ${index}] ${error.message}`, - }); - } - } - } - - return { - ok: false, - errors, - }; -} diff --git a/src/core/schemas/builders/union/discriminant.ts b/src/core/schemas/builders/union/discriminant.ts deleted file mode 100644 index 55065bc8..00000000 --- a/src/core/schemas/builders/union/discriminant.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function discriminant( - parsedDiscriminant: ParsedDiscriminant, - rawDiscriminant: RawDiscriminant -): Discriminant { - return { - parsedDiscriminant, - rawDiscriminant, - }; -} - -export interface Discriminant { - parsedDiscriminant: ParsedDiscriminant; - rawDiscriminant: RawDiscriminant; -} diff --git a/src/core/schemas/builders/union/index.ts b/src/core/schemas/builders/union/index.ts deleted file mode 100644 index 85fc008a..00000000 --- a/src/core/schemas/builders/union/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { discriminant } from "./discriminant"; -export type { Discriminant } from "./discriminant"; -export type { - inferParsedDiscriminant, - inferParsedUnion, - inferRawDiscriminant, - inferRawUnion, - UnionSubtypes, -} from "./types"; -export { union } from "./union"; diff --git a/src/core/schemas/builders/union/types.ts b/src/core/schemas/builders/union/types.ts deleted file mode 100644 index 6f82c868..00000000 --- a/src/core/schemas/builders/union/types.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { inferParsedObject, inferRawObject, ObjectSchema } from "../object"; -import { Discriminant } from "./discriminant"; - -export type UnionSubtypes = { - [K in DiscriminantValues]: ObjectSchema; -}; - -export type inferRawUnion, U extends UnionSubtypes> = { - [K in keyof U]: Record, K> & inferRawObject; -}[keyof U]; - -export type inferParsedUnion, U extends UnionSubtypes> = { - [K in keyof U]: Record, K> & inferParsedObject; -}[keyof U]; - -export type inferRawDiscriminant> = D extends string - ? D - : D extends Discriminant - ? Raw - : never; - -export type inferParsedDiscriminant> = D extends string - ? D - : D extends Discriminant - ? Parsed - : never; diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts deleted file mode 100644 index ab61475a..00000000 --- a/src/core/schemas/builders/union/union.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; -import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { isPlainObject } from "../../utils/isPlainObject"; -import { keys } from "../../utils/keys"; -import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; -import { enum_ } from "../enum"; -import { ObjectSchema } from "../object"; -import { getObjectLikeUtils, ObjectLikeSchema } from "../object-like"; -import { getSchemaUtils } from "../schema-utils"; -import { Discriminant } from "./discriminant"; -import { inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion, UnionSubtypes } from "./types"; - -export function union, U extends UnionSubtypes>( - discriminant: D, - union: U -): ObjectLikeSchema, inferParsedUnion> { - const rawDiscriminant = - typeof discriminant === "string" ? discriminant : (discriminant.rawDiscriminant as inferRawDiscriminant); - const parsedDiscriminant = - typeof discriminant === "string" - ? discriminant - : (discriminant.parsedDiscriminant as inferParsedDiscriminant); - - const discriminantValueSchema = enum_(keys(union) as string[]); - - const baseSchema: BaseSchema, inferParsedUnion> = { - parse: (raw, opts) => { - return transformAndValidateUnion({ - value: raw, - discriminant: rawDiscriminant, - transformedDiscriminant: parsedDiscriminant, - transformDiscriminantValue: (discriminantValue) => - discriminantValueSchema.parse(discriminantValue, { - allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawDiscriminant], - }), - getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], - allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, - transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => - additionalPropertiesSchema.parse(additionalProperties, opts), - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - }); - }, - json: (parsed, opts) => { - return transformAndValidateUnion({ - value: parsed, - discriminant: parsedDiscriminant, - transformedDiscriminant: rawDiscriminant, - transformDiscriminantValue: (discriminantValue) => - discriminantValueSchema.json(discriminantValue, { - allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedDiscriminant], - }), - getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], - allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, - transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => - additionalPropertiesSchema.json(additionalProperties, opts), - breadcrumbsPrefix: opts?.breadcrumbsPrefix, - }); - }, - getType: () => SchemaType.UNION, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - ...getObjectLikeUtils(baseSchema), - }; -} - -function transformAndValidateUnion< - TransformedDiscriminant extends string, - TransformedDiscriminantValue extends string, - TransformedAdditionalProperties ->({ - value, - discriminant, - transformedDiscriminant, - transformDiscriminantValue, - getAdditionalPropertiesSchema, - allowUnrecognizedUnionMembers = false, - transformAdditionalProperties, - breadcrumbsPrefix = [], -}: { - value: unknown; - discriminant: string; - transformedDiscriminant: TransformedDiscriminant; - transformDiscriminantValue: (discriminantValue: unknown) => MaybeValid; - getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; - allowUnrecognizedUnionMembers: boolean | undefined; - transformAdditionalProperties: ( - additionalProperties: unknown, - additionalPropertiesSchema: ObjectSchema - ) => MaybeValid; - breadcrumbsPrefix: string[] | undefined; -}): MaybeValid & TransformedAdditionalProperties> { - if (!isPlainObject(value)) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: getErrorMessageForIncorrectType(value, "object"), - }, - ], - }; - } - - const { [discriminant]: discriminantValue, ...additionalProperties } = value; - - if (discriminantValue == null) { - return { - ok: false, - errors: [ - { - path: breadcrumbsPrefix, - message: `Missing discriminant ("${discriminant}")`, - }, - ], - }; - } - - const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue); - if (!transformedDiscriminantValue.ok) { - return { - ok: false, - errors: transformedDiscriminantValue.errors, - }; - } - - const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value); - - if (additionalPropertiesSchema == null) { - if (allowUnrecognizedUnionMembers) { - return { - ok: true, - value: { - [transformedDiscriminant]: transformedDiscriminantValue.value, - ...additionalProperties, - } as Record & TransformedAdditionalProperties, - }; - } else { - return { - ok: false, - errors: [ - { - path: [...breadcrumbsPrefix, discriminant], - message: "Unexpected discriminant value", - }, - ], - }; - } - } - - const transformedAdditionalProperties = transformAdditionalProperties( - additionalProperties, - additionalPropertiesSchema - ); - if (!transformedAdditionalProperties.ok) { - return transformedAdditionalProperties; - } - - return { - ok: true, - value: { - [transformedDiscriminant]: discriminantValue, - ...transformedAdditionalProperties.value, - } as Record & TransformedAdditionalProperties, - }; -} diff --git a/src/core/schemas/index.ts b/src/core/schemas/index.ts deleted file mode 100644 index 5429d8b4..00000000 --- a/src/core/schemas/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./builders"; -export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; diff --git a/src/core/schemas/utils/MaybePromise.ts b/src/core/schemas/utils/MaybePromise.ts deleted file mode 100644 index 9cd354b3..00000000 --- a/src/core/schemas/utils/MaybePromise.ts +++ /dev/null @@ -1 +0,0 @@ -export type MaybePromise = T | Promise; diff --git a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts deleted file mode 100644 index 4111d703..00000000 --- a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts +++ /dev/null @@ -1,15 +0,0 @@ -export type addQuestionMarksToNullableProperties = { - [K in OptionalKeys]?: T[K]; -} & Pick>; - -export type OptionalKeys = { - [K in keyof T]-?: undefined extends T[K] - ? K - : null extends T[K] - ? K - : 1 extends (any extends T[K] ? 0 : 1) - ? never - : K; -}[keyof T]; - -export type RequiredKeys = Exclude>; diff --git a/src/core/schemas/utils/createIdentitySchemaCreator.ts b/src/core/schemas/utils/createIdentitySchemaCreator.ts deleted file mode 100644 index de107cf5..00000000 --- a/src/core/schemas/utils/createIdentitySchemaCreator.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { getSchemaUtils } from "../builders/schema-utils"; -import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; -import { maybeSkipValidation } from "./maybeSkipValidation"; - -export function createIdentitySchemaCreator( - schemaType: SchemaType, - validate: (value: unknown, opts?: SchemaOptions) => MaybeValid -): () => Schema { - return () => { - const baseSchema: BaseSchema = { - parse: validate, - json: validate, - getType: () => schemaType, - }; - - return { - ...maybeSkipValidation(baseSchema), - ...getSchemaUtils(baseSchema), - }; - }; -} diff --git a/src/core/schemas/utils/entries.ts b/src/core/schemas/utils/entries.ts deleted file mode 100644 index e1229521..00000000 --- a/src/core/schemas/utils/entries.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function entries(object: T): [keyof T, T[keyof T]][] { - return Object.entries(object) as [keyof T, T[keyof T]][]; -} diff --git a/src/core/schemas/utils/filterObject.ts b/src/core/schemas/utils/filterObject.ts deleted file mode 100644 index 2c25a345..00000000 --- a/src/core/schemas/utils/filterObject.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function filterObject(obj: T, keysToInclude: K[]): Pick { - const keysToIncludeSet = new Set(keysToInclude); - return Object.entries(obj).reduce((acc, [key, value]) => { - if (keysToIncludeSet.has(key as K)) { - acc[key as K] = value; - } - return acc; - // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter - }, {} as Pick); -} diff --git a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts deleted file mode 100644 index 1a5c3102..00000000 --- a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts +++ /dev/null @@ -1,25 +0,0 @@ -export function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string { - return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`; -} - -function getTypeAsString(value: unknown): string { - if (Array.isArray(value)) { - return "list"; - } - if (value === null) { - return "null"; - } - if (value instanceof BigInt) { - return "BigInt"; - } - switch (typeof value) { - case "string": - return `"${value}"`; - case "bigint": - case "number": - case "boolean": - case "undefined": - return `${value}`; - } - return typeof value; -} diff --git a/src/core/schemas/utils/isPlainObject.ts b/src/core/schemas/utils/isPlainObject.ts deleted file mode 100644 index db82a722..00000000 --- a/src/core/schemas/utils/isPlainObject.ts +++ /dev/null @@ -1,17 +0,0 @@ -// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js -export function isPlainObject(value: unknown): value is Record { - if (typeof value !== "object" || value === null) { - return false; - } - - if (Object.getPrototypeOf(value) === null) { - return true; - } - - let proto = value; - while (Object.getPrototypeOf(proto) !== null) { - proto = Object.getPrototypeOf(proto); - } - - return Object.getPrototypeOf(value) === proto; -} diff --git a/src/core/schemas/utils/keys.ts b/src/core/schemas/utils/keys.ts deleted file mode 100644 index 01867098..00000000 --- a/src/core/schemas/utils/keys.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function keys(object: T): (keyof T)[] { - return Object.keys(object) as (keyof T)[]; -} diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts deleted file mode 100644 index 86c07abf..00000000 --- a/src/core/schemas/utils/maybeSkipValidation.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; - -export function maybeSkipValidation, Raw, Parsed>(schema: S): S { - return { - ...schema, - json: transformAndMaybeSkipValidation(schema.json), - parse: transformAndMaybeSkipValidation(schema.parse), - }; -} - -function transformAndMaybeSkipValidation( - transform: (value: unknown, opts?: SchemaOptions) => MaybeValid -): (value: unknown, opts?: SchemaOptions) => MaybeValid { - return (value, opts): MaybeValid => { - const transformed = transform(value, opts); - const { skipValidation = false } = opts ?? {}; - if (!transformed.ok && skipValidation) { - // eslint-disable-next-line no-console - console.warn( - [ - "Failed to validate.", - ...transformed.errors.map( - (error) => - " - " + - (error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message) - ), - ].join("\n") - ); - - return { - ok: true, - value: value as T, - }; - } else { - return transformed; - } - }; -} diff --git a/src/core/schemas/utils/partition.ts b/src/core/schemas/utils/partition.ts deleted file mode 100644 index f58d6f3d..00000000 --- a/src/core/schemas/utils/partition.ts +++ /dev/null @@ -1,12 +0,0 @@ -export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { - const trueItems: T[] = [], - falseItems: T[] = []; - for (const item of items) { - if (predicate(item)) { - trueItems.push(item); - } else { - falseItems.push(item); - } - } - return [trueItems, falseItems]; -} diff --git a/src/core/streaming-fetcher/Stream.ts b/src/core/streaming-fetcher/Stream.ts index dccdb796..bbd3e8f7 100644 --- a/src/core/streaming-fetcher/Stream.ts +++ b/src/core/streaming-fetcher/Stream.ts @@ -1,5 +1,6 @@ import { Readable } from "stream"; -import { RUNTIME } from "../runtime"; + +import { RUNTIME } from "../runtime/index.js"; export declare namespace Stream { interface Args { @@ -64,18 +65,14 @@ export class Stream implements AsyncIterable { buf += this.decodeChunk(chunk); let terminatorIndex: number; - // Parse the chunk into as many messages as possible while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) { - // Extract the line from the buffer let line = buf.slice(0, terminatorIndex + 1); - buf = buf.slice(terminatorIndex + 1); + buf = buf.slice(terminatorIndex + this.messageTerminator.length); - // Skip empty lines - if (line.length === 0) { + if (!line.trim()) { continue; } - // Skip the chunk until the prefix is found if (!prefixSeen && this.prefix != null) { const prefixIndex = line.indexOf(this.prefix); if (prefixIndex === -1) { @@ -85,12 +82,9 @@ export class Stream implements AsyncIterable { line = line.slice(prefixIndex + this.prefix.length); } - // If the stream terminator is present, return if (this.streamTerminator != null && line.includes(this.streamTerminator)) { return; } - - // Otherwise, yield message from the prefix to the terminator const message = await this.parse(JSON.parse(line)); yield message; prefixSeen = false; @@ -112,7 +106,7 @@ export class Stream implements AsyncIterable { decoded += decoder.decode(chunk); } // Buffer is present in Node.js environment - else if (RUNTIME.type === "node" && typeof chunk != "undefined") { + else if (RUNTIME.type === "node" && typeof chunk !== "undefined") { decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk); } return decoded; diff --git a/src/core/streaming-fetcher/index.ts b/src/core/streaming-fetcher/index.ts index 7cbb4d15..4e28b34b 100644 --- a/src/core/streaming-fetcher/index.ts +++ b/src/core/streaming-fetcher/index.ts @@ -1 +1 @@ -export { Stream } from "./Stream"; +export { Stream } from "./Stream.js"; diff --git a/src/errors/CohereError.ts b/src/errors/CohereError.ts index fba48dc2..a327178c 100644 --- a/src/errors/CohereError.ts +++ b/src/errors/CohereError.ts @@ -2,20 +2,30 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as core from "../core/index.js"; +import { toJson } from "../core/json.js"; + export class CohereError extends Error { - readonly statusCode?: number; - readonly body?: unknown; + public readonly statusCode?: number; + public readonly body?: unknown; + public readonly rawResponse?: core.RawResponse; - constructor({ message, statusCode, body }: { message?: string; statusCode?: number; body?: unknown }) { + constructor({ + message, + statusCode, + body, + rawResponse, + }: { + message?: string; + statusCode?: number; + body?: unknown; + rawResponse?: core.RawResponse; + }) { super(buildMessage({ message, statusCode, body })); Object.setPrototypeOf(this, CohereError.prototype); - if (statusCode != null) { - this.statusCode = statusCode; - } - - if (body !== undefined) { - this.body = body; - } + this.statusCode = statusCode; + this.body = body; + this.rawResponse = rawResponse; } } @@ -38,7 +48,7 @@ function buildMessage({ } if (body != null) { - lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); + lines.push(`Body: ${toJson(body, undefined, 2)}`); } return lines.join("\n"); diff --git a/src/errors/index.ts b/src/errors/index.ts index 5155e661..32d29461 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -1,2 +1,2 @@ -export { CohereError } from "./CohereError"; -export { CohereTimeoutError } from "./CohereTimeoutError"; +export { CohereError } from "./CohereError.js"; +export { CohereTimeoutError } from "./CohereTimeoutError.js"; diff --git a/src/serialization/client/index.ts b/src/serialization/client/index.ts deleted file mode 100644 index 415726b7..00000000 --- a/src/serialization/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/client/requests/ChatRequest.ts b/src/serialization/client/requests/ChatRequest.ts deleted file mode 100644 index 4e2084b1..00000000 --- a/src/serialization/client/requests/ChatRequest.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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 { Message } from "../../types/Message"; -import { ChatRequestPromptTruncation } from "../../types/ChatRequestPromptTruncation"; -import { ChatConnector } from "../../types/ChatConnector"; -import { ChatDocument } from "../../types/ChatDocument"; -import { ChatRequestCitationQuality } from "../../types/ChatRequestCitationQuality"; -import { Tool } from "../../types/Tool"; -import { ToolResult } from "../../types/ToolResult"; -import { ResponseFormat } from "../../types/ResponseFormat"; -import { ChatRequestSafetyMode } from "../../types/ChatRequestSafetyMode"; - -export const ChatRequest: core.serialization.Schema< - serializers.ChatRequest.Raw, - Omit -> = core.serialization.object({ - message: core.serialization.string(), - model: core.serialization.string().optional(), - preamble: core.serialization.string().optional(), - chatHistory: core.serialization.property("chat_history", core.serialization.list(Message).optional()), - conversationId: core.serialization.property("conversation_id", core.serialization.string().optional()), - promptTruncation: core.serialization.property("prompt_truncation", ChatRequestPromptTruncation.optional()), - connectors: core.serialization.list(ChatConnector).optional(), - searchQueriesOnly: core.serialization.property("search_queries_only", core.serialization.boolean().optional()), - documents: core.serialization.list(ChatDocument).optional(), - citationQuality: core.serialization.property("citation_quality", ChatRequestCitationQuality.optional()), - temperature: core.serialization.number().optional(), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - maxInputTokens: core.serialization.property("max_input_tokens", core.serialization.number().optional()), - k: core.serialization.number().optional(), - p: core.serialization.number().optional(), - seed: core.serialization.number().optional(), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), - presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), - rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), - returnPrompt: core.serialization.property("return_prompt", core.serialization.boolean().optional()), - tools: core.serialization.list(Tool).optional(), - toolResults: core.serialization.property("tool_results", core.serialization.list(ToolResult).optional()), - forceSingleStep: core.serialization.property("force_single_step", core.serialization.boolean().optional()), - responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), - safetyMode: core.serialization.property("safety_mode", ChatRequestSafetyMode.optional()), -}); - -export declare namespace ChatRequest { - interface Raw { - message: string; - model?: string | null; - preamble?: string | null; - chat_history?: Message.Raw[] | null; - conversation_id?: string | null; - prompt_truncation?: ChatRequestPromptTruncation.Raw | null; - connectors?: ChatConnector.Raw[] | null; - search_queries_only?: boolean | null; - documents?: ChatDocument.Raw[] | null; - citation_quality?: ChatRequestCitationQuality.Raw | null; - temperature?: number | null; - max_tokens?: number | null; - max_input_tokens?: number | null; - k?: number | null; - p?: number | null; - seed?: number | null; - stop_sequences?: string[] | null; - frequency_penalty?: number | null; - presence_penalty?: number | null; - raw_prompting?: boolean | null; - return_prompt?: boolean | null; - tools?: Tool.Raw[] | null; - tool_results?: ToolResult.Raw[] | null; - force_single_step?: boolean | null; - response_format?: ResponseFormat.Raw | null; - safety_mode?: ChatRequestSafetyMode.Raw | null; - } -} diff --git a/src/serialization/client/requests/ChatStreamRequest.ts b/src/serialization/client/requests/ChatStreamRequest.ts deleted file mode 100644 index 70f53971..00000000 --- a/src/serialization/client/requests/ChatStreamRequest.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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 { Message } from "../../types/Message"; -import { ChatStreamRequestPromptTruncation } from "../../types/ChatStreamRequestPromptTruncation"; -import { ChatConnector } from "../../types/ChatConnector"; -import { ChatDocument } from "../../types/ChatDocument"; -import { ChatStreamRequestCitationQuality } from "../../types/ChatStreamRequestCitationQuality"; -import { Tool } from "../../types/Tool"; -import { ToolResult } from "../../types/ToolResult"; -import { ResponseFormat } from "../../types/ResponseFormat"; -import { ChatStreamRequestSafetyMode } from "../../types/ChatStreamRequestSafetyMode"; - -export const ChatStreamRequest: core.serialization.Schema< - serializers.ChatStreamRequest.Raw, - Omit -> = core.serialization.object({ - message: core.serialization.string(), - model: core.serialization.string().optional(), - preamble: core.serialization.string().optional(), - chatHistory: core.serialization.property("chat_history", core.serialization.list(Message).optional()), - conversationId: core.serialization.property("conversation_id", core.serialization.string().optional()), - promptTruncation: core.serialization.property("prompt_truncation", ChatStreamRequestPromptTruncation.optional()), - connectors: core.serialization.list(ChatConnector).optional(), - searchQueriesOnly: core.serialization.property("search_queries_only", core.serialization.boolean().optional()), - documents: core.serialization.list(ChatDocument).optional(), - citationQuality: core.serialization.property("citation_quality", ChatStreamRequestCitationQuality.optional()), - temperature: core.serialization.number().optional(), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - maxInputTokens: core.serialization.property("max_input_tokens", core.serialization.number().optional()), - k: core.serialization.number().optional(), - p: core.serialization.number().optional(), - seed: core.serialization.number().optional(), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), - presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), - rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), - returnPrompt: core.serialization.property("return_prompt", core.serialization.boolean().optional()), - tools: core.serialization.list(Tool).optional(), - toolResults: core.serialization.property("tool_results", core.serialization.list(ToolResult).optional()), - forceSingleStep: core.serialization.property("force_single_step", core.serialization.boolean().optional()), - responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), - safetyMode: core.serialization.property("safety_mode", ChatStreamRequestSafetyMode.optional()), -}); - -export declare namespace ChatStreamRequest { - interface Raw { - message: string; - model?: string | null; - preamble?: string | null; - chat_history?: Message.Raw[] | null; - conversation_id?: string | null; - prompt_truncation?: ChatStreamRequestPromptTruncation.Raw | null; - connectors?: ChatConnector.Raw[] | null; - search_queries_only?: boolean | null; - documents?: ChatDocument.Raw[] | null; - citation_quality?: ChatStreamRequestCitationQuality.Raw | null; - temperature?: number | null; - max_tokens?: number | null; - max_input_tokens?: number | null; - k?: number | null; - p?: number | null; - seed?: number | null; - stop_sequences?: string[] | null; - frequency_penalty?: number | null; - presence_penalty?: number | null; - raw_prompting?: boolean | null; - return_prompt?: boolean | null; - tools?: Tool.Raw[] | null; - tool_results?: ToolResult.Raw[] | null; - force_single_step?: boolean | null; - response_format?: ResponseFormat.Raw | null; - safety_mode?: ChatStreamRequestSafetyMode.Raw | null; - } -} diff --git a/src/serialization/client/requests/ClassifyRequest.ts b/src/serialization/client/requests/ClassifyRequest.ts deleted file mode 100644 index dd2920bc..00000000 --- a/src/serialization/client/requests/ClassifyRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 { ClassifyExample } from "../../types/ClassifyExample"; -import { ClassifyRequestTruncate } from "../../types/ClassifyRequestTruncate"; - -export const ClassifyRequest: core.serialization.Schema = - core.serialization.object({ - inputs: core.serialization.list(core.serialization.string()), - examples: core.serialization.list(ClassifyExample).optional(), - model: core.serialization.string().optional(), - preset: core.serialization.string().optional(), - truncate: ClassifyRequestTruncate.optional(), - }); - -export declare namespace ClassifyRequest { - interface Raw { - inputs: string[]; - examples?: ClassifyExample.Raw[] | null; - model?: string | null; - preset?: string | null; - truncate?: ClassifyRequestTruncate.Raw | null; - } -} diff --git a/src/serialization/client/requests/DetokenizeRequest.ts b/src/serialization/client/requests/DetokenizeRequest.ts deleted file mode 100644 index d2fd2cbd..00000000 --- a/src/serialization/client/requests/DetokenizeRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 DetokenizeRequest: core.serialization.Schema = - core.serialization.object({ - tokens: core.serialization.list(core.serialization.number()), - model: core.serialization.string(), - }); - -export declare namespace DetokenizeRequest { - interface Raw { - tokens: number[]; - model: string; - } -} diff --git a/src/serialization/client/requests/EmbedRequest.ts b/src/serialization/client/requests/EmbedRequest.ts deleted file mode 100644 index 135b1bb8..00000000 --- a/src/serialization/client/requests/EmbedRequest.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 { EmbedInputType } from "../../types/EmbedInputType"; -import { EmbeddingType } from "../../types/EmbeddingType"; -import { EmbedRequestTruncate } from "../../types/EmbedRequestTruncate"; - -export const EmbedRequest: core.serialization.Schema = - core.serialization.object({ - texts: core.serialization.list(core.serialization.string()).optional(), - images: core.serialization.list(core.serialization.string()).optional(), - model: core.serialization.string().optional(), - inputType: core.serialization.property("input_type", EmbedInputType.optional()), - embeddingTypes: core.serialization.property( - "embedding_types", - core.serialization.list(EmbeddingType).optional() - ), - truncate: EmbedRequestTruncate.optional(), - }); - -export declare namespace EmbedRequest { - interface Raw { - texts?: string[] | null; - images?: string[] | null; - model?: string | null; - input_type?: EmbedInputType.Raw | null; - embedding_types?: EmbeddingType.Raw[] | null; - truncate?: EmbedRequestTruncate.Raw | null; - } -} diff --git a/src/serialization/client/requests/GenerateRequest.ts b/src/serialization/client/requests/GenerateRequest.ts deleted file mode 100644 index 562c3c19..00000000 --- a/src/serialization/client/requests/GenerateRequest.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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 { GenerateRequestTruncate } from "../../types/GenerateRequestTruncate"; -import { GenerateRequestReturnLikelihoods } from "../../types/GenerateRequestReturnLikelihoods"; - -export const GenerateRequest: core.serialization.Schema = - core.serialization.object({ - prompt: core.serialization.string(), - model: core.serialization.string().optional(), - numGenerations: core.serialization.property("num_generations", core.serialization.number().optional()), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - truncate: GenerateRequestTruncate.optional(), - temperature: core.serialization.number().optional(), - seed: core.serialization.number().optional(), - preset: core.serialization.string().optional(), - endSequences: core.serialization.property( - "end_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - k: core.serialization.number().optional(), - p: core.serialization.number().optional(), - frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), - presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), - returnLikelihoods: core.serialization.property( - "return_likelihoods", - GenerateRequestReturnLikelihoods.optional() - ), - rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), - }); - -export declare namespace GenerateRequest { - interface Raw { - prompt: string; - model?: string | null; - num_generations?: number | null; - max_tokens?: number | null; - truncate?: GenerateRequestTruncate.Raw | null; - temperature?: number | null; - seed?: number | null; - preset?: string | null; - end_sequences?: string[] | null; - stop_sequences?: string[] | null; - k?: number | null; - p?: number | null; - frequency_penalty?: number | null; - presence_penalty?: number | null; - return_likelihoods?: GenerateRequestReturnLikelihoods.Raw | null; - raw_prompting?: boolean | null; - } -} diff --git a/src/serialization/client/requests/GenerateStreamRequest.ts b/src/serialization/client/requests/GenerateStreamRequest.ts deleted file mode 100644 index 69e77d2f..00000000 --- a/src/serialization/client/requests/GenerateStreamRequest.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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 { GenerateStreamRequestTruncate } from "../../types/GenerateStreamRequestTruncate"; -import { GenerateStreamRequestReturnLikelihoods } from "../../types/GenerateStreamRequestReturnLikelihoods"; - -export const GenerateStreamRequest: core.serialization.Schema< - serializers.GenerateStreamRequest.Raw, - Cohere.GenerateStreamRequest -> = core.serialization.object({ - prompt: core.serialization.string(), - model: core.serialization.string().optional(), - numGenerations: core.serialization.property("num_generations", core.serialization.number().optional()), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - truncate: GenerateStreamRequestTruncate.optional(), - temperature: core.serialization.number().optional(), - seed: core.serialization.number().optional(), - preset: core.serialization.string().optional(), - endSequences: core.serialization.property( - "end_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).optional() - ), - k: core.serialization.number().optional(), - p: core.serialization.number().optional(), - frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), - presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), - returnLikelihoods: core.serialization.property( - "return_likelihoods", - GenerateStreamRequestReturnLikelihoods.optional() - ), - rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), -}); - -export declare namespace GenerateStreamRequest { - interface Raw { - prompt: string; - model?: string | null; - num_generations?: number | null; - max_tokens?: number | null; - truncate?: GenerateStreamRequestTruncate.Raw | null; - temperature?: number | null; - seed?: number | null; - preset?: string | null; - end_sequences?: string[] | null; - stop_sequences?: string[] | null; - k?: number | null; - p?: number | null; - frequency_penalty?: number | null; - presence_penalty?: number | null; - return_likelihoods?: GenerateStreamRequestReturnLikelihoods.Raw | null; - raw_prompting?: boolean | null; - } -} diff --git a/src/serialization/client/requests/RerankRequest.ts b/src/serialization/client/requests/RerankRequest.ts deleted file mode 100644 index 617cd8e5..00000000 --- a/src/serialization/client/requests/RerankRequest.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 { RerankRequestDocumentsItem } from "../../types/RerankRequestDocumentsItem"; - -export const RerankRequest: core.serialization.Schema = - core.serialization.object({ - model: core.serialization.string().optional(), - query: core.serialization.string(), - documents: core.serialization.list(RerankRequestDocumentsItem), - topN: core.serialization.property("top_n", core.serialization.number().optional()), - rankFields: core.serialization.property( - "rank_fields", - core.serialization.list(core.serialization.string()).optional() - ), - returnDocuments: core.serialization.property("return_documents", core.serialization.boolean().optional()), - maxChunksPerDoc: core.serialization.property("max_chunks_per_doc", core.serialization.number().optional()), - }); - -export declare namespace RerankRequest { - interface Raw { - model?: string | null; - query: string; - documents: RerankRequestDocumentsItem.Raw[]; - top_n?: number | null; - rank_fields?: string[] | null; - return_documents?: boolean | null; - max_chunks_per_doc?: number | null; - } -} diff --git a/src/serialization/client/requests/SummarizeRequest.ts b/src/serialization/client/requests/SummarizeRequest.ts deleted file mode 100644 index 45625815..00000000 --- a/src/serialization/client/requests/SummarizeRequest.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 { SummarizeRequestLength } from "../../types/SummarizeRequestLength"; -import { SummarizeRequestFormat } from "../../types/SummarizeRequestFormat"; -import { SummarizeRequestExtractiveness } from "../../types/SummarizeRequestExtractiveness"; - -export const SummarizeRequest: core.serialization.Schema = - core.serialization.object({ - text: core.serialization.string(), - length: SummarizeRequestLength.optional(), - format: SummarizeRequestFormat.optional(), - model: core.serialization.string().optional(), - extractiveness: SummarizeRequestExtractiveness.optional(), - temperature: core.serialization.number().optional(), - additionalCommand: core.serialization.property("additional_command", core.serialization.string().optional()), - }); - -export declare namespace SummarizeRequest { - interface Raw { - text: string; - length?: SummarizeRequestLength.Raw | null; - format?: SummarizeRequestFormat.Raw | null; - model?: string | null; - extractiveness?: SummarizeRequestExtractiveness.Raw | null; - temperature?: number | null; - additional_command?: string | null; - } -} diff --git a/src/serialization/client/requests/TokenizeRequest.ts b/src/serialization/client/requests/TokenizeRequest.ts deleted file mode 100644 index 420b0d23..00000000 --- a/src/serialization/client/requests/TokenizeRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 TokenizeRequest: core.serialization.Schema = - core.serialization.object({ - text: core.serialization.string(), - model: core.serialization.string(), - }); - -export declare namespace TokenizeRequest { - interface Raw { - text: string; - model: string; - } -} diff --git a/src/serialization/client/requests/index.ts b/src/serialization/client/requests/index.ts deleted file mode 100644 index 20584c95..00000000 --- a/src/serialization/client/requests/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { ChatStreamRequest } from "./ChatStreamRequest"; -export { ChatRequest } from "./ChatRequest"; -export { GenerateStreamRequest } from "./GenerateStreamRequest"; -export { GenerateRequest } from "./GenerateRequest"; -export { EmbedRequest } from "./EmbedRequest"; -export { RerankRequest } from "./RerankRequest"; -export { ClassifyRequest } from "./ClassifyRequest"; -export { SummarizeRequest } from "./SummarizeRequest"; -export { TokenizeRequest } from "./TokenizeRequest"; -export { DetokenizeRequest } from "./DetokenizeRequest"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts deleted file mode 100644 index d3c50802..00000000 --- a/src/serialization/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./resources"; -export * from "./types"; -export * from "./client"; diff --git a/src/serialization/resources/connectors/client/index.ts b/src/serialization/resources/connectors/client/index.ts deleted file mode 100644 index 415726b7..00000000 --- a/src/serialization/resources/connectors/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts b/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts deleted file mode 100644 index 3452241d..00000000 --- a/src/serialization/resources/connectors/client/requests/CreateConnectorRequest.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 { CreateConnectorOAuth } from "../../../../types/CreateConnectorOAuth"; -import { CreateConnectorServiceAuth } from "../../../../types/CreateConnectorServiceAuth"; - -export const CreateConnectorRequest: core.serialization.Schema< - serializers.CreateConnectorRequest.Raw, - Cohere.CreateConnectorRequest -> = core.serialization.object({ - name: core.serialization.string(), - description: core.serialization.string().optional(), - url: core.serialization.string(), - excludes: core.serialization.list(core.serialization.string()).optional(), - oauth: CreateConnectorOAuth.optional(), - active: core.serialization.boolean().optional(), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - serviceAuth: core.serialization.property("service_auth", CreateConnectorServiceAuth.optional()), -}); - -export declare namespace CreateConnectorRequest { - interface Raw { - name: string; - description?: string | null; - url: string; - excludes?: string[] | null; - oauth?: CreateConnectorOAuth.Raw | null; - active?: boolean | null; - continue_on_failure?: boolean | null; - service_auth?: CreateConnectorServiceAuth.Raw | null; - } -} diff --git a/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts b/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts deleted file mode 100644 index 7003df09..00000000 --- a/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 { CreateConnectorOAuth } from "../../../../types/CreateConnectorOAuth"; -import { CreateConnectorServiceAuth } from "../../../../types/CreateConnectorServiceAuth"; - -export const UpdateConnectorRequest: core.serialization.Schema< - serializers.UpdateConnectorRequest.Raw, - Cohere.UpdateConnectorRequest -> = core.serialization.object({ - name: core.serialization.string().optional(), - url: core.serialization.string().optional(), - excludes: core.serialization.list(core.serialization.string()).optional(), - oauth: CreateConnectorOAuth.optional(), - active: core.serialization.boolean().optional(), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - serviceAuth: core.serialization.property("service_auth", CreateConnectorServiceAuth.optional()), -}); - -export declare namespace UpdateConnectorRequest { - interface Raw { - name?: string | null; - url?: string | null; - excludes?: string[] | null; - oauth?: CreateConnectorOAuth.Raw | null; - active?: boolean | null; - continue_on_failure?: boolean | null; - service_auth?: CreateConnectorServiceAuth.Raw | null; - } -} diff --git a/src/serialization/resources/connectors/client/requests/index.ts b/src/serialization/resources/connectors/client/requests/index.ts deleted file mode 100644 index 50d84c73..00000000 --- a/src/serialization/resources/connectors/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { CreateConnectorRequest } from "./CreateConnectorRequest"; -export { UpdateConnectorRequest } from "./UpdateConnectorRequest"; diff --git a/src/serialization/resources/connectors/index.ts b/src/serialization/resources/connectors/index.ts deleted file mode 100644 index 5ec76921..00000000 --- a/src/serialization/resources/connectors/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/datasets/client/delete.ts b/src/serialization/resources/datasets/client/delete.ts deleted file mode 100644 index b66a7a59..00000000 --- a/src/serialization/resources/datasets/client/delete.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as core from "../../../../core"; - -export const Response: core.serialization.Schema< - serializers.datasets.delete.Response.Raw, - Record -> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); - -export declare namespace Response { - type Raw = Record; -} diff --git a/src/serialization/resources/datasets/client/index.ts b/src/serialization/resources/datasets/client/index.ts deleted file mode 100644 index a6466579..00000000 --- a/src/serialization/resources/datasets/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * as delete from "./delete"; diff --git a/src/serialization/resources/datasets/index.ts b/src/serialization/resources/datasets/index.ts deleted file mode 100644 index c9240f83..00000000 --- a/src/serialization/resources/datasets/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types"; -export * from "./client"; diff --git a/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts b/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts deleted file mode 100644 index c5bc4b19..00000000 --- a/src/serialization/resources/datasets/types/DatasetsCreateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 DatasetsCreateResponse: core.serialization.ObjectSchema< - serializers.DatasetsCreateResponse.Raw, - Cohere.DatasetsCreateResponse -> = core.serialization.object({ - id: core.serialization.string().optional(), -}); - -export declare namespace DatasetsCreateResponse { - interface Raw { - id?: string | null; - } -} diff --git a/src/serialization/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts b/src/serialization/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts deleted file mode 100644 index ab772281..00000000 --- a/src/serialization/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 DatasetsCreateResponseDatasetPartsItem: core.serialization.ObjectSchema< - serializers.DatasetsCreateResponseDatasetPartsItem.Raw, - Cohere.DatasetsCreateResponseDatasetPartsItem -> = core.serialization.object({ - name: core.serialization.string().optional(), - numRows: core.serialization.property("num_rows", core.serialization.number().optional()), - samples: core.serialization.list(core.serialization.string()).optional(), - partKind: core.serialization.property("part_kind", core.serialization.string().optional()), -}); - -export declare namespace DatasetsCreateResponseDatasetPartsItem { - interface Raw { - name?: string | null; - num_rows?: number | null; - samples?: string[] | null; - part_kind?: string | null; - } -} diff --git a/src/serialization/resources/datasets/types/DatasetsGetResponse.ts b/src/serialization/resources/datasets/types/DatasetsGetResponse.ts deleted file mode 100644 index 7ac4fdf7..00000000 --- a/src/serialization/resources/datasets/types/DatasetsGetResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Dataset } from "../../../types/Dataset"; - -export const DatasetsGetResponse: core.serialization.ObjectSchema< - serializers.DatasetsGetResponse.Raw, - Cohere.DatasetsGetResponse -> = core.serialization.object({ - dataset: Dataset, -}); - -export declare namespace DatasetsGetResponse { - interface Raw { - dataset: Dataset.Raw; - } -} diff --git a/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts b/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts deleted file mode 100644 index 2568d273..00000000 --- a/src/serialization/resources/datasets/types/DatasetsGetUsageResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 DatasetsGetUsageResponse: core.serialization.ObjectSchema< - serializers.DatasetsGetUsageResponse.Raw, - Cohere.DatasetsGetUsageResponse -> = core.serialization.object({ - organizationUsage: core.serialization.property("organization_usage", core.serialization.number().optional()), -}); - -export declare namespace DatasetsGetUsageResponse { - interface Raw { - organization_usage?: number | null; - } -} diff --git a/src/serialization/resources/datasets/types/DatasetsListResponse.ts b/src/serialization/resources/datasets/types/DatasetsListResponse.ts deleted file mode 100644 index 70ea0816..00000000 --- a/src/serialization/resources/datasets/types/DatasetsListResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Dataset } from "../../../types/Dataset"; - -export const DatasetsListResponse: core.serialization.ObjectSchema< - serializers.DatasetsListResponse.Raw, - Cohere.DatasetsListResponse -> = core.serialization.object({ - datasets: core.serialization.list(Dataset).optional(), -}); - -export declare namespace DatasetsListResponse { - interface Raw { - datasets?: Dataset.Raw[] | null; - } -} diff --git a/src/serialization/resources/datasets/types/index.ts b/src/serialization/resources/datasets/types/index.ts deleted file mode 100644 index cc2e2520..00000000 --- a/src/serialization/resources/datasets/types/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./DatasetsListResponse"; -export * from "./DatasetsCreateResponseDatasetPartsItem"; -export * from "./DatasetsCreateResponse"; -export * from "./DatasetsGetUsageResponse"; -export * from "./DatasetsGetResponse"; diff --git a/src/serialization/resources/embedJobs/client/index.ts b/src/serialization/resources/embedJobs/client/index.ts deleted file mode 100644 index 415726b7..00000000 --- a/src/serialization/resources/embedJobs/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts deleted file mode 100644 index d9e72643..00000000 --- a/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 { EmbedInputType } from "../../../../types/EmbedInputType"; -import { EmbeddingType } from "../../../../types/EmbeddingType"; -import { CreateEmbedJobRequestTruncate } from "../../types/CreateEmbedJobRequestTruncate"; - -export const CreateEmbedJobRequest: core.serialization.Schema< - serializers.CreateEmbedJobRequest.Raw, - Cohere.CreateEmbedJobRequest -> = core.serialization.object({ - model: core.serialization.string(), - datasetId: core.serialization.property("dataset_id", core.serialization.string()), - inputType: core.serialization.property("input_type", EmbedInputType), - name: core.serialization.string().optional(), - embeddingTypes: core.serialization.property("embedding_types", core.serialization.list(EmbeddingType).optional()), - truncate: CreateEmbedJobRequestTruncate.optional(), -}); - -export declare namespace CreateEmbedJobRequest { - interface Raw { - model: string; - dataset_id: string; - input_type: EmbedInputType.Raw; - name?: string | null; - embedding_types?: EmbeddingType.Raw[] | null; - truncate?: CreateEmbedJobRequestTruncate.Raw | null; - } -} diff --git a/src/serialization/resources/embedJobs/client/requests/index.ts b/src/serialization/resources/embedJobs/client/requests/index.ts deleted file mode 100644 index 91c845da..00000000 --- a/src/serialization/resources/embedJobs/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; diff --git a/src/serialization/resources/embedJobs/index.ts b/src/serialization/resources/embedJobs/index.ts deleted file mode 100644 index c9240f83..00000000 --- a/src/serialization/resources/embedJobs/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types"; -export * from "./client"; diff --git a/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts b/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts deleted file mode 100644 index 8020af3a..00000000 --- a/src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 CreateEmbedJobRequestTruncate: core.serialization.Schema< - serializers.CreateEmbedJobRequestTruncate.Raw, - Cohere.CreateEmbedJobRequestTruncate -> = core.serialization.enum_(["START", "END"]); - -export declare namespace CreateEmbedJobRequestTruncate { - type Raw = "START" | "END"; -} diff --git a/src/serialization/resources/embedJobs/types/index.ts b/src/serialization/resources/embedJobs/types/index.ts deleted file mode 100644 index f6698e47..00000000 --- a/src/serialization/resources/embedJobs/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./CreateEmbedJobRequestTruncate"; diff --git a/src/serialization/resources/finetuning/client/index.ts b/src/serialization/resources/finetuning/client/index.ts deleted file mode 100644 index 415726b7..00000000 --- a/src/serialization/resources/finetuning/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts b/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts deleted file mode 100644 index a6a93848..00000000 --- a/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 { Settings } from "../../resources/finetuning/types/Settings"; -import { Status } from "../../resources/finetuning/types/Status"; - -export const FinetuningUpdateFinetunedModelRequest: core.serialization.Schema< - serializers.FinetuningUpdateFinetunedModelRequest.Raw, - Cohere.FinetuningUpdateFinetunedModelRequest -> = core.serialization.object({ - name: core.serialization.string(), - creatorId: core.serialization.property("creator_id", core.serialization.string().optional()), - organizationId: core.serialization.property("organization_id", core.serialization.string().optional()), - settings: Settings, - status: Status.optional(), - createdAt: core.serialization.property("created_at", core.serialization.date().optional()), - updatedAt: core.serialization.property("updated_at", core.serialization.date().optional()), - completedAt: core.serialization.property("completed_at", core.serialization.date().optional()), - lastUsed: core.serialization.property("last_used", core.serialization.date().optional()), -}); - -export declare namespace FinetuningUpdateFinetunedModelRequest { - interface Raw { - name: string; - creator_id?: string | null; - organization_id?: string | null; - settings: Settings.Raw; - status?: Status.Raw | null; - created_at?: string | null; - updated_at?: string | null; - completed_at?: string | null; - last_used?: string | null; - } -} diff --git a/src/serialization/resources/finetuning/client/requests/index.ts b/src/serialization/resources/finetuning/client/requests/index.ts deleted file mode 100644 index 9b883677..00000000 --- a/src/serialization/resources/finetuning/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { FinetuningUpdateFinetunedModelRequest } from "./FinetuningUpdateFinetunedModelRequest"; diff --git a/src/serialization/resources/finetuning/index.ts b/src/serialization/resources/finetuning/index.ts deleted file mode 100644 index 4ce0f390..00000000 --- a/src/serialization/resources/finetuning/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./resources"; -export * from "./client"; diff --git a/src/serialization/resources/finetuning/resources/finetuning/index.ts b/src/serialization/resources/finetuning/resources/finetuning/index.ts deleted file mode 100644 index eea524d6..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./types"; diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts b/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts deleted file mode 100644 index 886b3e5e..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 { BaseType } from "./BaseType"; -import { Strategy } from "./Strategy"; - -export const BaseModel: core.serialization.ObjectSchema< - serializers.finetuning.BaseModel.Raw, - Cohere.finetuning.BaseModel -> = core.serialization.object({ - name: core.serialization.string().optional(), - version: core.serialization.string().optional(), - baseType: core.serialization.property("base_type", BaseType), - strategy: Strategy.optional(), -}); - -export declare namespace BaseModel { - interface Raw { - name?: string | null; - version?: string | null; - base_type: BaseType.Raw; - strategy?: Strategy.Raw | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/BaseType.ts b/src/serialization/resources/finetuning/resources/finetuning/types/BaseType.ts deleted file mode 100644 index 1f3badc1..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/BaseType.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 BaseType: core.serialization.Schema = - core.serialization.enum_([ - "BASE_TYPE_UNSPECIFIED", - "BASE_TYPE_GENERATIVE", - "BASE_TYPE_CLASSIFICATION", - "BASE_TYPE_RERANK", - "BASE_TYPE_CHAT", - ]); - -export declare namespace BaseType { - type Raw = - | "BASE_TYPE_UNSPECIFIED" - | "BASE_TYPE_GENERATIVE" - | "BASE_TYPE_CLASSIFICATION" - | "BASE_TYPE_RERANK" - | "BASE_TYPE_CHAT"; -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts deleted file mode 100644 index cedfd2cc..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { FinetunedModel } from "./FinetunedModel"; - -export const CreateFinetunedModelResponse: core.serialization.ObjectSchema< - serializers.finetuning.CreateFinetunedModelResponse.Raw, - Cohere.finetuning.CreateFinetunedModelResponse -> = core.serialization.object({ - finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), -}); - -export declare namespace CreateFinetunedModelResponse { - interface Raw { - finetuned_model?: FinetunedModel.Raw | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/DeleteFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/DeleteFinetunedModelResponse.ts deleted file mode 100644 index c68b213d..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/DeleteFinetunedModelResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 DeleteFinetunedModelResponse: core.serialization.Schema< - serializers.finetuning.DeleteFinetunedModelResponse.Raw, - Cohere.finetuning.DeleteFinetunedModelResponse -> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); - -export declare namespace DeleteFinetunedModelResponse { - type Raw = Record; -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts deleted file mode 100644 index a41ce798..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { Status } from "./Status"; - -export const Event: core.serialization.ObjectSchema = - core.serialization.object({ - userId: core.serialization.property("user_id", core.serialization.string().optional()), - status: Status.optional(), - createdAt: core.serialization.property("created_at", core.serialization.date().optional()), - }); - -export declare namespace Event { - interface Raw { - user_id?: string | null; - status?: Status.Raw | null; - created_at?: string | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/FinetunedModel.ts b/src/serialization/resources/finetuning/resources/finetuning/types/FinetunedModel.ts deleted file mode 100644 index 76d29f22..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/FinetunedModel.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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 { Settings } from "./Settings"; -import { Status } from "./Status"; - -export const FinetunedModel: core.serialization.ObjectSchema< - serializers.finetuning.FinetunedModel.Raw, - Cohere.finetuning.FinetunedModel -> = core.serialization.object({ - id: core.serialization.string().optional(), - name: core.serialization.string(), - creatorId: core.serialization.property("creator_id", core.serialization.string().optional()), - organizationId: core.serialization.property("organization_id", core.serialization.string().optional()), - settings: Settings, - status: Status.optional(), - createdAt: core.serialization.property("created_at", core.serialization.date().optional()), - updatedAt: core.serialization.property("updated_at", core.serialization.date().optional()), - completedAt: core.serialization.property("completed_at", core.serialization.date().optional()), - lastUsed: core.serialization.property("last_used", core.serialization.date().optional()), -}); - -export declare namespace FinetunedModel { - interface Raw { - id?: string | null; - name: string; - creator_id?: string | null; - organization_id?: string | null; - settings: Settings.Raw; - status?: Status.Raw | null; - created_at?: string | null; - updated_at?: string | null; - completed_at?: string | null; - last_used?: string | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts deleted file mode 100644 index 4d159509..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { FinetunedModel } from "./FinetunedModel"; - -export const GetFinetunedModelResponse: core.serialization.ObjectSchema< - serializers.finetuning.GetFinetunedModelResponse.Raw, - Cohere.finetuning.GetFinetunedModelResponse -> = core.serialization.object({ - finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), -}); - -export declare namespace GetFinetunedModelResponse { - interface Raw { - finetuned_model?: FinetunedModel.Raw | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Hyperparameters.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Hyperparameters.ts deleted file mode 100644 index 24c80953..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Hyperparameters.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 { LoraTargetModules } from "./LoraTargetModules"; - -export const Hyperparameters: core.serialization.ObjectSchema< - serializers.finetuning.Hyperparameters.Raw, - Cohere.finetuning.Hyperparameters -> = core.serialization.object({ - earlyStoppingPatience: core.serialization.property( - "early_stopping_patience", - core.serialization.number().optional() - ), - earlyStoppingThreshold: core.serialization.property( - "early_stopping_threshold", - core.serialization.number().optional() - ), - trainBatchSize: core.serialization.property("train_batch_size", core.serialization.number().optional()), - trainEpochs: core.serialization.property("train_epochs", core.serialization.number().optional()), - learningRate: core.serialization.property("learning_rate", core.serialization.number().optional()), - loraAlpha: core.serialization.property("lora_alpha", core.serialization.number().optional()), - loraRank: core.serialization.property("lora_rank", core.serialization.number().optional()), - loraTargetModules: core.serialization.property("lora_target_modules", LoraTargetModules.optional()), -}); - -export declare namespace Hyperparameters { - interface Raw { - early_stopping_patience?: number | null; - early_stopping_threshold?: number | null; - train_batch_size?: number | null; - train_epochs?: number | null; - learning_rate?: number | null; - lora_alpha?: number | null; - lora_rank?: number | null; - lora_target_modules?: LoraTargetModules.Raw | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts deleted file mode 100644 index 3cec887d..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { Event } from "./Event"; - -export const ListEventsResponse: core.serialization.ObjectSchema< - serializers.finetuning.ListEventsResponse.Raw, - Cohere.finetuning.ListEventsResponse -> = core.serialization.object({ - events: core.serialization.list(Event).optional(), - nextPageToken: core.serialization.property("next_page_token", core.serialization.string().optional()), - totalSize: core.serialization.property("total_size", core.serialization.number().optional()), -}); - -export declare namespace ListEventsResponse { - interface Raw { - events?: Event.Raw[] | null; - next_page_token?: string | null; - total_size?: number | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts deleted file mode 100644 index d28dc35f..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 { FinetunedModel } from "./FinetunedModel"; - -export const ListFinetunedModelsResponse: core.serialization.ObjectSchema< - serializers.finetuning.ListFinetunedModelsResponse.Raw, - Cohere.finetuning.ListFinetunedModelsResponse -> = core.serialization.object({ - finetunedModels: core.serialization.property( - "finetuned_models", - core.serialization.list(FinetunedModel).optional() - ), - nextPageToken: core.serialization.property("next_page_token", core.serialization.string().optional()), - totalSize: core.serialization.property("total_size", core.serialization.number().optional()), -}); - -export declare namespace ListFinetunedModelsResponse { - interface Raw { - finetuned_models?: FinetunedModel.Raw[] | null; - next_page_token?: string | null; - total_size?: number | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts deleted file mode 100644 index 7a1ef11f..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { TrainingStepMetrics } from "./TrainingStepMetrics"; - -export const ListTrainingStepMetricsResponse: core.serialization.ObjectSchema< - serializers.finetuning.ListTrainingStepMetricsResponse.Raw, - Cohere.finetuning.ListTrainingStepMetricsResponse -> = core.serialization.object({ - stepMetrics: core.serialization.property("step_metrics", core.serialization.list(TrainingStepMetrics).optional()), - nextPageToken: core.serialization.property("next_page_token", core.serialization.string().optional()), -}); - -export declare namespace ListTrainingStepMetricsResponse { - interface Raw { - step_metrics?: TrainingStepMetrics.Raw[] | null; - next_page_token?: string | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/LoraTargetModules.ts b/src/serialization/resources/finetuning/resources/finetuning/types/LoraTargetModules.ts deleted file mode 100644 index cd355a28..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/LoraTargetModules.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 LoraTargetModules: core.serialization.Schema< - serializers.finetuning.LoraTargetModules.Raw, - Cohere.finetuning.LoraTargetModules -> = core.serialization.enum_([ - "LORA_TARGET_MODULES_UNSPECIFIED", - "LORA_TARGET_MODULES_QV", - "LORA_TARGET_MODULES_QKVO", - "LORA_TARGET_MODULES_QKVO_FFN", -]); - -export declare namespace LoraTargetModules { - type Raw = - | "LORA_TARGET_MODULES_UNSPECIFIED" - | "LORA_TARGET_MODULES_QV" - | "LORA_TARGET_MODULES_QKVO" - | "LORA_TARGET_MODULES_QKVO_FFN"; -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts deleted file mode 100644 index 8e49e939..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 { BaseModel } from "./BaseModel"; -import { Hyperparameters } from "./Hyperparameters"; -import { WandbConfig } from "./WandbConfig"; - -export const Settings: core.serialization.ObjectSchema< - serializers.finetuning.Settings.Raw, - Cohere.finetuning.Settings -> = core.serialization.object({ - baseModel: core.serialization.property("base_model", BaseModel), - 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 { - interface Raw { - base_model: BaseModel.Raw; - 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/Status.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Status.ts deleted file mode 100644 index 6874a8d5..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Status.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 Status: core.serialization.Schema = - core.serialization.enum_([ - "STATUS_UNSPECIFIED", - "STATUS_FINETUNING", - "STATUS_DEPLOYING_API", - "STATUS_READY", - "STATUS_FAILED", - "STATUS_DELETED", - "STATUS_TEMPORARILY_OFFLINE", - "STATUS_PAUSED", - "STATUS_QUEUED", - ]); - -export declare namespace Status { - type Raw = - | "STATUS_UNSPECIFIED" - | "STATUS_FINETUNING" - | "STATUS_DEPLOYING_API" - | "STATUS_READY" - | "STATUS_FAILED" - | "STATUS_DELETED" - | "STATUS_TEMPORARILY_OFFLINE" - | "STATUS_PAUSED" - | "STATUS_QUEUED"; -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Strategy.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Strategy.ts deleted file mode 100644 index aad4a669..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Strategy.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 Strategy: core.serialization.Schema = - core.serialization.enum_(["STRATEGY_UNSPECIFIED", "STRATEGY_VANILLA", "STRATEGY_TFEW"]); - -export declare namespace Strategy { - type Raw = "STRATEGY_UNSPECIFIED" | "STRATEGY_VANILLA" | "STRATEGY_TFEW"; -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts b/src/serialization/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts deleted file mode 100644 index 70241bb9..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 TrainingStepMetrics: core.serialization.ObjectSchema< - serializers.finetuning.TrainingStepMetrics.Raw, - Cohere.finetuning.TrainingStepMetrics -> = core.serialization.object({ - createdAt: core.serialization.property("created_at", core.serialization.date().optional()), - stepNumber: core.serialization.property("step_number", core.serialization.number().optional()), - metrics: core.serialization.record(core.serialization.string(), core.serialization.number()).optional(), -}); - -export declare namespace TrainingStepMetrics { - interface Raw { - created_at?: string | null; - step_number?: number | null; - metrics?: Record | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts deleted file mode 100644 index b3d46985..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { FinetunedModel } from "./FinetunedModel"; - -export const UpdateFinetunedModelResponse: core.serialization.ObjectSchema< - serializers.finetuning.UpdateFinetunedModelResponse.Raw, - Cohere.finetuning.UpdateFinetunedModelResponse -> = core.serialization.object({ - finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), -}); - -export declare namespace UpdateFinetunedModelResponse { - interface Raw { - finetuned_model?: FinetunedModel.Raw | null; - } -} diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts b/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts deleted file mode 100644 index e916ced0..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/WandbConfig.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 deleted file mode 100644 index cadba814..00000000 --- a/src/serialization/resources/finetuning/resources/finetuning/types/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from "./BaseType"; -export * from "./Strategy"; -export * from "./BaseModel"; -export * from "./LoraTargetModules"; -export * from "./Hyperparameters"; -export * from "./WandbConfig"; -export * from "./Settings"; -export * from "./Status"; -export * from "./FinetunedModel"; -export * from "./ListFinetunedModelsResponse"; -export * from "./CreateFinetunedModelResponse"; -export * from "./GetFinetunedModelResponse"; -export * from "./DeleteFinetunedModelResponse"; -export * from "./UpdateFinetunedModelResponse"; -export * from "./Event"; -export * from "./ListEventsResponse"; -export * from "./TrainingStepMetrics"; -export * from "./ListTrainingStepMetricsResponse"; diff --git a/src/serialization/resources/finetuning/resources/index.ts b/src/serialization/resources/finetuning/resources/index.ts deleted file mode 100644 index 1341eba9..00000000 --- a/src/serialization/resources/finetuning/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * as finetuning from "./finetuning"; -export * from "./finetuning/types"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts deleted file mode 100644 index 4967042c..00000000 --- a/src/serialization/resources/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -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"; -export * from "./finetuning/client/requests"; diff --git a/src/serialization/resources/v2/client/index.ts b/src/serialization/resources/v2/client/index.ts deleted file mode 100644 index 415726b7..00000000 --- a/src/serialization/resources/v2/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/v2/client/requests/V2ChatRequest.ts b/src/serialization/resources/v2/client/requests/V2ChatRequest.ts deleted file mode 100644 index 0c8df01f..00000000 --- a/src/serialization/resources/v2/client/requests/V2ChatRequest.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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 { ToolV2 } from "../../../../types/ToolV2"; -import { V2ChatRequestDocumentsItem } from "../../types/V2ChatRequestDocumentsItem"; -import { CitationOptions } from "../../../../types/CitationOptions"; -import { ResponseFormatV2 } from "../../../../types/ResponseFormatV2"; -import { V2ChatRequestSafetyMode } from "../../types/V2ChatRequestSafetyMode"; -import { V2ChatRequestToolChoice } from "../../types/V2ChatRequestToolChoice"; -import { ChatMessageV2 } from "../../../../types/ChatMessageV2"; - -export const V2ChatRequest: core.serialization.Schema = - core.serialization.object({ - model: core.serialization.string(), - messages: ChatMessages, - tools: core.serialization.list(ToolV2).optional(), - strictTools: core.serialization.property("strict_tools", core.serialization.boolean().optional()), - documents: core.serialization.list(V2ChatRequestDocumentsItem).optional(), - citationOptions: core.serialization.property("citation_options", CitationOptions.optional()), - responseFormat: core.serialization.property("response_format", ResponseFormatV2.optional()), - safetyMode: core.serialization.property("safety_mode", V2ChatRequestSafetyMode.optional()), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).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()), - logprobs: core.serialization.boolean().optional(), - toolChoice: core.serialization.property("tool_choice", V2ChatRequestToolChoice.optional()), - }); - -export declare namespace V2ChatRequest { - interface Raw { - model: string; - messages: ChatMessages.Raw; - tools?: ToolV2.Raw[] | null; - strict_tools?: boolean | null; - documents?: V2ChatRequestDocumentsItem.Raw[] | null; - citation_options?: CitationOptions.Raw | null; - response_format?: ResponseFormatV2.Raw | null; - safety_mode?: V2ChatRequestSafetyMode.Raw | null; - max_tokens?: number | null; - stop_sequences?: string[] | 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; - logprobs?: boolean | null; - tool_choice?: V2ChatRequestToolChoice.Raw | null; - } -} diff --git a/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts b/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts deleted file mode 100644 index 02e2586a..00000000 --- a/src/serialization/resources/v2/client/requests/V2ChatStreamRequest.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * 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 { ToolV2 } from "../../../../types/ToolV2"; -import { V2ChatStreamRequestDocumentsItem } from "../../types/V2ChatStreamRequestDocumentsItem"; -import { CitationOptions } from "../../../../types/CitationOptions"; -import { ResponseFormatV2 } from "../../../../types/ResponseFormatV2"; -import { V2ChatStreamRequestSafetyMode } from "../../types/V2ChatStreamRequestSafetyMode"; -import { V2ChatStreamRequestToolChoice } from "../../types/V2ChatStreamRequestToolChoice"; -import { ChatMessageV2 } from "../../../../types/ChatMessageV2"; - -export const V2ChatStreamRequest: core.serialization.Schema< - serializers.V2ChatStreamRequest.Raw, - Cohere.V2ChatStreamRequest -> = core.serialization.object({ - model: core.serialization.string(), - messages: ChatMessages, - tools: core.serialization.list(ToolV2).optional(), - strictTools: core.serialization.property("strict_tools", core.serialization.boolean().optional()), - documents: core.serialization.list(V2ChatStreamRequestDocumentsItem).optional(), - citationOptions: core.serialization.property("citation_options", CitationOptions.optional()), - responseFormat: core.serialization.property("response_format", ResponseFormatV2.optional()), - safetyMode: core.serialization.property("safety_mode", V2ChatStreamRequestSafetyMode.optional()), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - stopSequences: core.serialization.property( - "stop_sequences", - core.serialization.list(core.serialization.string()).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()), - logprobs: core.serialization.boolean().optional(), - toolChoice: core.serialization.property("tool_choice", V2ChatStreamRequestToolChoice.optional()), -}); - -export declare namespace V2ChatStreamRequest { - interface Raw { - model: string; - messages: ChatMessages.Raw; - tools?: ToolV2.Raw[] | null; - strict_tools?: boolean | null; - documents?: V2ChatStreamRequestDocumentsItem.Raw[] | null; - citation_options?: CitationOptions.Raw | null; - response_format?: ResponseFormatV2.Raw | null; - safety_mode?: V2ChatStreamRequestSafetyMode.Raw | null; - max_tokens?: number | null; - stop_sequences?: string[] | 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; - logprobs?: boolean | null; - tool_choice?: V2ChatStreamRequestToolChoice.Raw | null; - } -} diff --git a/src/serialization/resources/v2/client/requests/V2EmbedRequest.ts b/src/serialization/resources/v2/client/requests/V2EmbedRequest.ts deleted file mode 100644 index 03f467e8..00000000 --- a/src/serialization/resources/v2/client/requests/V2EmbedRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 { EmbedInputType } from "../../../../types/EmbedInputType"; -import { EmbedInput } from "../../../../types/EmbedInput"; -import { EmbeddingType } from "../../../../types/EmbeddingType"; -import { V2EmbedRequestTruncate } from "../../types/V2EmbedRequestTruncate"; - -export const V2EmbedRequest: core.serialization.Schema = - core.serialization.object({ - texts: core.serialization.list(core.serialization.string()).optional(), - images: core.serialization.list(core.serialization.string()).optional(), - model: core.serialization.string(), - inputType: core.serialization.property("input_type", EmbedInputType), - inputs: core.serialization.list(EmbedInput).optional(), - maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), - outputDimension: core.serialization.property("output_dimension", core.serialization.number().optional()), - embeddingTypes: core.serialization.property("embedding_types", core.serialization.list(EmbeddingType)), - truncate: V2EmbedRequestTruncate.optional(), - }); - -export declare namespace V2EmbedRequest { - interface Raw { - texts?: string[] | null; - images?: string[] | null; - model: string; - input_type: EmbedInputType.Raw; - inputs?: EmbedInput.Raw[] | null; - max_tokens?: number | null; - output_dimension?: number | null; - embedding_types: EmbeddingType.Raw[]; - truncate?: V2EmbedRequestTruncate.Raw | null; - } -} diff --git a/src/serialization/resources/v2/client/requests/V2RerankRequest.ts b/src/serialization/resources/v2/client/requests/V2RerankRequest.ts deleted file mode 100644 index c5e793fd..00000000 --- a/src/serialization/resources/v2/client/requests/V2RerankRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 V2RerankRequest: core.serialization.Schema = - core.serialization.object({ - model: core.serialization.string(), - query: core.serialization.string(), - documents: core.serialization.list(core.serialization.string()), - topN: core.serialization.property("top_n", core.serialization.number().optional()), - returnDocuments: core.serialization.property("return_documents", core.serialization.boolean().optional()), - maxTokensPerDoc: core.serialization.property("max_tokens_per_doc", core.serialization.number().optional()), - }); - -export declare namespace V2RerankRequest { - interface Raw { - model: string; - query: string; - documents: string[]; - top_n?: number | null; - return_documents?: boolean | null; - max_tokens_per_doc?: number | null; - } -} diff --git a/src/serialization/resources/v2/client/requests/index.ts b/src/serialization/resources/v2/client/requests/index.ts deleted file mode 100644 index 5196f80a..00000000 --- a/src/serialization/resources/v2/client/requests/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { V2ChatStreamRequest } from "./V2ChatStreamRequest"; -export { V2ChatRequest } from "./V2ChatRequest"; -export { V2EmbedRequest } from "./V2EmbedRequest"; -export { V2RerankRequest } from "./V2RerankRequest"; diff --git a/src/serialization/resources/v2/index.ts b/src/serialization/resources/v2/index.ts deleted file mode 100644 index c9240f83..00000000 --- a/src/serialization/resources/v2/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types"; -export * from "./client"; diff --git a/src/serialization/resources/v2/types/V2ChatRequestDocumentsItem.ts b/src/serialization/resources/v2/types/V2ChatRequestDocumentsItem.ts deleted file mode 100644 index 1c8ccf03..00000000 --- a/src/serialization/resources/v2/types/V2ChatRequestDocumentsItem.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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 { Document } from "../../../types/Document"; - -export const V2ChatRequestDocumentsItem: core.serialization.Schema< - serializers.V2ChatRequestDocumentsItem.Raw, - Cohere.V2ChatRequestDocumentsItem -> = core.serialization.undiscriminatedUnion([core.serialization.string(), Document]); - -export declare namespace V2ChatRequestDocumentsItem { - type Raw = string | Document.Raw; -} diff --git a/src/serialization/resources/v2/types/V2ChatRequestSafetyMode.ts b/src/serialization/resources/v2/types/V2ChatRequestSafetyMode.ts deleted file mode 100644 index 477374ba..00000000 --- a/src/serialization/resources/v2/types/V2ChatRequestSafetyMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 V2ChatRequestSafetyMode: core.serialization.Schema< - serializers.V2ChatRequestSafetyMode.Raw, - Cohere.V2ChatRequestSafetyMode -> = core.serialization.enum_(["CONTEXTUAL", "STRICT", "OFF"]); - -export declare namespace V2ChatRequestSafetyMode { - type Raw = "CONTEXTUAL" | "STRICT" | "OFF"; -} diff --git a/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts b/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts deleted file mode 100644 index 2b35a762..00000000 --- a/src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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_(["REQUIRED", "NONE"]); - -export declare namespace V2ChatRequestToolChoice { - type Raw = "REQUIRED" | "NONE"; -} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts deleted file mode 100644 index 5df00314..00000000 --- a/src/serialization/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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 { Document } from "../../../types/Document"; - -export const V2ChatStreamRequestDocumentsItem: core.serialization.Schema< - serializers.V2ChatStreamRequestDocumentsItem.Raw, - Cohere.V2ChatStreamRequestDocumentsItem -> = core.serialization.undiscriminatedUnion([core.serialization.string(), Document]); - -export declare namespace V2ChatStreamRequestDocumentsItem { - type Raw = string | Document.Raw; -} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestSafetyMode.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestSafetyMode.ts deleted file mode 100644 index 7630241d..00000000 --- a/src/serialization/resources/v2/types/V2ChatStreamRequestSafetyMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 V2ChatStreamRequestSafetyMode: core.serialization.Schema< - serializers.V2ChatStreamRequestSafetyMode.Raw, - Cohere.V2ChatStreamRequestSafetyMode -> = core.serialization.enum_(["CONTEXTUAL", "STRICT", "OFF"]); - -export declare namespace V2ChatStreamRequestSafetyMode { - type Raw = "CONTEXTUAL" | "STRICT" | "OFF"; -} diff --git a/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts b/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts deleted file mode 100644 index a1a91053..00000000 --- a/src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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_(["REQUIRED", "NONE"]); - -export declare namespace V2ChatStreamRequestToolChoice { - type Raw = "REQUIRED" | "NONE"; -} diff --git a/src/serialization/resources/v2/types/V2EmbedRequestTruncate.ts b/src/serialization/resources/v2/types/V2EmbedRequestTruncate.ts deleted file mode 100644 index 035e7495..00000000 --- a/src/serialization/resources/v2/types/V2EmbedRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 V2EmbedRequestTruncate: core.serialization.Schema< - serializers.V2EmbedRequestTruncate.Raw, - Cohere.V2EmbedRequestTruncate -> = core.serialization.enum_(["NONE", "START", "END"]); - -export declare namespace V2EmbedRequestTruncate { - type Raw = "NONE" | "START" | "END"; -} diff --git a/src/serialization/resources/v2/types/V2RerankResponse.ts b/src/serialization/resources/v2/types/V2RerankResponse.ts deleted file mode 100644 index 9cc54a8b..00000000 --- a/src/serialization/resources/v2/types/V2RerankResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { V2RerankResponseResultsItem } from "./V2RerankResponseResultsItem"; -import { ApiMeta } from "../../../types/ApiMeta"; - -export const V2RerankResponse: core.serialization.ObjectSchema< - serializers.V2RerankResponse.Raw, - Cohere.V2RerankResponse -> = core.serialization.object({ - id: core.serialization.string().optional(), - results: core.serialization.list(V2RerankResponseResultsItem), - meta: ApiMeta.optional(), -}); - -export declare namespace V2RerankResponse { - interface Raw { - id?: string | null; - results: V2RerankResponseResultsItem.Raw[]; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/resources/v2/types/V2RerankResponseResultsItem.ts b/src/serialization/resources/v2/types/V2RerankResponseResultsItem.ts deleted file mode 100644 index 4eaad344..00000000 --- a/src/serialization/resources/v2/types/V2RerankResponseResultsItem.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { V2RerankResponseResultsItemDocument } from "./V2RerankResponseResultsItemDocument"; - -export const V2RerankResponseResultsItem: core.serialization.ObjectSchema< - serializers.V2RerankResponseResultsItem.Raw, - Cohere.V2RerankResponseResultsItem -> = core.serialization.object({ - document: V2RerankResponseResultsItemDocument.optional(), - index: core.serialization.number(), - relevanceScore: core.serialization.property("relevance_score", core.serialization.number()), -}); - -export declare namespace V2RerankResponseResultsItem { - interface Raw { - document?: V2RerankResponseResultsItemDocument.Raw | null; - index: number; - relevance_score: number; - } -} diff --git a/src/serialization/resources/v2/types/V2RerankResponseResultsItemDocument.ts b/src/serialization/resources/v2/types/V2RerankResponseResultsItemDocument.ts deleted file mode 100644 index 360f3b58..00000000 --- a/src/serialization/resources/v2/types/V2RerankResponseResultsItemDocument.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 V2RerankResponseResultsItemDocument: core.serialization.ObjectSchema< - serializers.V2RerankResponseResultsItemDocument.Raw, - Cohere.V2RerankResponseResultsItemDocument -> = core.serialization.object({ - text: core.serialization.string(), -}); - -export declare namespace V2RerankResponseResultsItemDocument { - interface Raw { - text: string; - } -} diff --git a/src/serialization/resources/v2/types/index.ts b/src/serialization/resources/v2/types/index.ts deleted file mode 100644 index 56d3128e..00000000 --- a/src/serialization/resources/v2/types/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from "./V2ChatStreamRequestDocumentsItem"; -export * from "./V2ChatStreamRequestSafetyMode"; -export * from "./V2ChatStreamRequestToolChoice"; -export * from "./V2ChatRequestDocumentsItem"; -export * from "./V2ChatRequestSafetyMode"; -export * from "./V2ChatRequestToolChoice"; -export * from "./V2EmbedRequestTruncate"; -export * from "./V2RerankResponseResultsItemDocument"; -export * from "./V2RerankResponseResultsItem"; -export * from "./V2RerankResponse"; diff --git a/src/serialization/types/ApiMeta.ts b/src/serialization/types/ApiMeta.ts deleted file mode 100644 index c827ccb4..00000000 --- a/src/serialization/types/ApiMeta.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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 { ApiMetaApiVersion } from "./ApiMetaApiVersion"; -import { ApiMetaBilledUnits } from "./ApiMetaBilledUnits"; -import { ApiMetaTokens } from "./ApiMetaTokens"; - -export const ApiMeta: core.serialization.ObjectSchema = - core.serialization.object({ - apiVersion: core.serialization.property("api_version", ApiMetaApiVersion.optional()), - billedUnits: core.serialization.property("billed_units", ApiMetaBilledUnits.optional()), - tokens: ApiMetaTokens.optional(), - warnings: core.serialization.list(core.serialization.string()).optional(), - }); - -export declare namespace ApiMeta { - interface Raw { - api_version?: ApiMetaApiVersion.Raw | null; - billed_units?: ApiMetaBilledUnits.Raw | null; - tokens?: ApiMetaTokens.Raw | null; - warnings?: string[] | null; - } -} diff --git a/src/serialization/types/ApiMetaApiVersion.ts b/src/serialization/types/ApiMetaApiVersion.ts deleted file mode 100644 index bc46294c..00000000 --- a/src/serialization/types/ApiMetaApiVersion.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 ApiMetaApiVersion: core.serialization.ObjectSchema< - serializers.ApiMetaApiVersion.Raw, - Cohere.ApiMetaApiVersion -> = core.serialization.object({ - version: core.serialization.string(), - isDeprecated: core.serialization.property("is_deprecated", core.serialization.boolean().optional()), - isExperimental: core.serialization.property("is_experimental", core.serialization.boolean().optional()), -}); - -export declare namespace ApiMetaApiVersion { - interface Raw { - version: string; - is_deprecated?: boolean | null; - is_experimental?: boolean | null; - } -} diff --git a/src/serialization/types/ApiMetaBilledUnits.ts b/src/serialization/types/ApiMetaBilledUnits.ts deleted file mode 100644 index 68d827b0..00000000 --- a/src/serialization/types/ApiMetaBilledUnits.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 ApiMetaBilledUnits: core.serialization.ObjectSchema< - serializers.ApiMetaBilledUnits.Raw, - Cohere.ApiMetaBilledUnits -> = core.serialization.object({ - images: core.serialization.number().optional(), - 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 ApiMetaBilledUnits { - interface Raw { - images?: number | null; - input_tokens?: number | null; - output_tokens?: number | null; - search_units?: number | null; - classifications?: number | null; - } -} diff --git a/src/serialization/types/ApiMetaTokens.ts b/src/serialization/types/ApiMetaTokens.ts deleted file mode 100644 index 69a9bb4a..00000000 --- a/src/serialization/types/ApiMetaTokens.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ApiMetaTokens: 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 ApiMetaTokens { - interface Raw { - input_tokens?: number | null; - output_tokens?: number | null; - } -} diff --git a/src/serialization/types/AssistantMessage.ts b/src/serialization/types/AssistantMessage.ts deleted file mode 100644 index e95e99f8..00000000 --- a/src/serialization/types/AssistantMessage.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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 { ToolCallV2 } from "./ToolCallV2"; -import { AssistantMessageContent } from "./AssistantMessageContent"; -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(ToolCallV2).optional()), - toolPlan: core.serialization.property("tool_plan", core.serialization.string().optional()), - content: AssistantMessageContent.optional(), - citations: core.serialization.list(Citation).optional(), -}); - -export declare namespace AssistantMessage { - interface Raw { - tool_calls?: ToolCallV2.Raw[] | null; - tool_plan?: string | null; - content?: AssistantMessageContent.Raw | null; - citations?: Citation.Raw[] | null; - } -} diff --git a/src/serialization/types/AssistantMessageContent.ts b/src/serialization/types/AssistantMessageContent.ts deleted file mode 100644 index 60de6c0c..00000000 --- a/src/serialization/types/AssistantMessageContent.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 { AssistantMessageContentItem } from "./AssistantMessageContentItem"; - -export const AssistantMessageContent: core.serialization.Schema< - serializers.AssistantMessageContent.Raw, - Cohere.AssistantMessageContent -> = core.serialization.undiscriminatedUnion([ - core.serialization.string(), - core.serialization.list(AssistantMessageContentItem), -]); - -export declare namespace AssistantMessageContent { - type Raw = string | AssistantMessageContentItem.Raw[]; -} diff --git a/src/serialization/types/AssistantMessageContentItem.ts b/src/serialization/types/AssistantMessageContentItem.ts deleted file mode 100644 index 18cd1b74..00000000 --- a/src/serialization/types/AssistantMessageContentItem.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 AssistantMessageContentItem: core.serialization.Schema< - serializers.AssistantMessageContentItem.Raw, - Cohere.AssistantMessageContentItem -> = core.serialization - .union("type", { - text: TextContent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace AssistantMessageContentItem { - type Raw = AssistantMessageContentItem.Text; - - interface Text extends TextContent.Raw { - type: "text"; - } -} diff --git a/src/serialization/types/AssistantMessageResponse.ts b/src/serialization/types/AssistantMessageResponse.ts deleted file mode 100644 index 9feb3d29..00000000 --- a/src/serialization/types/AssistantMessageResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 { ToolCallV2 } from "./ToolCallV2"; -import { AssistantMessageResponseContentItem } from "./AssistantMessageResponseContentItem"; -import { Citation } from "./Citation"; - -export const AssistantMessageResponse: core.serialization.ObjectSchema< - serializers.AssistantMessageResponse.Raw, - Cohere.AssistantMessageResponse -> = core.serialization.object({ - role: core.serialization.stringLiteral("assistant"), - toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCallV2).optional()), - toolPlan: core.serialization.property("tool_plan", core.serialization.string().optional()), - content: core.serialization.list(AssistantMessageResponseContentItem).optional(), - citations: core.serialization.list(Citation).optional(), -}); - -export declare namespace AssistantMessageResponse { - interface Raw { - role: "assistant"; - tool_calls?: ToolCallV2.Raw[] | null; - tool_plan?: string | null; - content?: AssistantMessageResponseContentItem.Raw[] | null; - citations?: Citation.Raw[] | null; - } -} diff --git a/src/serialization/types/AssistantMessageResponseContentItem.ts b/src/serialization/types/AssistantMessageResponseContentItem.ts deleted file mode 100644 index 0ffa3166..00000000 --- a/src/serialization/types/AssistantMessageResponseContentItem.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 AssistantMessageResponseContentItem: core.serialization.Schema< - serializers.AssistantMessageResponseContentItem.Raw, - Cohere.AssistantMessageResponseContentItem -> = core.serialization - .union("type", { - text: TextContent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace AssistantMessageResponseContentItem { - type Raw = AssistantMessageResponseContentItem.Text; - - interface Text extends TextContent.Raw { - type: "text"; - } -} diff --git a/src/serialization/types/AuthTokenType.ts b/src/serialization/types/AuthTokenType.ts deleted file mode 100644 index e1ed5894..00000000 --- a/src/serialization/types/AuthTokenType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 AuthTokenType: core.serialization.Schema = - core.serialization.enum_(["bearer", "basic", "noscheme"]); - -export declare namespace AuthTokenType { - type Raw = "bearer" | "basic" | "noscheme"; -} diff --git a/src/serialization/types/ChatCitation.ts b/src/serialization/types/ChatCitation.ts deleted file mode 100644 index 3dbe233a..00000000 --- a/src/serialization/types/ChatCitation.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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 { ChatCitationType } from "./ChatCitationType"; - -export const ChatCitation: core.serialization.ObjectSchema = - core.serialization.object({ - start: core.serialization.number(), - end: core.serialization.number(), - text: core.serialization.string(), - documentIds: core.serialization.property("document_ids", core.serialization.list(core.serialization.string())), - type: ChatCitationType.optional(), - }); - -export declare namespace ChatCitation { - interface Raw { - start: number; - end: number; - text: string; - document_ids: string[]; - type?: ChatCitationType.Raw | null; - } -} diff --git a/src/serialization/types/ChatCitationGenerationEvent.ts b/src/serialization/types/ChatCitationGenerationEvent.ts deleted file mode 100644 index 408d1419..00000000 --- a/src/serialization/types/ChatCitationGenerationEvent.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 { ChatCitation } from "./ChatCitation"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatCitationGenerationEvent: core.serialization.ObjectSchema< - serializers.ChatCitationGenerationEvent.Raw, - Cohere.ChatCitationGenerationEvent -> = core.serialization - .object({ - citations: core.serialization.list(ChatCitation), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatCitationGenerationEvent { - interface Raw extends ChatStreamEvent.Raw { - citations: ChatCitation.Raw[]; - } -} diff --git a/src/serialization/types/ChatCitationType.ts b/src/serialization/types/ChatCitationType.ts deleted file mode 100644 index fa0c9482..00000000 --- a/src/serialization/types/ChatCitationType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 ChatCitationType: core.serialization.Schema = - core.serialization.enum_(["TEXT_CONTENT", "PLAN"]); - -export declare namespace ChatCitationType { - type Raw = "TEXT_CONTENT" | "PLAN"; -} diff --git a/src/serialization/types/ChatConnector.ts b/src/serialization/types/ChatConnector.ts deleted file mode 100644 index 5c353ab3..00000000 --- a/src/serialization/types/ChatConnector.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 ChatConnector: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - userAccessToken: core.serialization.property("user_access_token", core.serialization.string().optional()), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - options: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), - }); - -export declare namespace ChatConnector { - interface Raw { - id: string; - user_access_token?: string | null; - continue_on_failure?: boolean | null; - options?: Record | null; - } -} diff --git a/src/serialization/types/ChatContentDeltaEvent.ts b/src/serialization/types/ChatContentDeltaEvent.ts deleted file mode 100644 index ae572cfa..00000000 --- a/src/serialization/types/ChatContentDeltaEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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 { LogprobItem } from "./LogprobItem"; -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(), - logprobs: LogprobItem.optional(), - }) - .extend(ChatStreamEventType); - -export declare namespace ChatContentDeltaEvent { - interface Raw extends ChatStreamEventType.Raw { - index?: number | null; - delta?: ChatContentDeltaEventDelta.Raw | null; - logprobs?: LogprobItem.Raw | null; - } -} diff --git a/src/serialization/types/ChatContentDeltaEventDelta.ts b/src/serialization/types/ChatContentDeltaEventDelta.ts deleted file mode 100644 index 53458f51..00000000 --- a/src/serialization/types/ChatContentDeltaEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/ChatContentDeltaEventDeltaMessage.ts b/src/serialization/types/ChatContentDeltaEventDeltaMessage.ts deleted file mode 100644 index e4454aae..00000000 --- a/src/serialization/types/ChatContentDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/ChatContentDeltaEventDeltaMessageContent.ts b/src/serialization/types/ChatContentDeltaEventDeltaMessageContent.ts deleted file mode 100644 index c857a75d..00000000 --- a/src/serialization/types/ChatContentDeltaEventDeltaMessageContent.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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/types/ChatContentEndEvent.ts b/src/serialization/types/ChatContentEndEvent.ts deleted file mode 100644 index c30f4130..00000000 --- a/src/serialization/types/ChatContentEndEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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/types/ChatContentStartEvent.ts b/src/serialization/types/ChatContentStartEvent.ts deleted file mode 100644 index edbf1bf1..00000000 --- a/src/serialization/types/ChatContentStartEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/ChatContentStartEventDelta.ts b/src/serialization/types/ChatContentStartEventDelta.ts deleted file mode 100644 index 59824a6c..00000000 --- a/src/serialization/types/ChatContentStartEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/ChatContentStartEventDeltaMessage.ts b/src/serialization/types/ChatContentStartEventDeltaMessage.ts deleted file mode 100644 index 81a62c52..00000000 --- a/src/serialization/types/ChatContentStartEventDeltaMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/ChatContentStartEventDeltaMessageContent.ts b/src/serialization/types/ChatContentStartEventDeltaMessageContent.ts deleted file mode 100644 index 75ead03e..00000000 --- a/src/serialization/types/ChatContentStartEventDeltaMessageContent.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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/types/ChatDataMetrics.ts b/src/serialization/types/ChatDataMetrics.ts deleted file mode 100644 index b99a3ef7..00000000 --- a/src/serialization/types/ChatDataMetrics.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 ChatDataMetrics: core.serialization.ObjectSchema = - core.serialization.object({ - numTrainTurns: core.serialization.property("num_train_turns", core.serialization.number().optional()), - numEvalTurns: core.serialization.property("num_eval_turns", core.serialization.number().optional()), - preamble: core.serialization.string().optional(), - }); - -export declare namespace ChatDataMetrics { - interface Raw { - num_train_turns?: number | null; - num_eval_turns?: number | null; - preamble?: string | null; - } -} diff --git a/src/serialization/types/ChatDebugEvent.ts b/src/serialization/types/ChatDebugEvent.ts deleted file mode 100644 index 5be51e4c..00000000 --- a/src/serialization/types/ChatDebugEvent.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatDebugEvent: core.serialization.ObjectSchema = - core.serialization - .object({ - prompt: core.serialization.string().optional(), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatDebugEvent { - interface Raw extends ChatStreamEvent.Raw { - prompt?: string | null; - } -} diff --git a/src/serialization/types/ChatDocument.ts b/src/serialization/types/ChatDocument.ts deleted file mode 100644 index 47fc71c9..00000000 --- a/src/serialization/types/ChatDocument.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 ChatDocument: core.serialization.Schema = - core.serialization.record(core.serialization.string(), core.serialization.string()); - -export declare namespace ChatDocument { - type Raw = Record; -} diff --git a/src/serialization/types/ChatFinishReason.ts b/src/serialization/types/ChatFinishReason.ts deleted file mode 100644 index 47a5c49d..00000000 --- a/src/serialization/types/ChatFinishReason.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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"]); - -export declare namespace ChatFinishReason { - type Raw = "COMPLETE" | "STOP_SEQUENCE" | "MAX_TOKENS" | "TOOL_CALL" | "ERROR"; -} diff --git a/src/serialization/types/ChatMessage.ts b/src/serialization/types/ChatMessage.ts deleted file mode 100644 index b4ed2300..00000000 --- a/src/serialization/types/ChatMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ToolCall } from "./ToolCall"; - -export const ChatMessage: core.serialization.ObjectSchema = - core.serialization.object({ - message: core.serialization.string(), - toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall).optional()), - }); - -export declare namespace ChatMessage { - interface Raw { - message: string; - tool_calls?: ToolCall.Raw[] | null; - } -} diff --git a/src/serialization/types/ChatMessageEndEvent.ts b/src/serialization/types/ChatMessageEndEvent.ts deleted file mode 100644 index 717293fd..00000000 --- a/src/serialization/types/ChatMessageEndEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/ChatMessageEndEventDelta.ts b/src/serialization/types/ChatMessageEndEventDelta.ts deleted file mode 100644 index 88a76398..00000000 --- a/src/serialization/types/ChatMessageEndEventDelta.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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/types/ChatMessageStartEvent.ts b/src/serialization/types/ChatMessageStartEvent.ts deleted file mode 100644 index 0b8edf78..00000000 --- a/src/serialization/types/ChatMessageStartEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/ChatMessageStartEventDelta.ts b/src/serialization/types/ChatMessageStartEventDelta.ts deleted file mode 100644 index 974588c6..00000000 --- a/src/serialization/types/ChatMessageStartEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/ChatMessageStartEventDeltaMessage.ts b/src/serialization/types/ChatMessageStartEventDeltaMessage.ts deleted file mode 100644 index 7c6df2d3..00000000 --- a/src/serialization/types/ChatMessageStartEventDeltaMessage.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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/types/ChatMessageV2.ts b/src/serialization/types/ChatMessageV2.ts deleted file mode 100644 index d28c62dc..00000000 --- a/src/serialization/types/ChatMessageV2.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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 { UserMessage } from "./UserMessage"; -import { AssistantMessage } from "./AssistantMessage"; -import { SystemMessage } from "./SystemMessage"; -import { ToolMessageV2 } from "./ToolMessageV2"; - -export const ChatMessageV2: core.serialization.Schema = - core.serialization - .union("role", { - user: UserMessage, - assistant: AssistantMessage, - system: SystemMessage, - tool: ToolMessageV2, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace ChatMessageV2 { - type Raw = ChatMessageV2.User | ChatMessageV2.Assistant | ChatMessageV2.System | ChatMessageV2.Tool; - - interface User extends UserMessage.Raw { - role: "user"; - } - - interface Assistant extends AssistantMessage.Raw { - role: "assistant"; - } - - interface System extends SystemMessage.Raw { - role: "system"; - } - - interface Tool extends ToolMessageV2.Raw { - role: "tool"; - } -} diff --git a/src/serialization/types/ChatMessages.ts b/src/serialization/types/ChatMessages.ts deleted file mode 100644 index 093c68c2..00000000 --- a/src/serialization/types/ChatMessages.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * 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 { ChatMessageV2 } from "./ChatMessageV2"; - -export const ChatMessages: core.serialization.Schema = - core.serialization.list(ChatMessageV2); - -export declare namespace ChatMessages { - type Raw = ChatMessageV2.Raw[]; -} diff --git a/src/serialization/types/ChatRequestCitationQuality.ts b/src/serialization/types/ChatRequestCitationQuality.ts deleted file mode 100644 index 89c0e5fe..00000000 --- a/src/serialization/types/ChatRequestCitationQuality.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatRequestCitationQuality: core.serialization.Schema< - serializers.ChatRequestCitationQuality.Raw, - Cohere.ChatRequestCitationQuality -> = core.serialization.enum_(["fast", "accurate", "off"]); - -export declare namespace ChatRequestCitationQuality { - type Raw = "fast" | "accurate" | "off"; -} diff --git a/src/serialization/types/ChatRequestConnectorsSearchOptions.ts b/src/serialization/types/ChatRequestConnectorsSearchOptions.ts deleted file mode 100644 index db5f7247..00000000 --- a/src/serialization/types/ChatRequestConnectorsSearchOptions.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatRequestConnectorsSearchOptions: core.serialization.ObjectSchema< - serializers.ChatRequestConnectorsSearchOptions.Raw, - Cohere.ChatRequestConnectorsSearchOptions -> = core.serialization.object({ - seed: core.serialization.number().optional(), -}); - -export declare namespace ChatRequestConnectorsSearchOptions { - interface Raw { - seed?: number | null; - } -} diff --git a/src/serialization/types/ChatRequestPromptTruncation.ts b/src/serialization/types/ChatRequestPromptTruncation.ts deleted file mode 100644 index 8374746c..00000000 --- a/src/serialization/types/ChatRequestPromptTruncation.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatRequestPromptTruncation: core.serialization.Schema< - serializers.ChatRequestPromptTruncation.Raw, - Cohere.ChatRequestPromptTruncation -> = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); - -export declare namespace ChatRequestPromptTruncation { - type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; -} diff --git a/src/serialization/types/ChatRequestSafetyMode.ts b/src/serialization/types/ChatRequestSafetyMode.ts deleted file mode 100644 index 67dedb4e..00000000 --- a/src/serialization/types/ChatRequestSafetyMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatRequestSafetyMode: core.serialization.Schema< - serializers.ChatRequestSafetyMode.Raw, - Cohere.ChatRequestSafetyMode -> = core.serialization.enum_(["CONTEXTUAL", "STRICT", "NONE"]); - -export declare namespace ChatRequestSafetyMode { - type Raw = "CONTEXTUAL" | "STRICT" | "NONE"; -} diff --git a/src/serialization/types/ChatResponse.ts b/src/serialization/types/ChatResponse.ts deleted file mode 100644 index f039507f..00000000 --- a/src/serialization/types/ChatResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { AssistantMessageResponse } from "./AssistantMessageResponse"; -import { Usage } from "./Usage"; -import { LogprobItem } from "./LogprobItem"; - -export const ChatResponse: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - finishReason: core.serialization.property("finish_reason", ChatFinishReason), - prompt: core.serialization.string().optional(), - message: AssistantMessageResponse, - usage: Usage.optional(), - logprobs: core.serialization.list(LogprobItem).optional(), - }); - -export declare namespace ChatResponse { - interface Raw { - id: string; - finish_reason: ChatFinishReason.Raw; - prompt?: string | null; - message: AssistantMessageResponse.Raw; - usage?: Usage.Raw | null; - logprobs?: LogprobItem.Raw[] | null; - } -} diff --git a/src/serialization/types/ChatSearchQueriesGenerationEvent.ts b/src/serialization/types/ChatSearchQueriesGenerationEvent.ts deleted file mode 100644 index d76cee49..00000000 --- a/src/serialization/types/ChatSearchQueriesGenerationEvent.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 { ChatSearchQuery } from "./ChatSearchQuery"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatSearchQueriesGenerationEvent: core.serialization.ObjectSchema< - serializers.ChatSearchQueriesGenerationEvent.Raw, - Cohere.ChatSearchQueriesGenerationEvent -> = core.serialization - .object({ - searchQueries: core.serialization.property("search_queries", core.serialization.list(ChatSearchQuery)), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatSearchQueriesGenerationEvent { - interface Raw extends ChatStreamEvent.Raw { - search_queries: ChatSearchQuery.Raw[]; - } -} diff --git a/src/serialization/types/ChatSearchQuery.ts b/src/serialization/types/ChatSearchQuery.ts deleted file mode 100644 index 140b4fc5..00000000 --- a/src/serialization/types/ChatSearchQuery.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatSearchQuery: core.serialization.ObjectSchema = - core.serialization.object({ - text: core.serialization.string(), - generationId: core.serialization.property("generation_id", core.serialization.string()), - }); - -export declare namespace ChatSearchQuery { - interface Raw { - text: string; - generation_id: string; - } -} diff --git a/src/serialization/types/ChatSearchResult.ts b/src/serialization/types/ChatSearchResult.ts deleted file mode 100644 index 78386b01..00000000 --- a/src/serialization/types/ChatSearchResult.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 { ChatSearchQuery } from "./ChatSearchQuery"; -import { ChatSearchResultConnector } from "./ChatSearchResultConnector"; - -export const ChatSearchResult: core.serialization.ObjectSchema< - serializers.ChatSearchResult.Raw, - Cohere.ChatSearchResult -> = core.serialization.object({ - searchQuery: core.serialization.property("search_query", ChatSearchQuery.optional()), - connector: ChatSearchResultConnector, - documentIds: core.serialization.property("document_ids", core.serialization.list(core.serialization.string())), - errorMessage: core.serialization.property("error_message", core.serialization.string().optional()), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), -}); - -export declare namespace ChatSearchResult { - interface Raw { - search_query?: ChatSearchQuery.Raw | null; - connector: ChatSearchResultConnector.Raw; - document_ids: string[]; - error_message?: string | null; - continue_on_failure?: boolean | null; - } -} diff --git a/src/serialization/types/ChatSearchResultConnector.ts b/src/serialization/types/ChatSearchResultConnector.ts deleted file mode 100644 index f8f27c11..00000000 --- a/src/serialization/types/ChatSearchResultConnector.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatSearchResultConnector: core.serialization.ObjectSchema< - serializers.ChatSearchResultConnector.Raw, - Cohere.ChatSearchResultConnector -> = core.serialization.object({ - id: core.serialization.string(), -}); - -export declare namespace ChatSearchResultConnector { - interface Raw { - id: string; - } -} diff --git a/src/serialization/types/ChatSearchResultsEvent.ts b/src/serialization/types/ChatSearchResultsEvent.ts deleted file mode 100644 index bb773eec..00000000 --- a/src/serialization/types/ChatSearchResultsEvent.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 { ChatSearchResult } from "./ChatSearchResult"; -import { ChatDocument } from "./ChatDocument"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatSearchResultsEvent: core.serialization.ObjectSchema< - serializers.ChatSearchResultsEvent.Raw, - Cohere.ChatSearchResultsEvent -> = core.serialization - .object({ - searchResults: core.serialization.property( - "search_results", - core.serialization.list(ChatSearchResult).optional() - ), - documents: core.serialization.list(ChatDocument).optional(), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatSearchResultsEvent { - interface Raw extends ChatStreamEvent.Raw { - search_results?: ChatSearchResult.Raw[] | null; - documents?: ChatDocument.Raw[] | null; - } -} diff --git a/src/serialization/types/ChatStreamEndEvent.ts b/src/serialization/types/ChatStreamEndEvent.ts deleted file mode 100644 index 56d3f7bd..00000000 --- a/src/serialization/types/ChatStreamEndEvent.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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 { ChatStreamEndEventFinishReason } from "./ChatStreamEndEventFinishReason"; -import { NonStreamedChatResponse } from "./NonStreamedChatResponse"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatStreamEndEvent: core.serialization.ObjectSchema< - serializers.ChatStreamEndEvent.Raw, - Cohere.ChatStreamEndEvent -> = core.serialization - .object({ - finishReason: core.serialization.property("finish_reason", ChatStreamEndEventFinishReason), - response: NonStreamedChatResponse, - }) - .extend(ChatStreamEvent); - -export declare namespace ChatStreamEndEvent { - interface Raw extends ChatStreamEvent.Raw { - finish_reason: ChatStreamEndEventFinishReason.Raw; - response: NonStreamedChatResponse.Raw; - } -} diff --git a/src/serialization/types/ChatStreamEndEventFinishReason.ts b/src/serialization/types/ChatStreamEndEventFinishReason.ts deleted file mode 100644 index 6c9065c2..00000000 --- a/src/serialization/types/ChatStreamEndEventFinishReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatStreamEndEventFinishReason: core.serialization.Schema< - serializers.ChatStreamEndEventFinishReason.Raw, - Cohere.ChatStreamEndEventFinishReason -> = core.serialization.enum_(["COMPLETE", "ERROR_LIMIT", "MAX_TOKENS", "ERROR", "ERROR_TOXIC"]); - -export declare namespace ChatStreamEndEventFinishReason { - type Raw = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; -} diff --git a/src/serialization/types/ChatStreamEvent.ts b/src/serialization/types/ChatStreamEvent.ts deleted file mode 100644 index bceb1cfb..00000000 --- a/src/serialization/types/ChatStreamEvent.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 ChatStreamEvent: core.serialization.ObjectSchema = - core.serialization.object({}); - -export declare namespace ChatStreamEvent { - interface Raw {} -} diff --git a/src/serialization/types/ChatStreamEventType.ts b/src/serialization/types/ChatStreamEventType.ts deleted file mode 100644 index af1fb88e..00000000 --- a/src/serialization/types/ChatStreamEventType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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/types/ChatStreamRequestCitationQuality.ts b/src/serialization/types/ChatStreamRequestCitationQuality.ts deleted file mode 100644 index 6195f281..00000000 --- a/src/serialization/types/ChatStreamRequestCitationQuality.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatStreamRequestCitationQuality: core.serialization.Schema< - serializers.ChatStreamRequestCitationQuality.Raw, - Cohere.ChatStreamRequestCitationQuality -> = core.serialization.enum_(["fast", "accurate", "off"]); - -export declare namespace ChatStreamRequestCitationQuality { - type Raw = "fast" | "accurate" | "off"; -} diff --git a/src/serialization/types/ChatStreamRequestConnectorsSearchOptions.ts b/src/serialization/types/ChatStreamRequestConnectorsSearchOptions.ts deleted file mode 100644 index 5cc02bcf..00000000 --- a/src/serialization/types/ChatStreamRequestConnectorsSearchOptions.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatStreamRequestConnectorsSearchOptions: core.serialization.ObjectSchema< - serializers.ChatStreamRequestConnectorsSearchOptions.Raw, - Cohere.ChatStreamRequestConnectorsSearchOptions -> = core.serialization.object({ - seed: core.serialization.number().optional(), -}); - -export declare namespace ChatStreamRequestConnectorsSearchOptions { - interface Raw { - seed?: number | null; - } -} diff --git a/src/serialization/types/ChatStreamRequestPromptTruncation.ts b/src/serialization/types/ChatStreamRequestPromptTruncation.ts deleted file mode 100644 index f7e627f1..00000000 --- a/src/serialization/types/ChatStreamRequestPromptTruncation.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatStreamRequestPromptTruncation: core.serialization.Schema< - serializers.ChatStreamRequestPromptTruncation.Raw, - Cohere.ChatStreamRequestPromptTruncation -> = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); - -export declare namespace ChatStreamRequestPromptTruncation { - type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; -} diff --git a/src/serialization/types/ChatStreamRequestSafetyMode.ts b/src/serialization/types/ChatStreamRequestSafetyMode.ts deleted file mode 100644 index 865052b5..00000000 --- a/src/serialization/types/ChatStreamRequestSafetyMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ChatStreamRequestSafetyMode: core.serialization.Schema< - serializers.ChatStreamRequestSafetyMode.Raw, - Cohere.ChatStreamRequestSafetyMode -> = core.serialization.enum_(["CONTEXTUAL", "STRICT", "NONE"]); - -export declare namespace ChatStreamRequestSafetyMode { - type Raw = "CONTEXTUAL" | "STRICT" | "NONE"; -} diff --git a/src/serialization/types/ChatStreamStartEvent.ts b/src/serialization/types/ChatStreamStartEvent.ts deleted file mode 100644 index 3817d4a4..00000000 --- a/src/serialization/types/ChatStreamStartEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatStreamStartEvent: core.serialization.ObjectSchema< - serializers.ChatStreamStartEvent.Raw, - Cohere.ChatStreamStartEvent -> = core.serialization - .object({ - generationId: core.serialization.property("generation_id", core.serialization.string()), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatStreamStartEvent { - interface Raw extends ChatStreamEvent.Raw { - generation_id: string; - } -} diff --git a/src/serialization/types/ChatTextGenerationEvent.ts b/src/serialization/types/ChatTextGenerationEvent.ts deleted file mode 100644 index 8419086e..00000000 --- a/src/serialization/types/ChatTextGenerationEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatTextGenerationEvent: core.serialization.ObjectSchema< - serializers.ChatTextGenerationEvent.Raw, - Cohere.ChatTextGenerationEvent -> = core.serialization - .object({ - text: core.serialization.string(), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatTextGenerationEvent { - interface Raw extends ChatStreamEvent.Raw { - text: string; - } -} diff --git a/src/serialization/types/ChatToolCallDeltaEvent.ts b/src/serialization/types/ChatToolCallDeltaEvent.ts deleted file mode 100644 index 4d1aa0d5..00000000 --- a/src/serialization/types/ChatToolCallDeltaEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/ChatToolCallDeltaEventDelta.ts b/src/serialization/types/ChatToolCallDeltaEventDelta.ts deleted file mode 100644 index d2878c06..00000000 --- a/src/serialization/types/ChatToolCallDeltaEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatToolCallDeltaEventDeltaMessage } from "./ChatToolCallDeltaEventDeltaMessage"; - -export const ChatToolCallDeltaEventDelta: core.serialization.ObjectSchema< - serializers.ChatToolCallDeltaEventDelta.Raw, - Cohere.ChatToolCallDeltaEventDelta -> = core.serialization.object({ - message: ChatToolCallDeltaEventDeltaMessage.optional(), -}); - -export declare namespace ChatToolCallDeltaEventDelta { - interface Raw { - message?: ChatToolCallDeltaEventDeltaMessage.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolCallDeltaEventDeltaMessage.ts b/src/serialization/types/ChatToolCallDeltaEventDeltaMessage.ts deleted file mode 100644 index c2f0d272..00000000 --- a/src/serialization/types/ChatToolCallDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatToolCallDeltaEventDeltaMessageToolCalls } from "./ChatToolCallDeltaEventDeltaMessageToolCalls"; - -export const ChatToolCallDeltaEventDeltaMessage: core.serialization.ObjectSchema< - serializers.ChatToolCallDeltaEventDeltaMessage.Raw, - Cohere.ChatToolCallDeltaEventDeltaMessage -> = core.serialization.object({ - toolCalls: core.serialization.property("tool_calls", ChatToolCallDeltaEventDeltaMessageToolCalls.optional()), -}); - -export declare namespace ChatToolCallDeltaEventDeltaMessage { - interface Raw { - tool_calls?: ChatToolCallDeltaEventDeltaMessageToolCalls.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts b/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts deleted file mode 100644 index 0d1bbed8..00000000 --- a/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatToolCallDeltaEventDeltaMessageToolCallsFunction } from "./ChatToolCallDeltaEventDeltaMessageToolCallsFunction"; - -export const ChatToolCallDeltaEventDeltaMessageToolCalls: core.serialization.ObjectSchema< - serializers.ChatToolCallDeltaEventDeltaMessageToolCalls.Raw, - Cohere.ChatToolCallDeltaEventDeltaMessageToolCalls -> = core.serialization.object({ - function: ChatToolCallDeltaEventDeltaMessageToolCallsFunction.optional(), -}); - -export declare namespace ChatToolCallDeltaEventDeltaMessageToolCalls { - interface Raw { - function?: ChatToolCallDeltaEventDeltaMessageToolCallsFunction.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts b/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts deleted file mode 100644 index a12aa956..00000000 --- a/src/serialization/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatToolCallDeltaEventDeltaMessageToolCallsFunction: core.serialization.ObjectSchema< - serializers.ChatToolCallDeltaEventDeltaMessageToolCallsFunction.Raw, - Cohere.ChatToolCallDeltaEventDeltaMessageToolCallsFunction -> = core.serialization.object({ - arguments: core.serialization.string().optional(), -}); - -export declare namespace ChatToolCallDeltaEventDeltaMessageToolCallsFunction { - interface Raw { - arguments?: string | null; - } -} diff --git a/src/serialization/types/ChatToolCallEndEvent.ts b/src/serialization/types/ChatToolCallEndEvent.ts deleted file mode 100644 index b58b84bc..00000000 --- a/src/serialization/types/ChatToolCallEndEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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/types/ChatToolCallStartEvent.ts b/src/serialization/types/ChatToolCallStartEvent.ts deleted file mode 100644 index c68ab802..00000000 --- a/src/serialization/types/ChatToolCallStartEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/ChatToolCallStartEventDelta.ts b/src/serialization/types/ChatToolCallStartEventDelta.ts deleted file mode 100644 index 39e74f9e..00000000 --- a/src/serialization/types/ChatToolCallStartEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatToolCallStartEventDeltaMessage } from "./ChatToolCallStartEventDeltaMessage"; - -export const ChatToolCallStartEventDelta: core.serialization.ObjectSchema< - serializers.ChatToolCallStartEventDelta.Raw, - Cohere.ChatToolCallStartEventDelta -> = core.serialization.object({ - message: ChatToolCallStartEventDeltaMessage.optional(), -}); - -export declare namespace ChatToolCallStartEventDelta { - interface Raw { - message?: ChatToolCallStartEventDeltaMessage.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolCallStartEventDeltaMessage.ts b/src/serialization/types/ChatToolCallStartEventDeltaMessage.ts deleted file mode 100644 index bd75844b..00000000 --- a/src/serialization/types/ChatToolCallStartEventDeltaMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ToolCallV2 } from "./ToolCallV2"; - -export const ChatToolCallStartEventDeltaMessage: core.serialization.ObjectSchema< - serializers.ChatToolCallStartEventDeltaMessage.Raw, - Cohere.ChatToolCallStartEventDeltaMessage -> = core.serialization.object({ - toolCalls: core.serialization.property("tool_calls", ToolCallV2.optional()), -}); - -export declare namespace ChatToolCallStartEventDeltaMessage { - interface Raw { - tool_calls?: ToolCallV2.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolCallsChunkEvent.ts b/src/serialization/types/ChatToolCallsChunkEvent.ts deleted file mode 100644 index 4c64789f..00000000 --- a/src/serialization/types/ChatToolCallsChunkEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { ToolCallDelta } from "./ToolCallDelta"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatToolCallsChunkEvent: core.serialization.ObjectSchema< - serializers.ChatToolCallsChunkEvent.Raw, - Cohere.ChatToolCallsChunkEvent -> = core.serialization - .object({ - toolCallDelta: core.serialization.property("tool_call_delta", ToolCallDelta), - text: core.serialization.string().optional(), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatToolCallsChunkEvent { - interface Raw extends ChatStreamEvent.Raw { - tool_call_delta: ToolCallDelta.Raw; - text?: string | null; - } -} diff --git a/src/serialization/types/ChatToolCallsGenerationEvent.ts b/src/serialization/types/ChatToolCallsGenerationEvent.ts deleted file mode 100644 index 4009bdaf..00000000 --- a/src/serialization/types/ChatToolCallsGenerationEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { ToolCall } from "./ToolCall"; -import { ChatStreamEvent } from "./ChatStreamEvent"; - -export const ChatToolCallsGenerationEvent: core.serialization.ObjectSchema< - serializers.ChatToolCallsGenerationEvent.Raw, - Cohere.ChatToolCallsGenerationEvent -> = core.serialization - .object({ - text: core.serialization.string().optional(), - toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall)), - }) - .extend(ChatStreamEvent); - -export declare namespace ChatToolCallsGenerationEvent { - interface Raw extends ChatStreamEvent.Raw { - text?: string | null; - tool_calls: ToolCall.Raw[]; - } -} diff --git a/src/serialization/types/ChatToolPlanDeltaEvent.ts b/src/serialization/types/ChatToolPlanDeltaEvent.ts deleted file mode 100644 index f5dd81b6..00000000 --- a/src/serialization/types/ChatToolPlanDeltaEvent.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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/types/ChatToolPlanDeltaEventDelta.ts b/src/serialization/types/ChatToolPlanDeltaEventDelta.ts deleted file mode 100644 index f1cee81f..00000000 --- a/src/serialization/types/ChatToolPlanDeltaEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ChatToolPlanDeltaEventDeltaMessage } from "./ChatToolPlanDeltaEventDeltaMessage"; - -export const ChatToolPlanDeltaEventDelta: core.serialization.ObjectSchema< - serializers.ChatToolPlanDeltaEventDelta.Raw, - Cohere.ChatToolPlanDeltaEventDelta -> = core.serialization.object({ - message: ChatToolPlanDeltaEventDeltaMessage.optional(), -}); - -export declare namespace ChatToolPlanDeltaEventDelta { - interface Raw { - message?: ChatToolPlanDeltaEventDeltaMessage.Raw | null; - } -} diff --git a/src/serialization/types/ChatToolPlanDeltaEventDeltaMessage.ts b/src/serialization/types/ChatToolPlanDeltaEventDeltaMessage.ts deleted file mode 100644 index 057e4484..00000000 --- a/src/serialization/types/ChatToolPlanDeltaEventDeltaMessage.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ChatToolPlanDeltaEventDeltaMessage: core.serialization.ObjectSchema< - serializers.ChatToolPlanDeltaEventDeltaMessage.Raw, - Cohere.ChatToolPlanDeltaEventDeltaMessage -> = core.serialization.object({ - toolPlan: core.serialization.property("tool_plan", core.serialization.string().optional()), -}); - -export declare namespace ChatToolPlanDeltaEventDeltaMessage { - interface Raw { - tool_plan?: string | null; - } -} diff --git a/src/serialization/types/CheckApiKeyResponse.ts b/src/serialization/types/CheckApiKeyResponse.ts deleted file mode 100644 index 96d90c4d..00000000 --- a/src/serialization/types/CheckApiKeyResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 CheckApiKeyResponse: core.serialization.ObjectSchema< - serializers.CheckApiKeyResponse.Raw, - Cohere.CheckApiKeyResponse -> = core.serialization.object({ - valid: core.serialization.boolean(), - organizationId: core.serialization.property("organization_id", core.serialization.string().optional()), - ownerId: core.serialization.property("owner_id", core.serialization.string().optional()), -}); - -export declare namespace CheckApiKeyResponse { - interface Raw { - valid: boolean; - organization_id?: string | null; - owner_id?: string | null; - } -} diff --git a/src/serialization/types/Citation.ts b/src/serialization/types/Citation.ts deleted file mode 100644 index b5333173..00000000 --- a/src/serialization/types/Citation.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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"; -import { CitationType } from "./CitationType"; - -export const Citation: core.serialization.ObjectSchema = - core.serialization.object({ - start: core.serialization.number().optional(), - end: core.serialization.number().optional(), - text: core.serialization.string().optional(), - sources: core.serialization.list(Source).optional(), - type: CitationType.optional(), - }); - -export declare namespace Citation { - interface Raw { - start?: number | null; - end?: number | null; - text?: string | null; - sources?: Source.Raw[] | null; - type?: CitationType.Raw | null; - } -} diff --git a/src/serialization/types/CitationEndEvent.ts b/src/serialization/types/CitationEndEvent.ts deleted file mode 100644 index f457416b..00000000 --- a/src/serialization/types/CitationEndEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 CitationEndEvent: core.serialization.ObjectSchema< - serializers.CitationEndEvent.Raw, - Cohere.CitationEndEvent -> = core.serialization - .object({ - index: core.serialization.number().optional(), - }) - .extend(ChatStreamEventType); - -export declare namespace CitationEndEvent { - interface Raw extends ChatStreamEventType.Raw { - index?: number | null; - } -} diff --git a/src/serialization/types/CitationOptions.ts b/src/serialization/types/CitationOptions.ts deleted file mode 100644 index c36e559e..00000000 --- a/src/serialization/types/CitationOptions.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { CitationOptionsMode } from "./CitationOptionsMode"; - -export const CitationOptions: core.serialization.ObjectSchema = - core.serialization.object({ - mode: CitationOptionsMode.optional(), - }); - -export declare namespace CitationOptions { - interface Raw { - mode?: CitationOptionsMode.Raw | null; - } -} diff --git a/src/serialization/types/CitationOptionsMode.ts b/src/serialization/types/CitationOptionsMode.ts deleted file mode 100644 index cb62b75f..00000000 --- a/src/serialization/types/CitationOptionsMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 CitationOptionsMode: core.serialization.Schema< - serializers.CitationOptionsMode.Raw, - Cohere.CitationOptionsMode -> = core.serialization.enum_(["FAST", "ACCURATE", "OFF"]); - -export declare namespace CitationOptionsMode { - type Raw = "FAST" | "ACCURATE" | "OFF"; -} diff --git a/src/serialization/types/CitationStartEvent.ts b/src/serialization/types/CitationStartEvent.ts deleted file mode 100644 index 29692d41..00000000 --- a/src/serialization/types/CitationStartEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { CitationStartEventDelta } from "./CitationStartEventDelta"; -import { ChatStreamEventType } from "./ChatStreamEventType"; - -export const CitationStartEvent: core.serialization.ObjectSchema< - serializers.CitationStartEvent.Raw, - Cohere.CitationStartEvent -> = core.serialization - .object({ - index: core.serialization.number().optional(), - delta: CitationStartEventDelta.optional(), - }) - .extend(ChatStreamEventType); - -export declare namespace CitationStartEvent { - interface Raw extends ChatStreamEventType.Raw { - index?: number | null; - delta?: CitationStartEventDelta.Raw | null; - } -} diff --git a/src/serialization/types/CitationStartEventDelta.ts b/src/serialization/types/CitationStartEventDelta.ts deleted file mode 100644 index 1ca55ff6..00000000 --- a/src/serialization/types/CitationStartEventDelta.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { CitationStartEventDeltaMessage } from "./CitationStartEventDeltaMessage"; - -export const CitationStartEventDelta: core.serialization.ObjectSchema< - serializers.CitationStartEventDelta.Raw, - Cohere.CitationStartEventDelta -> = core.serialization.object({ - message: CitationStartEventDeltaMessage.optional(), -}); - -export declare namespace CitationStartEventDelta { - interface Raw { - message?: CitationStartEventDeltaMessage.Raw | null; - } -} diff --git a/src/serialization/types/CitationStartEventDeltaMessage.ts b/src/serialization/types/CitationStartEventDeltaMessage.ts deleted file mode 100644 index cb2722e4..00000000 --- a/src/serialization/types/CitationStartEventDeltaMessage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Citation } from "./Citation"; - -export const CitationStartEventDeltaMessage: core.serialization.ObjectSchema< - serializers.CitationStartEventDeltaMessage.Raw, - Cohere.CitationStartEventDeltaMessage -> = core.serialization.object({ - citations: Citation.optional(), -}); - -export declare namespace CitationStartEventDeltaMessage { - interface Raw { - citations?: Citation.Raw | null; - } -} diff --git a/src/serialization/types/CitationType.ts b/src/serialization/types/CitationType.ts deleted file mode 100644 index 14d68443..00000000 --- a/src/serialization/types/CitationType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 CitationType: core.serialization.Schema = - core.serialization.enum_(["TEXT_CONTENT", "PLAN"]); - -export declare namespace CitationType { - type Raw = "TEXT_CONTENT" | "PLAN"; -} diff --git a/src/serialization/types/ClassifyDataMetrics.ts b/src/serialization/types/ClassifyDataMetrics.ts deleted file mode 100644 index af7e53fe..00000000 --- a/src/serialization/types/ClassifyDataMetrics.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { LabelMetric } from "./LabelMetric"; - -export const ClassifyDataMetrics: core.serialization.ObjectSchema< - serializers.ClassifyDataMetrics.Raw, - Cohere.ClassifyDataMetrics -> = core.serialization.object({ - labelMetrics: core.serialization.property("label_metrics", core.serialization.list(LabelMetric).optional()), -}); - -export declare namespace ClassifyDataMetrics { - interface Raw { - label_metrics?: LabelMetric.Raw[] | null; - } -} diff --git a/src/serialization/types/ClassifyExample.ts b/src/serialization/types/ClassifyExample.ts deleted file mode 100644 index ba429473..00000000 --- a/src/serialization/types/ClassifyExample.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ClassifyExample: core.serialization.ObjectSchema = - core.serialization.object({ - text: core.serialization.string().optional(), - label: core.serialization.string().optional(), - }); - -export declare namespace ClassifyExample { - interface Raw { - text?: string | null; - label?: string | null; - } -} diff --git a/src/serialization/types/ClassifyRequestTruncate.ts b/src/serialization/types/ClassifyRequestTruncate.ts deleted file mode 100644 index 46ac7208..00000000 --- a/src/serialization/types/ClassifyRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ClassifyRequestTruncate: core.serialization.Schema< - serializers.ClassifyRequestTruncate.Raw, - Cohere.ClassifyRequestTruncate -> = core.serialization.enum_(["NONE", "START", "END"]); - -export declare namespace ClassifyRequestTruncate { - type Raw = "NONE" | "START" | "END"; -} diff --git a/src/serialization/types/ClassifyResponse.ts b/src/serialization/types/ClassifyResponse.ts deleted file mode 100644 index f69f3185..00000000 --- a/src/serialization/types/ClassifyResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { ClassifyResponseClassificationsItem } from "./ClassifyResponseClassificationsItem"; -import { ApiMeta } from "./ApiMeta"; - -export const ClassifyResponse: core.serialization.ObjectSchema< - serializers.ClassifyResponse.Raw, - Cohere.ClassifyResponse -> = core.serialization.object({ - id: core.serialization.string(), - classifications: core.serialization.list(ClassifyResponseClassificationsItem), - meta: ApiMeta.optional(), -}); - -export declare namespace ClassifyResponse { - interface Raw { - id: string; - classifications: ClassifyResponseClassificationsItem.Raw[]; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/ClassifyResponseClassificationsItem.ts b/src/serialization/types/ClassifyResponseClassificationsItem.ts deleted file mode 100644 index db9cfffe..00000000 --- a/src/serialization/types/ClassifyResponseClassificationsItem.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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 { ClassifyResponseClassificationsItemLabelsValue } from "./ClassifyResponseClassificationsItemLabelsValue"; -import { ClassifyResponseClassificationsItemClassificationType } from "./ClassifyResponseClassificationsItemClassificationType"; - -export const ClassifyResponseClassificationsItem: core.serialization.ObjectSchema< - serializers.ClassifyResponseClassificationsItem.Raw, - Cohere.ClassifyResponseClassificationsItem -> = core.serialization.object({ - id: core.serialization.string(), - input: core.serialization.string().optional(), - prediction: core.serialization.string().optional(), - predictions: core.serialization.list(core.serialization.string()), - confidence: core.serialization.number().optional(), - confidences: core.serialization.list(core.serialization.number()), - labels: core.serialization.record(core.serialization.string(), ClassifyResponseClassificationsItemLabelsValue), - classificationType: core.serialization.property( - "classification_type", - ClassifyResponseClassificationsItemClassificationType - ), -}); - -export declare namespace ClassifyResponseClassificationsItem { - interface Raw { - id: string; - input?: string | null; - prediction?: string | null; - predictions: string[]; - confidence?: number | null; - confidences: number[]; - labels: Record; - classification_type: ClassifyResponseClassificationsItemClassificationType.Raw; - } -} diff --git a/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts b/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts deleted file mode 100644 index 1e559667..00000000 --- a/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ClassifyResponseClassificationsItemClassificationType: core.serialization.Schema< - serializers.ClassifyResponseClassificationsItemClassificationType.Raw, - Cohere.ClassifyResponseClassificationsItemClassificationType -> = core.serialization.enum_(["single-label", "multi-label"]); - -export declare namespace ClassifyResponseClassificationsItemClassificationType { - type Raw = "single-label" | "multi-label"; -} diff --git a/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts b/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts deleted file mode 100644 index 5c2b1f54..00000000 --- a/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ClassifyResponseClassificationsItemLabelsValue: core.serialization.ObjectSchema< - serializers.ClassifyResponseClassificationsItemLabelsValue.Raw, - Cohere.ClassifyResponseClassificationsItemLabelsValue -> = core.serialization.object({ - confidence: core.serialization.number().optional(), -}); - -export declare namespace ClassifyResponseClassificationsItemLabelsValue { - interface Raw { - confidence?: number | null; - } -} diff --git a/src/serialization/types/CompatibleEndpoint.ts b/src/serialization/types/CompatibleEndpoint.ts deleted file mode 100644 index 5418c8ae..00000000 --- a/src/serialization/types/CompatibleEndpoint.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 CompatibleEndpoint: core.serialization.Schema< - serializers.CompatibleEndpoint.Raw, - Cohere.CompatibleEndpoint -> = core.serialization.enum_(["chat", "embed", "classify", "summarize", "rerank", "rate", "generate"]); - -export declare namespace CompatibleEndpoint { - type Raw = "chat" | "embed" | "classify" | "summarize" | "rerank" | "rate" | "generate"; -} diff --git a/src/serialization/types/Connector.ts b/src/serialization/types/Connector.ts deleted file mode 100644 index bf2f36cd..00000000 --- a/src/serialization/types/Connector.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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 { ConnectorOAuth } from "./ConnectorOAuth"; -import { ConnectorAuthStatus } from "./ConnectorAuthStatus"; - -export const Connector: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - organizationId: core.serialization.property("organization_id", core.serialization.string().optional()), - name: core.serialization.string(), - description: core.serialization.string().optional(), - url: core.serialization.string().optional(), - createdAt: core.serialization.property("created_at", core.serialization.date()), - updatedAt: core.serialization.property("updated_at", core.serialization.date()), - excludes: core.serialization.list(core.serialization.string()).optional(), - authType: core.serialization.property("auth_type", core.serialization.string().optional()), - oauth: ConnectorOAuth.optional(), - authStatus: core.serialization.property("auth_status", ConnectorAuthStatus.optional()), - active: core.serialization.boolean().optional(), - continueOnFailure: core.serialization.property("continue_on_failure", core.serialization.boolean().optional()), - }); - -export declare namespace Connector { - interface Raw { - id: string; - organization_id?: string | null; - name: string; - description?: string | null; - url?: string | null; - created_at: string; - updated_at: string; - excludes?: string[] | null; - auth_type?: string | null; - oauth?: ConnectorOAuth.Raw | null; - auth_status?: ConnectorAuthStatus.Raw | null; - active?: boolean | null; - continue_on_failure?: boolean | null; - } -} diff --git a/src/serialization/types/ConnectorAuthStatus.ts b/src/serialization/types/ConnectorAuthStatus.ts deleted file mode 100644 index d97f2e24..00000000 --- a/src/serialization/types/ConnectorAuthStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 ConnectorAuthStatus: core.serialization.Schema< - serializers.ConnectorAuthStatus.Raw, - Cohere.ConnectorAuthStatus -> = core.serialization.enum_(["valid", "expired"]); - -export declare namespace ConnectorAuthStatus { - type Raw = "valid" | "expired"; -} diff --git a/src/serialization/types/ConnectorOAuth.ts b/src/serialization/types/ConnectorOAuth.ts deleted file mode 100644 index 2c6b6df9..00000000 --- a/src/serialization/types/ConnectorOAuth.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 ConnectorOAuth: core.serialization.ObjectSchema = - core.serialization.object({ - clientId: core.serialization.property("client_id", core.serialization.string().optional()), - clientSecret: core.serialization.property("client_secret", core.serialization.string().optional()), - authorizeUrl: core.serialization.property("authorize_url", core.serialization.string()), - tokenUrl: core.serialization.property("token_url", core.serialization.string()), - scope: core.serialization.string().optional(), - }); - -export declare namespace ConnectorOAuth { - interface Raw { - client_id?: string | null; - client_secret?: string | null; - authorize_url: string; - token_url: string; - scope?: string | null; - } -} diff --git a/src/serialization/types/Content.ts b/src/serialization/types/Content.ts deleted file mode 100644 index ad51834d..00000000 --- a/src/serialization/types/Content.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 { ImageContent } from "./ImageContent"; - -export const Content: core.serialization.Schema = core.serialization - .union("type", { - text: TextContent, - image_url: ImageContent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace Content { - type Raw = Content.Text | Content.ImageUrl; - - interface Text extends TextContent.Raw { - type: "text"; - } - - interface ImageUrl extends ImageContent.Raw { - type: "image_url"; - } -} diff --git a/src/serialization/types/CreateConnectorOAuth.ts b/src/serialization/types/CreateConnectorOAuth.ts deleted file mode 100644 index 620d35da..00000000 --- a/src/serialization/types/CreateConnectorOAuth.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 CreateConnectorOAuth: core.serialization.ObjectSchema< - serializers.CreateConnectorOAuth.Raw, - Cohere.CreateConnectorOAuth -> = core.serialization.object({ - clientId: core.serialization.property("client_id", core.serialization.string().optional()), - clientSecret: core.serialization.property("client_secret", core.serialization.string().optional()), - authorizeUrl: core.serialization.property("authorize_url", core.serialization.string().optional()), - tokenUrl: core.serialization.property("token_url", core.serialization.string().optional()), - scope: core.serialization.string().optional(), -}); - -export declare namespace CreateConnectorOAuth { - interface Raw { - client_id?: string | null; - client_secret?: string | null; - authorize_url?: string | null; - token_url?: string | null; - scope?: string | null; - } -} diff --git a/src/serialization/types/CreateConnectorResponse.ts b/src/serialization/types/CreateConnectorResponse.ts deleted file mode 100644 index 05a39cb6..00000000 --- a/src/serialization/types/CreateConnectorResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Connector } from "./Connector"; - -export const CreateConnectorResponse: core.serialization.ObjectSchema< - serializers.CreateConnectorResponse.Raw, - Cohere.CreateConnectorResponse -> = core.serialization.object({ - connector: Connector, -}); - -export declare namespace CreateConnectorResponse { - interface Raw { - connector: Connector.Raw; - } -} diff --git a/src/serialization/types/CreateConnectorServiceAuth.ts b/src/serialization/types/CreateConnectorServiceAuth.ts deleted file mode 100644 index eff97d85..00000000 --- a/src/serialization/types/CreateConnectorServiceAuth.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { AuthTokenType } from "./AuthTokenType"; - -export const CreateConnectorServiceAuth: core.serialization.ObjectSchema< - serializers.CreateConnectorServiceAuth.Raw, - Cohere.CreateConnectorServiceAuth -> = core.serialization.object({ - type: AuthTokenType, - token: core.serialization.string(), -}); - -export declare namespace CreateConnectorServiceAuth { - interface Raw { - type: AuthTokenType.Raw; - token: string; - } -} diff --git a/src/serialization/types/CreateEmbedJobResponse.ts b/src/serialization/types/CreateEmbedJobResponse.ts deleted file mode 100644 index e66ad56a..00000000 --- a/src/serialization/types/CreateEmbedJobResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ApiMeta } from "./ApiMeta"; - -export const CreateEmbedJobResponse: core.serialization.ObjectSchema< - serializers.CreateEmbedJobResponse.Raw, - Cohere.CreateEmbedJobResponse -> = core.serialization.object({ - jobId: core.serialization.property("job_id", core.serialization.string()), - meta: ApiMeta.optional(), -}); - -export declare namespace CreateEmbedJobResponse { - interface Raw { - job_id: string; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/Dataset.ts b/src/serialization/types/Dataset.ts deleted file mode 100644 index 2870d99c..00000000 --- a/src/serialization/types/Dataset.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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 { DatasetType } from "./DatasetType"; -import { DatasetValidationStatus } from "./DatasetValidationStatus"; -import { DatasetPart } from "./DatasetPart"; - -export const Dataset: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - name: core.serialization.string(), - createdAt: core.serialization.property("created_at", core.serialization.date()), - updatedAt: core.serialization.property("updated_at", core.serialization.date()), - datasetType: core.serialization.property("dataset_type", DatasetType), - validationStatus: core.serialization.property("validation_status", DatasetValidationStatus), - validationError: core.serialization.property("validation_error", core.serialization.string().optional()), - schema: core.serialization.string().optional(), - requiredFields: core.serialization.property( - "required_fields", - core.serialization.list(core.serialization.string()).optional() - ), - preserveFields: core.serialization.property( - "preserve_fields", - core.serialization.list(core.serialization.string()).optional() - ), - datasetParts: core.serialization.property("dataset_parts", core.serialization.list(DatasetPart).optional()), - validationWarnings: core.serialization.property( - "validation_warnings", - core.serialization.list(core.serialization.string()).optional() - ), - }); - -export declare namespace Dataset { - interface Raw { - id: string; - name: string; - created_at: string; - updated_at: string; - dataset_type: DatasetType.Raw; - validation_status: DatasetValidationStatus.Raw; - validation_error?: string | null; - schema?: string | null; - required_fields?: string[] | null; - preserve_fields?: string[] | null; - dataset_parts?: DatasetPart.Raw[] | null; - validation_warnings?: string[] | null; - } -} diff --git a/src/serialization/types/DatasetPart.ts b/src/serialization/types/DatasetPart.ts deleted file mode 100644 index afb90769..00000000 --- a/src/serialization/types/DatasetPart.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 DatasetPart: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - name: core.serialization.string(), - url: core.serialization.string().optional(), - index: core.serialization.number().optional(), - sizeBytes: core.serialization.property("size_bytes", core.serialization.number().optional()), - numRows: core.serialization.property("num_rows", core.serialization.number().optional()), - originalUrl: core.serialization.property("original_url", core.serialization.string().optional()), - samples: core.serialization.list(core.serialization.string()).optional(), - }); - -export declare namespace DatasetPart { - interface Raw { - id: string; - name: string; - url?: string | null; - index?: number | null; - size_bytes?: number | null; - num_rows?: number | null; - original_url?: string | null; - samples?: string[] | null; - } -} diff --git a/src/serialization/types/DatasetType.ts b/src/serialization/types/DatasetType.ts deleted file mode 100644 index 2fec3009..00000000 --- a/src/serialization/types/DatasetType.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 DatasetType: core.serialization.Schema = - core.serialization.enum_([ - "embed-input", - "embed-result", - "cluster-result", - "cluster-outliers", - "reranker-finetune-input", - "single-label-classification-finetune-input", - "chat-finetune-input", - "multi-label-classification-finetune-input", - ]); - -export declare namespace DatasetType { - type Raw = - | "embed-input" - | "embed-result" - | "cluster-result" - | "cluster-outliers" - | "reranker-finetune-input" - | "single-label-classification-finetune-input" - | "chat-finetune-input" - | "multi-label-classification-finetune-input"; -} diff --git a/src/serialization/types/DatasetValidationStatus.ts b/src/serialization/types/DatasetValidationStatus.ts deleted file mode 100644 index 19bf0132..00000000 --- a/src/serialization/types/DatasetValidationStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 DatasetValidationStatus: core.serialization.Schema< - serializers.DatasetValidationStatus.Raw, - Cohere.DatasetValidationStatus -> = core.serialization.enum_(["unknown", "queued", "processing", "failed", "validated", "skipped"]); - -export declare namespace DatasetValidationStatus { - type Raw = "unknown" | "queued" | "processing" | "failed" | "validated" | "skipped"; -} diff --git a/src/serialization/types/DeleteConnectorResponse.ts b/src/serialization/types/DeleteConnectorResponse.ts deleted file mode 100644 index aa2c36eb..00000000 --- a/src/serialization/types/DeleteConnectorResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 DeleteConnectorResponse: core.serialization.Schema< - serializers.DeleteConnectorResponse.Raw, - Cohere.DeleteConnectorResponse -> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); - -export declare namespace DeleteConnectorResponse { - type Raw = Record; -} diff --git a/src/serialization/types/DetokenizeResponse.ts b/src/serialization/types/DetokenizeResponse.ts deleted file mode 100644 index 7e539d38..00000000 --- a/src/serialization/types/DetokenizeResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ApiMeta } from "./ApiMeta"; - -export const DetokenizeResponse: core.serialization.ObjectSchema< - serializers.DetokenizeResponse.Raw, - Cohere.DetokenizeResponse -> = core.serialization.object({ - text: core.serialization.string(), - meta: ApiMeta.optional(), -}); - -export declare namespace DetokenizeResponse { - interface Raw { - text: string; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/Document.ts b/src/serialization/types/Document.ts deleted file mode 100644 index 21daa04c..00000000 --- a/src/serialization/types/Document.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 Document: core.serialization.ObjectSchema = - core.serialization.object({ - data: core.serialization.record(core.serialization.string(), core.serialization.unknown()), - id: core.serialization.string().optional(), - }); - -export declare namespace Document { - interface Raw { - data: Record; - id?: string | null; - } -} diff --git a/src/serialization/types/DocumentContent.ts b/src/serialization/types/DocumentContent.ts deleted file mode 100644 index 337fa4b6..00000000 --- a/src/serialization/types/DocumentContent.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { Document } from "./Document"; - -export const DocumentContent: core.serialization.ObjectSchema = - core.serialization.object({ - document: Document, - }); - -export declare namespace DocumentContent { - interface Raw { - document: Document.Raw; - } -} diff --git a/src/serialization/types/DocumentSource.ts b/src/serialization/types/DocumentSource.ts deleted file mode 100644 index 8a0acf61..00000000 --- a/src/serialization/types/DocumentSource.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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/types/EmbedByTypeResponse.ts b/src/serialization/types/EmbedByTypeResponse.ts deleted file mode 100644 index b333ac1e..00000000 --- a/src/serialization/types/EmbedByTypeResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 { EmbedByTypeResponseEmbeddings } from "./EmbedByTypeResponseEmbeddings"; -import { Image } from "./Image"; -import { ApiMeta } from "./ApiMeta"; - -export const EmbedByTypeResponse: core.serialization.ObjectSchema< - serializers.EmbedByTypeResponse.Raw, - Cohere.EmbedByTypeResponse -> = core.serialization.object({ - id: core.serialization.string(), - embeddings: EmbedByTypeResponseEmbeddings, - texts: core.serialization.list(core.serialization.string()), - images: core.serialization.list(Image).optional(), - meta: ApiMeta.optional(), -}); - -export declare namespace EmbedByTypeResponse { - interface Raw { - id: string; - embeddings: EmbedByTypeResponseEmbeddings.Raw; - texts: string[]; - images?: Image.Raw[] | null; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/EmbedByTypeResponseEmbeddings.ts b/src/serialization/types/EmbedByTypeResponseEmbeddings.ts deleted file mode 100644 index 1fbf3c74..00000000 --- a/src/serialization/types/EmbedByTypeResponseEmbeddings.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 EmbedByTypeResponseEmbeddings: core.serialization.ObjectSchema< - serializers.EmbedByTypeResponseEmbeddings.Raw, - Cohere.EmbedByTypeResponseEmbeddings -> = core.serialization.object({ - float: core.serialization.list(core.serialization.list(core.serialization.number())).optional(), - int8: core.serialization.list(core.serialization.list(core.serialization.number())).optional(), - uint8: core.serialization.list(core.serialization.list(core.serialization.number())).optional(), - binary: core.serialization.list(core.serialization.list(core.serialization.number())).optional(), - ubinary: core.serialization.list(core.serialization.list(core.serialization.number())).optional(), -}); - -export declare namespace EmbedByTypeResponseEmbeddings { - interface Raw { - float?: number[][] | null; - int8?: number[][] | null; - uint8?: number[][] | null; - binary?: number[][] | null; - ubinary?: number[][] | null; - } -} diff --git a/src/serialization/types/EmbedContent.ts b/src/serialization/types/EmbedContent.ts deleted file mode 100644 index 2a394167..00000000 --- a/src/serialization/types/EmbedContent.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { EmbedImage } from "./EmbedImage"; -import { EmbedText } from "./EmbedText"; - -export const EmbedContent: core.serialization.Schema = - core.serialization - .union("type", { - image_url: EmbedImage, - text: EmbedText, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace EmbedContent { - type Raw = EmbedContent.ImageUrl | EmbedContent.Text; - - interface ImageUrl extends EmbedImage.Raw { - type: "image_url"; - } - - interface Text extends EmbedText.Raw { - type: "text"; - } -} diff --git a/src/serialization/types/EmbedFloatsResponse.ts b/src/serialization/types/EmbedFloatsResponse.ts deleted file mode 100644 index 7d905c32..00000000 --- a/src/serialization/types/EmbedFloatsResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 { Image } from "./Image"; -import { ApiMeta } from "./ApiMeta"; - -export const EmbedFloatsResponse: core.serialization.ObjectSchema< - serializers.EmbedFloatsResponse.Raw, - Cohere.EmbedFloatsResponse -> = core.serialization.object({ - id: core.serialization.string(), - embeddings: core.serialization.list(core.serialization.list(core.serialization.number())), - texts: core.serialization.list(core.serialization.string()), - images: core.serialization.list(Image).optional(), - meta: ApiMeta.optional(), -}); - -export declare namespace EmbedFloatsResponse { - interface Raw { - id: string; - embeddings: number[][]; - texts: string[]; - images?: Image.Raw[] | null; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/EmbedImage.ts b/src/serialization/types/EmbedImage.ts deleted file mode 100644 index ae09ad3b..00000000 --- a/src/serialization/types/EmbedImage.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { EmbedImageUrl } from "./EmbedImageUrl"; - -export const EmbedImage: core.serialization.ObjectSchema = - core.serialization.object({ - imageUrl: core.serialization.property("image_url", EmbedImageUrl.optional()), - }); - -export declare namespace EmbedImage { - interface Raw { - image_url?: EmbedImageUrl.Raw | null; - } -} diff --git a/src/serialization/types/EmbedImageUrl.ts b/src/serialization/types/EmbedImageUrl.ts deleted file mode 100644 index e2b9f547..00000000 --- a/src/serialization/types/EmbedImageUrl.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 EmbedImageUrl: core.serialization.ObjectSchema = - core.serialization.object({ - url: core.serialization.string(), - }); - -export declare namespace EmbedImageUrl { - interface Raw { - url: string; - } -} diff --git a/src/serialization/types/EmbedInput.ts b/src/serialization/types/EmbedInput.ts deleted file mode 100644 index 02da14a0..00000000 --- a/src/serialization/types/EmbedInput.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { EmbedContent } from "./EmbedContent"; - -export const EmbedInput: core.serialization.ObjectSchema = - core.serialization.object({ - content: core.serialization.list(EmbedContent), - }); - -export declare namespace EmbedInput { - interface Raw { - content: EmbedContent.Raw[]; - } -} diff --git a/src/serialization/types/EmbedInputType.ts b/src/serialization/types/EmbedInputType.ts deleted file mode 100644 index b835cf12..00000000 --- a/src/serialization/types/EmbedInputType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 EmbedInputType: core.serialization.Schema = - core.serialization.enum_(["search_document", "search_query", "classification", "clustering", "image"]); - -export declare namespace EmbedInputType { - type Raw = "search_document" | "search_query" | "classification" | "clustering" | "image"; -} diff --git a/src/serialization/types/EmbedJob.ts b/src/serialization/types/EmbedJob.ts deleted file mode 100644 index 53c58348..00000000 --- a/src/serialization/types/EmbedJob.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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 { EmbedJobStatus } from "./EmbedJobStatus"; -import { EmbedJobTruncate } from "./EmbedJobTruncate"; -import { ApiMeta } from "./ApiMeta"; - -export const EmbedJob: core.serialization.ObjectSchema = - core.serialization.object({ - jobId: core.serialization.property("job_id", core.serialization.string()), - name: core.serialization.string().optional(), - status: EmbedJobStatus, - createdAt: core.serialization.property("created_at", core.serialization.date()), - inputDatasetId: core.serialization.property("input_dataset_id", core.serialization.string()), - outputDatasetId: core.serialization.property("output_dataset_id", core.serialization.string().optional()), - model: core.serialization.string(), - truncate: EmbedJobTruncate, - meta: ApiMeta.optional(), - }); - -export declare namespace EmbedJob { - interface Raw { - job_id: string; - name?: string | null; - status: EmbedJobStatus.Raw; - created_at: string; - input_dataset_id: string; - output_dataset_id?: string | null; - model: string; - truncate: EmbedJobTruncate.Raw; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/EmbedJobStatus.ts b/src/serialization/types/EmbedJobStatus.ts deleted file mode 100644 index c55d5911..00000000 --- a/src/serialization/types/EmbedJobStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 EmbedJobStatus: core.serialization.Schema = - core.serialization.enum_(["processing", "complete", "cancelling", "cancelled", "failed"]); - -export declare namespace EmbedJobStatus { - type Raw = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; -} diff --git a/src/serialization/types/EmbedJobTruncate.ts b/src/serialization/types/EmbedJobTruncate.ts deleted file mode 100644 index f31bf436..00000000 --- a/src/serialization/types/EmbedJobTruncate.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 EmbedJobTruncate: core.serialization.Schema = - core.serialization.enum_(["START", "END"]); - -export declare namespace EmbedJobTruncate { - type Raw = "START" | "END"; -} diff --git a/src/serialization/types/EmbedRequestTruncate.ts b/src/serialization/types/EmbedRequestTruncate.ts deleted file mode 100644 index 295de459..00000000 --- a/src/serialization/types/EmbedRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 EmbedRequestTruncate: core.serialization.Schema< - serializers.EmbedRequestTruncate.Raw, - Cohere.EmbedRequestTruncate -> = core.serialization.enum_(["NONE", "START", "END"]); - -export declare namespace EmbedRequestTruncate { - type Raw = "NONE" | "START" | "END"; -} diff --git a/src/serialization/types/EmbedResponse.ts b/src/serialization/types/EmbedResponse.ts deleted file mode 100644 index ebccc231..00000000 --- a/src/serialization/types/EmbedResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { EmbedFloatsResponse } from "./EmbedFloatsResponse"; -import { EmbedByTypeResponse } from "./EmbedByTypeResponse"; - -export const EmbedResponse: core.serialization.Schema = - core.serialization - .union(core.serialization.discriminant("responseType", "response_type"), { - embeddings_floats: EmbedFloatsResponse, - embeddings_by_type: EmbedByTypeResponse, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace EmbedResponse { - type Raw = EmbedResponse.EmbeddingsFloats | EmbedResponse.EmbeddingsByType; - - interface EmbeddingsFloats extends EmbedFloatsResponse.Raw { - response_type: "embeddings_floats"; - } - - interface EmbeddingsByType extends EmbedByTypeResponse.Raw { - response_type: "embeddings_by_type"; - } -} diff --git a/src/serialization/types/EmbedText.ts b/src/serialization/types/EmbedText.ts deleted file mode 100644 index a93e75c0..00000000 --- a/src/serialization/types/EmbedText.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 EmbedText: core.serialization.ObjectSchema = - core.serialization.object({ - text: core.serialization.string().optional(), - }); - -export declare namespace EmbedText { - interface Raw { - text?: string | null; - } -} diff --git a/src/serialization/types/EmbeddingType.ts b/src/serialization/types/EmbeddingType.ts deleted file mode 100644 index 479133a1..00000000 --- a/src/serialization/types/EmbeddingType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 EmbeddingType: core.serialization.Schema = - core.serialization.enum_(["float", "int8", "uint8", "binary", "ubinary"]); - -export declare namespace EmbeddingType { - type Raw = "float" | "int8" | "uint8" | "binary" | "ubinary"; -} diff --git a/src/serialization/types/FinetuneDatasetMetrics.ts b/src/serialization/types/FinetuneDatasetMetrics.ts deleted file mode 100644 index bf2268af..00000000 --- a/src/serialization/types/FinetuneDatasetMetrics.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 FinetuneDatasetMetrics: core.serialization.ObjectSchema< - serializers.FinetuneDatasetMetrics.Raw, - Cohere.FinetuneDatasetMetrics -> = core.serialization.object({ - trainableTokenCount: core.serialization.property("trainable_token_count", core.serialization.number().optional()), - totalExamples: core.serialization.property("total_examples", core.serialization.number().optional()), - trainExamples: core.serialization.property("train_examples", core.serialization.number().optional()), - trainSizeBytes: core.serialization.property("train_size_bytes", core.serialization.number().optional()), - evalExamples: core.serialization.property("eval_examples", core.serialization.number().optional()), - evalSizeBytes: core.serialization.property("eval_size_bytes", core.serialization.number().optional()), -}); - -export declare namespace FinetuneDatasetMetrics { - interface Raw { - trainable_token_count?: number | null; - total_examples?: number | null; - train_examples?: number | null; - train_size_bytes?: number | null; - eval_examples?: number | null; - eval_size_bytes?: number | null; - } -} diff --git a/src/serialization/types/FinishReason.ts b/src/serialization/types/FinishReason.ts deleted file mode 100644 index 86d900b3..00000000 --- a/src/serialization/types/FinishReason.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 FinishReason: core.serialization.Schema = - core.serialization.enum_([ - "COMPLETE", - "STOP_SEQUENCE", - "ERROR", - "ERROR_TOXIC", - "ERROR_LIMIT", - "USER_CANCEL", - "MAX_TOKENS", - ]); - -export declare namespace FinishReason { - type Raw = "COMPLETE" | "STOP_SEQUENCE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"; -} diff --git a/src/serialization/types/GenerateRequestReturnLikelihoods.ts b/src/serialization/types/GenerateRequestReturnLikelihoods.ts deleted file mode 100644 index efbb727a..00000000 --- a/src/serialization/types/GenerateRequestReturnLikelihoods.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 GenerateRequestReturnLikelihoods: core.serialization.Schema< - serializers.GenerateRequestReturnLikelihoods.Raw, - Cohere.GenerateRequestReturnLikelihoods -> = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); - -export declare namespace GenerateRequestReturnLikelihoods { - type Raw = "GENERATION" | "ALL" | "NONE"; -} diff --git a/src/serialization/types/GenerateRequestTruncate.ts b/src/serialization/types/GenerateRequestTruncate.ts deleted file mode 100644 index 6685fa16..00000000 --- a/src/serialization/types/GenerateRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 GenerateRequestTruncate: core.serialization.Schema< - serializers.GenerateRequestTruncate.Raw, - Cohere.GenerateRequestTruncate -> = core.serialization.enum_(["NONE", "START", "END"]); - -export declare namespace GenerateRequestTruncate { - type Raw = "NONE" | "START" | "END"; -} diff --git a/src/serialization/types/GenerateStreamEnd.ts b/src/serialization/types/GenerateStreamEnd.ts deleted file mode 100644 index 234ef90a..00000000 --- a/src/serialization/types/GenerateStreamEnd.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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 { FinishReason } from "./FinishReason"; -import { GenerateStreamEndResponse } from "./GenerateStreamEndResponse"; -import { GenerateStreamEvent } from "./GenerateStreamEvent"; - -export const GenerateStreamEnd: core.serialization.ObjectSchema< - serializers.GenerateStreamEnd.Raw, - Cohere.GenerateStreamEnd -> = core.serialization - .object({ - isFinished: core.serialization.property("is_finished", core.serialization.boolean()), - finishReason: core.serialization.property("finish_reason", FinishReason.optional()), - response: GenerateStreamEndResponse, - }) - .extend(GenerateStreamEvent); - -export declare namespace GenerateStreamEnd { - interface Raw extends GenerateStreamEvent.Raw { - is_finished: boolean; - finish_reason?: FinishReason.Raw | null; - response: GenerateStreamEndResponse.Raw; - } -} diff --git a/src/serialization/types/GenerateStreamEndResponse.ts b/src/serialization/types/GenerateStreamEndResponse.ts deleted file mode 100644 index 7abe4120..00000000 --- a/src/serialization/types/GenerateStreamEndResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { SingleGenerationInStream } from "./SingleGenerationInStream"; - -export const GenerateStreamEndResponse: core.serialization.ObjectSchema< - serializers.GenerateStreamEndResponse.Raw, - Cohere.GenerateStreamEndResponse -> = core.serialization.object({ - id: core.serialization.string(), - prompt: core.serialization.string().optional(), - generations: core.serialization.list(SingleGenerationInStream).optional(), -}); - -export declare namespace GenerateStreamEndResponse { - interface Raw { - id: string; - prompt?: string | null; - generations?: SingleGenerationInStream.Raw[] | null; - } -} diff --git a/src/serialization/types/GenerateStreamError.ts b/src/serialization/types/GenerateStreamError.ts deleted file mode 100644 index 83854593..00000000 --- a/src/serialization/types/GenerateStreamError.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 { FinishReason } from "./FinishReason"; -import { GenerateStreamEvent } from "./GenerateStreamEvent"; - -export const GenerateStreamError: core.serialization.ObjectSchema< - serializers.GenerateStreamError.Raw, - Cohere.GenerateStreamError -> = core.serialization - .object({ - index: core.serialization.number().optional(), - isFinished: core.serialization.property("is_finished", core.serialization.boolean()), - finishReason: core.serialization.property("finish_reason", FinishReason), - err: core.serialization.string(), - }) - .extend(GenerateStreamEvent); - -export declare namespace GenerateStreamError { - interface Raw extends GenerateStreamEvent.Raw { - index?: number | null; - is_finished: boolean; - finish_reason: FinishReason.Raw; - err: string; - } -} diff --git a/src/serialization/types/GenerateStreamEvent.ts b/src/serialization/types/GenerateStreamEvent.ts deleted file mode 100644 index 13cf23d5..00000000 --- a/src/serialization/types/GenerateStreamEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 GenerateStreamEvent: core.serialization.ObjectSchema< - serializers.GenerateStreamEvent.Raw, - Cohere.GenerateStreamEvent -> = core.serialization.object({}); - -export declare namespace GenerateStreamEvent { - interface Raw {} -} diff --git a/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts b/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts deleted file mode 100644 index 73c8a25c..00000000 --- a/src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 GenerateStreamRequestReturnLikelihoods: core.serialization.Schema< - serializers.GenerateStreamRequestReturnLikelihoods.Raw, - Cohere.GenerateStreamRequestReturnLikelihoods -> = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); - -export declare namespace GenerateStreamRequestReturnLikelihoods { - type Raw = "GENERATION" | "ALL" | "NONE"; -} diff --git a/src/serialization/types/GenerateStreamRequestTruncate.ts b/src/serialization/types/GenerateStreamRequestTruncate.ts deleted file mode 100644 index bd29d1c5..00000000 --- a/src/serialization/types/GenerateStreamRequestTruncate.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 GenerateStreamRequestTruncate: core.serialization.Schema< - serializers.GenerateStreamRequestTruncate.Raw, - Cohere.GenerateStreamRequestTruncate -> = core.serialization.enum_(["NONE", "START", "END"]); - -export declare namespace GenerateStreamRequestTruncate { - type Raw = "NONE" | "START" | "END"; -} diff --git a/src/serialization/types/GenerateStreamText.ts b/src/serialization/types/GenerateStreamText.ts deleted file mode 100644 index 71ab202d..00000000 --- a/src/serialization/types/GenerateStreamText.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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 { GenerateStreamEvent } from "./GenerateStreamEvent"; - -export const GenerateStreamText: core.serialization.ObjectSchema< - serializers.GenerateStreamText.Raw, - Cohere.GenerateStreamText -> = core.serialization - .object({ - text: core.serialization.string(), - index: core.serialization.number().optional(), - isFinished: core.serialization.property("is_finished", core.serialization.boolean()), - }) - .extend(GenerateStreamEvent); - -export declare namespace GenerateStreamText { - interface Raw extends GenerateStreamEvent.Raw { - text: string; - index?: number | null; - is_finished: boolean; - } -} diff --git a/src/serialization/types/GenerateStreamedResponse.ts b/src/serialization/types/GenerateStreamedResponse.ts deleted file mode 100644 index 1e9e08b0..00000000 --- a/src/serialization/types/GenerateStreamedResponse.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 { GenerateStreamText } from "./GenerateStreamText"; -import { GenerateStreamEnd } from "./GenerateStreamEnd"; -import { GenerateStreamError } from "./GenerateStreamError"; - -export const GenerateStreamedResponse: core.serialization.Schema< - serializers.GenerateStreamedResponse.Raw, - Cohere.GenerateStreamedResponse -> = core.serialization - .union(core.serialization.discriminant("eventType", "event_type"), { - "text-generation": GenerateStreamText, - "stream-end": GenerateStreamEnd, - "stream-error": GenerateStreamError, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace GenerateStreamedResponse { - type Raw = - | GenerateStreamedResponse.TextGeneration - | GenerateStreamedResponse.StreamEnd - | GenerateStreamedResponse.StreamError; - - interface TextGeneration extends GenerateStreamText.Raw { - event_type: "text-generation"; - } - - interface StreamEnd extends GenerateStreamEnd.Raw { - event_type: "stream-end"; - } - - interface StreamError extends GenerateStreamError.Raw { - event_type: "stream-error"; - } -} diff --git a/src/serialization/types/Generation.ts b/src/serialization/types/Generation.ts deleted file mode 100644 index 967b8469..00000000 --- a/src/serialization/types/Generation.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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 { SingleGeneration } from "./SingleGeneration"; -import { ApiMeta } from "./ApiMeta"; - -export const Generation: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string(), - prompt: core.serialization.string().optional(), - generations: core.serialization.list(SingleGeneration), - meta: ApiMeta.optional(), - }); - -export declare namespace Generation { - interface Raw { - id: string; - prompt?: string | null; - generations: SingleGeneration.Raw[]; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/GetConnectorResponse.ts b/src/serialization/types/GetConnectorResponse.ts deleted file mode 100644 index 0bab139b..00000000 --- a/src/serialization/types/GetConnectorResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Connector } from "./Connector"; - -export const GetConnectorResponse: core.serialization.ObjectSchema< - serializers.GetConnectorResponse.Raw, - Cohere.GetConnectorResponse -> = core.serialization.object({ - connector: Connector, -}); - -export declare namespace GetConnectorResponse { - interface Raw { - connector: Connector.Raw; - } -} diff --git a/src/serialization/types/GetModelResponse.ts b/src/serialization/types/GetModelResponse.ts deleted file mode 100644 index 07af1dc7..00000000 --- a/src/serialization/types/GetModelResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 { CompatibleEndpoint } from "./CompatibleEndpoint"; - -export const GetModelResponse: core.serialization.ObjectSchema< - serializers.GetModelResponse.Raw, - Cohere.GetModelResponse -> = core.serialization.object({ - name: core.serialization.string().optional(), - endpoints: core.serialization.list(CompatibleEndpoint).optional(), - finetuned: core.serialization.boolean().optional(), - contextLength: core.serialization.property("context_length", core.serialization.number().optional()), - tokenizerUrl: core.serialization.property("tokenizer_url", core.serialization.string().optional()), - supportsVision: core.serialization.property("supports_vision", core.serialization.boolean().optional()), - defaultEndpoints: core.serialization.property( - "default_endpoints", - core.serialization.list(CompatibleEndpoint).optional() - ), - features: core.serialization.list(core.serialization.string()).optional(), -}); - -export declare namespace GetModelResponse { - interface Raw { - name?: string | null; - endpoints?: CompatibleEndpoint.Raw[] | null; - finetuned?: boolean | null; - context_length?: number | null; - tokenizer_url?: string | null; - supports_vision?: boolean | null; - default_endpoints?: CompatibleEndpoint.Raw[] | null; - features?: string[] | null; - } -} diff --git a/src/serialization/types/Image.ts b/src/serialization/types/Image.ts deleted file mode 100644 index 4accd17a..00000000 --- a/src/serialization/types/Image.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 Image: core.serialization.ObjectSchema = core.serialization.object({ - width: core.serialization.number(), - height: core.serialization.number(), - format: core.serialization.string(), - bitDepth: core.serialization.property("bit_depth", core.serialization.number()), -}); - -export declare namespace Image { - interface Raw { - width: number; - height: number; - format: string; - bit_depth: number; - } -} diff --git a/src/serialization/types/ImageContent.ts b/src/serialization/types/ImageContent.ts deleted file mode 100644 index cea9532f..00000000 --- a/src/serialization/types/ImageContent.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { ImageUrl } from "./ImageUrl"; - -export const ImageContent: core.serialization.ObjectSchema = - core.serialization.object({ - imageUrl: core.serialization.property("image_url", ImageUrl), - }); - -export declare namespace ImageContent { - interface Raw { - image_url: ImageUrl.Raw; - } -} diff --git a/src/serialization/types/ImageUrl.ts b/src/serialization/types/ImageUrl.ts deleted file mode 100644 index c3e4f84a..00000000 --- a/src/serialization/types/ImageUrl.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 ImageUrl: core.serialization.ObjectSchema = - core.serialization.object({ - url: core.serialization.string(), - }); - -export declare namespace ImageUrl { - interface Raw { - url: string; - } -} diff --git a/src/serialization/types/JsonResponseFormat.ts b/src/serialization/types/JsonResponseFormat.ts deleted file mode 100644 index 65475fc1..00000000 --- a/src/serialization/types/JsonResponseFormat.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 JsonResponseFormat: core.serialization.ObjectSchema< - serializers.JsonResponseFormat.Raw, - Cohere.JsonResponseFormat -> = core.serialization.object({ - schema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), -}); - -export declare namespace JsonResponseFormat { - interface Raw { - schema?: Record | null; - } -} diff --git a/src/serialization/types/JsonResponseFormatV2.ts b/src/serialization/types/JsonResponseFormatV2.ts deleted file mode 100644 index 68ee4437..00000000 --- a/src/serialization/types/JsonResponseFormatV2.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 JsonResponseFormatV2: core.serialization.ObjectSchema< - serializers.JsonResponseFormatV2.Raw, - Cohere.JsonResponseFormatV2 -> = core.serialization.object({ - jsonSchema: core.serialization.property( - "json_schema", - core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() - ), -}); - -export declare namespace JsonResponseFormatV2 { - interface Raw { - json_schema?: Record | null; - } -} diff --git a/src/serialization/types/LabelMetric.ts b/src/serialization/types/LabelMetric.ts deleted file mode 100644 index 00f550d1..00000000 --- a/src/serialization/types/LabelMetric.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 LabelMetric: core.serialization.ObjectSchema = - core.serialization.object({ - totalExamples: core.serialization.property("total_examples", core.serialization.number().optional()), - label: core.serialization.string().optional(), - samples: core.serialization.list(core.serialization.string()).optional(), - }); - -export declare namespace LabelMetric { - interface Raw { - total_examples?: number | null; - label?: string | null; - samples?: string[] | null; - } -} diff --git a/src/serialization/types/ListConnectorsResponse.ts b/src/serialization/types/ListConnectorsResponse.ts deleted file mode 100644 index 998edab0..00000000 --- a/src/serialization/types/ListConnectorsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { Connector } from "./Connector"; - -export const ListConnectorsResponse: core.serialization.ObjectSchema< - serializers.ListConnectorsResponse.Raw, - Cohere.ListConnectorsResponse -> = core.serialization.object({ - connectors: core.serialization.list(Connector), - totalCount: core.serialization.property("total_count", core.serialization.number().optional()), -}); - -export declare namespace ListConnectorsResponse { - interface Raw { - connectors: Connector.Raw[]; - total_count?: number | null; - } -} diff --git a/src/serialization/types/ListEmbedJobResponse.ts b/src/serialization/types/ListEmbedJobResponse.ts deleted file mode 100644 index c8f2cab6..00000000 --- a/src/serialization/types/ListEmbedJobResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { EmbedJob } from "./EmbedJob"; - -export const ListEmbedJobResponse: core.serialization.ObjectSchema< - serializers.ListEmbedJobResponse.Raw, - Cohere.ListEmbedJobResponse -> = core.serialization.object({ - embedJobs: core.serialization.property("embed_jobs", core.serialization.list(EmbedJob).optional()), -}); - -export declare namespace ListEmbedJobResponse { - interface Raw { - embed_jobs?: EmbedJob.Raw[] | null; - } -} diff --git a/src/serialization/types/ListModelsResponse.ts b/src/serialization/types/ListModelsResponse.ts deleted file mode 100644 index c7c6972e..00000000 --- a/src/serialization/types/ListModelsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { GetModelResponse } from "./GetModelResponse"; - -export const ListModelsResponse: core.serialization.ObjectSchema< - serializers.ListModelsResponse.Raw, - Cohere.ListModelsResponse -> = core.serialization.object({ - models: core.serialization.list(GetModelResponse), - nextPageToken: core.serialization.property("next_page_token", core.serialization.string().optional()), -}); - -export declare namespace ListModelsResponse { - interface Raw { - models: GetModelResponse.Raw[]; - next_page_token?: string | null; - } -} diff --git a/src/serialization/types/LogprobItem.ts b/src/serialization/types/LogprobItem.ts deleted file mode 100644 index 0ebb3261..00000000 --- a/src/serialization/types/LogprobItem.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 LogprobItem: core.serialization.ObjectSchema = - core.serialization.object({ - text: core.serialization.string().optional(), - tokenIds: core.serialization.property("token_ids", core.serialization.list(core.serialization.number())), - logprobs: core.serialization.list(core.serialization.number()).optional(), - }); - -export declare namespace LogprobItem { - interface Raw { - text?: string | null; - token_ids: number[]; - logprobs?: number[] | null; - } -} diff --git a/src/serialization/types/Message.ts b/src/serialization/types/Message.ts deleted file mode 100644 index e9a79c6c..00000000 --- a/src/serialization/types/Message.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 { ChatMessage } from "./ChatMessage"; -import { ToolMessage } from "./ToolMessage"; - -export const Message: core.serialization.Schema = core.serialization - .union("role", { - CHATBOT: ChatMessage, - SYSTEM: ChatMessage, - USER: ChatMessage, - TOOL: ToolMessage, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace Message { - type Raw = Message.Chatbot | Message.System | Message.User | Message.Tool; - - interface Chatbot extends ChatMessage.Raw { - role: "CHATBOT"; - } - - interface System extends ChatMessage.Raw { - role: "SYSTEM"; - } - - interface User extends ChatMessage.Raw { - role: "USER"; - } - - interface Tool extends ToolMessage.Raw { - role: "TOOL"; - } -} diff --git a/src/serialization/types/Metrics.ts b/src/serialization/types/Metrics.ts deleted file mode 100644 index a8842311..00000000 --- a/src/serialization/types/Metrics.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { FinetuneDatasetMetrics } from "./FinetuneDatasetMetrics"; -import { MetricsEmbedData } from "./MetricsEmbedData"; - -export const Metrics: core.serialization.ObjectSchema = - core.serialization.object({ - finetuneDatasetMetrics: core.serialization.property( - "finetune_dataset_metrics", - FinetuneDatasetMetrics.optional() - ), - embedData: core.serialization.property("embed_data", MetricsEmbedData.optional()), - }); - -export declare namespace Metrics { - interface Raw { - finetune_dataset_metrics?: FinetuneDatasetMetrics.Raw | null; - embed_data?: MetricsEmbedData.Raw | null; - } -} diff --git a/src/serialization/types/MetricsEmbedData.ts b/src/serialization/types/MetricsEmbedData.ts deleted file mode 100644 index 3ac07c9b..00000000 --- a/src/serialization/types/MetricsEmbedData.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { MetricsEmbedDataFieldsItem } from "./MetricsEmbedDataFieldsItem"; - -export const MetricsEmbedData: core.serialization.ObjectSchema< - serializers.MetricsEmbedData.Raw, - Cohere.MetricsEmbedData -> = core.serialization.object({ - fields: core.serialization.list(MetricsEmbedDataFieldsItem).optional(), -}); - -export declare namespace MetricsEmbedData { - interface Raw { - fields?: MetricsEmbedDataFieldsItem.Raw[] | null; - } -} diff --git a/src/serialization/types/MetricsEmbedDataFieldsItem.ts b/src/serialization/types/MetricsEmbedDataFieldsItem.ts deleted file mode 100644 index 05432092..00000000 --- a/src/serialization/types/MetricsEmbedDataFieldsItem.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 MetricsEmbedDataFieldsItem: core.serialization.ObjectSchema< - serializers.MetricsEmbedDataFieldsItem.Raw, - Cohere.MetricsEmbedDataFieldsItem -> = core.serialization.object({ - name: core.serialization.string().optional(), - count: core.serialization.number().optional(), -}); - -export declare namespace MetricsEmbedDataFieldsItem { - interface Raw { - name?: string | null; - count?: number | null; - } -} diff --git a/src/serialization/types/NonStreamedChatResponse.ts b/src/serialization/types/NonStreamedChatResponse.ts deleted file mode 100644 index ffe4486d..00000000 --- a/src/serialization/types/NonStreamedChatResponse.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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 { ChatCitation } from "./ChatCitation"; -import { ChatDocument } from "./ChatDocument"; -import { ChatSearchQuery } from "./ChatSearchQuery"; -import { ChatSearchResult } from "./ChatSearchResult"; -import { FinishReason } from "./FinishReason"; -import { ToolCall } from "./ToolCall"; -import { Message } from "./Message"; -import { ApiMeta } from "./ApiMeta"; - -export const NonStreamedChatResponse: core.serialization.ObjectSchema< - serializers.NonStreamedChatResponse.Raw, - Cohere.NonStreamedChatResponse -> = core.serialization.object({ - text: core.serialization.string(), - generationId: core.serialization.property("generation_id", core.serialization.string().optional()), - responseId: core.serialization.property("response_id", core.serialization.string().optional()), - citations: core.serialization.list(ChatCitation).optional(), - documents: core.serialization.list(ChatDocument).optional(), - isSearchRequired: core.serialization.property("is_search_required", core.serialization.boolean().optional()), - searchQueries: core.serialization.property("search_queries", core.serialization.list(ChatSearchQuery).optional()), - searchResults: core.serialization.property("search_results", core.serialization.list(ChatSearchResult).optional()), - finishReason: core.serialization.property("finish_reason", FinishReason.optional()), - toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall).optional()), - chatHistory: core.serialization.property("chat_history", core.serialization.list(Message).optional()), - prompt: core.serialization.string().optional(), - meta: ApiMeta.optional(), -}); - -export declare namespace NonStreamedChatResponse { - interface Raw { - text: string; - generation_id?: string | null; - response_id?: string | null; - citations?: ChatCitation.Raw[] | null; - documents?: ChatDocument.Raw[] | null; - is_search_required?: boolean | null; - search_queries?: ChatSearchQuery.Raw[] | null; - search_results?: ChatSearchResult.Raw[] | null; - finish_reason?: FinishReason.Raw | null; - tool_calls?: ToolCall.Raw[] | null; - chat_history?: Message.Raw[] | null; - prompt?: string | null; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/OAuthAuthorizeResponse.ts b/src/serialization/types/OAuthAuthorizeResponse.ts deleted file mode 100644 index 92baa25c..00000000 --- a/src/serialization/types/OAuthAuthorizeResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 OAuthAuthorizeResponse: core.serialization.ObjectSchema< - serializers.OAuthAuthorizeResponse.Raw, - Cohere.OAuthAuthorizeResponse -> = core.serialization.object({ - redirectUrl: core.serialization.property("redirect_url", core.serialization.string().optional()), -}); - -export declare namespace OAuthAuthorizeResponse { - interface Raw { - redirect_url?: string | null; - } -} diff --git a/src/serialization/types/ParseInfo.ts b/src/serialization/types/ParseInfo.ts deleted file mode 100644 index 5d42f44b..00000000 --- a/src/serialization/types/ParseInfo.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ParseInfo: core.serialization.ObjectSchema = - core.serialization.object({ - separator: core.serialization.string().optional(), - delimiter: core.serialization.string().optional(), - }); - -export declare namespace ParseInfo { - interface Raw { - separator?: string | null; - delimiter?: string | null; - } -} diff --git a/src/serialization/types/ReasoningEffort.ts b/src/serialization/types/ReasoningEffort.ts deleted file mode 100644 index e8870fa1..00000000 --- a/src/serialization/types/ReasoningEffort.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 ReasoningEffort: core.serialization.Schema = - core.serialization.enum_(["low", "medium", "high"]); - -export declare namespace ReasoningEffort { - type Raw = "low" | "medium" | "high"; -} diff --git a/src/serialization/types/RerankDocument.ts b/src/serialization/types/RerankDocument.ts deleted file mode 100644 index 89bd7782..00000000 --- a/src/serialization/types/RerankDocument.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 RerankDocument: core.serialization.Schema = - core.serialization.record(core.serialization.string(), core.serialization.string()); - -export declare namespace RerankDocument { - type Raw = Record; -} diff --git a/src/serialization/types/RerankRequestDocumentsItem.ts b/src/serialization/types/RerankRequestDocumentsItem.ts deleted file mode 100644 index 0602525a..00000000 --- a/src/serialization/types/RerankRequestDocumentsItem.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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 { RerankDocument } from "./RerankDocument"; - -export const RerankRequestDocumentsItem: core.serialization.Schema< - serializers.RerankRequestDocumentsItem.Raw, - Cohere.RerankRequestDocumentsItem -> = core.serialization.undiscriminatedUnion([core.serialization.string(), RerankDocument]); - -export declare namespace RerankRequestDocumentsItem { - type Raw = string | RerankDocument.Raw; -} diff --git a/src/serialization/types/RerankResponse.ts b/src/serialization/types/RerankResponse.ts deleted file mode 100644 index 39e2faff..00000000 --- a/src/serialization/types/RerankResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 { RerankResponseResultsItem } from "./RerankResponseResultsItem"; -import { ApiMeta } from "./ApiMeta"; - -export const RerankResponse: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string().optional(), - results: core.serialization.list(RerankResponseResultsItem), - meta: ApiMeta.optional(), - }); - -export declare namespace RerankResponse { - interface Raw { - id?: string | null; - results: RerankResponseResultsItem.Raw[]; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/RerankResponseResultsItem.ts b/src/serialization/types/RerankResponseResultsItem.ts deleted file mode 100644 index 85e165b5..00000000 --- a/src/serialization/types/RerankResponseResultsItem.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { RerankResponseResultsItemDocument } from "./RerankResponseResultsItemDocument"; - -export const RerankResponseResultsItem: core.serialization.ObjectSchema< - serializers.RerankResponseResultsItem.Raw, - Cohere.RerankResponseResultsItem -> = core.serialization.object({ - document: RerankResponseResultsItemDocument.optional(), - index: core.serialization.number(), - relevanceScore: core.serialization.property("relevance_score", core.serialization.number()), -}); - -export declare namespace RerankResponseResultsItem { - interface Raw { - document?: RerankResponseResultsItemDocument.Raw | null; - index: number; - relevance_score: number; - } -} diff --git a/src/serialization/types/RerankResponseResultsItemDocument.ts b/src/serialization/types/RerankResponseResultsItemDocument.ts deleted file mode 100644 index 02628b8f..00000000 --- a/src/serialization/types/RerankResponseResultsItemDocument.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 RerankResponseResultsItemDocument: core.serialization.ObjectSchema< - serializers.RerankResponseResultsItemDocument.Raw, - Cohere.RerankResponseResultsItemDocument -> = core.serialization.object({ - text: core.serialization.string(), -}); - -export declare namespace RerankResponseResultsItemDocument { - interface Raw { - text: string; - } -} diff --git a/src/serialization/types/RerankerDataMetrics.ts b/src/serialization/types/RerankerDataMetrics.ts deleted file mode 100644 index 450fbcce..00000000 --- a/src/serialization/types/RerankerDataMetrics.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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 RerankerDataMetrics: core.serialization.ObjectSchema< - serializers.RerankerDataMetrics.Raw, - Cohere.RerankerDataMetrics -> = core.serialization.object({ - numTrainQueries: core.serialization.property("num_train_queries", core.serialization.number().optional()), - numTrainRelevantPassages: core.serialization.property( - "num_train_relevant_passages", - core.serialization.number().optional() - ), - numTrainHardNegatives: core.serialization.property( - "num_train_hard_negatives", - core.serialization.number().optional() - ), - numEvalQueries: core.serialization.property("num_eval_queries", core.serialization.number().optional()), - numEvalRelevantPassages: core.serialization.property( - "num_eval_relevant_passages", - core.serialization.number().optional() - ), - numEvalHardNegatives: core.serialization.property( - "num_eval_hard_negatives", - core.serialization.number().optional() - ), -}); - -export declare namespace RerankerDataMetrics { - interface Raw { - num_train_queries?: number | null; - num_train_relevant_passages?: number | null; - num_train_hard_negatives?: number | null; - num_eval_queries?: number | null; - num_eval_relevant_passages?: number | null; - num_eval_hard_negatives?: number | null; - } -} diff --git a/src/serialization/types/ResponseFormat.ts b/src/serialization/types/ResponseFormat.ts deleted file mode 100644 index 3c5a6102..00000000 --- a/src/serialization/types/ResponseFormat.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { TextResponseFormat } from "./TextResponseFormat"; -import { JsonResponseFormat } from "./JsonResponseFormat"; - -export const ResponseFormat: core.serialization.Schema = - core.serialization - .union("type", { - text: TextResponseFormat, - json_object: JsonResponseFormat, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace ResponseFormat { - type Raw = ResponseFormat.Text | ResponseFormat.JsonObject; - - interface Text extends TextResponseFormat.Raw { - type: "text"; - } - - interface JsonObject extends JsonResponseFormat.Raw { - type: "json_object"; - } -} diff --git a/src/serialization/types/ResponseFormatV2.ts b/src/serialization/types/ResponseFormatV2.ts deleted file mode 100644 index 93dde76a..00000000 --- a/src/serialization/types/ResponseFormatV2.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { TextResponseFormatV2 } from "./TextResponseFormatV2"; -import { JsonResponseFormatV2 } from "./JsonResponseFormatV2"; - -export const ResponseFormatV2: core.serialization.Schema = - core.serialization - .union("type", { - text: TextResponseFormatV2, - json_object: JsonResponseFormatV2, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace ResponseFormatV2 { - type Raw = ResponseFormatV2.Text | ResponseFormatV2.JsonObject; - - interface Text extends TextResponseFormatV2.Raw { - type: "text"; - } - - interface JsonObject extends JsonResponseFormatV2.Raw { - type: "json_object"; - } -} diff --git a/src/serialization/types/SingleGeneration.ts b/src/serialization/types/SingleGeneration.ts deleted file mode 100644 index f7f68f44..00000000 --- a/src/serialization/types/SingleGeneration.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 { SingleGenerationTokenLikelihoodsItem } from "./SingleGenerationTokenLikelihoodsItem"; - -export const SingleGeneration: core.serialization.ObjectSchema< - serializers.SingleGeneration.Raw, - Cohere.SingleGeneration -> = core.serialization.object({ - id: core.serialization.string(), - text: core.serialization.string(), - index: core.serialization.number().optional(), - likelihood: core.serialization.number().optional(), - tokenLikelihoods: core.serialization.property( - "token_likelihoods", - core.serialization.list(SingleGenerationTokenLikelihoodsItem).optional() - ), -}); - -export declare namespace SingleGeneration { - interface Raw { - id: string; - text: string; - index?: number | null; - likelihood?: number | null; - token_likelihoods?: SingleGenerationTokenLikelihoodsItem.Raw[] | null; - } -} diff --git a/src/serialization/types/SingleGenerationInStream.ts b/src/serialization/types/SingleGenerationInStream.ts deleted file mode 100644 index d6db5648..00000000 --- a/src/serialization/types/SingleGenerationInStream.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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 { FinishReason } from "./FinishReason"; - -export const SingleGenerationInStream: core.serialization.ObjectSchema< - serializers.SingleGenerationInStream.Raw, - Cohere.SingleGenerationInStream -> = core.serialization.object({ - id: core.serialization.string(), - text: core.serialization.string(), - index: core.serialization.number().optional(), - finishReason: core.serialization.property("finish_reason", FinishReason), -}); - -export declare namespace SingleGenerationInStream { - interface Raw { - id: string; - text: string; - index?: number | null; - finish_reason: FinishReason.Raw; - } -} diff --git a/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts b/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts deleted file mode 100644 index e0e0bd80..00000000 --- a/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 SingleGenerationTokenLikelihoodsItem: core.serialization.ObjectSchema< - serializers.SingleGenerationTokenLikelihoodsItem.Raw, - Cohere.SingleGenerationTokenLikelihoodsItem -> = core.serialization.object({ - token: core.serialization.string(), - likelihood: core.serialization.number(), -}); - -export declare namespace SingleGenerationTokenLikelihoodsItem { - interface Raw { - token: string; - likelihood: number; - } -} diff --git a/src/serialization/types/Source.ts b/src/serialization/types/Source.ts deleted file mode 100644 index 997a3c04..00000000 --- a/src/serialization/types/Source.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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/types/StreamedChatResponse.ts b/src/serialization/types/StreamedChatResponse.ts deleted file mode 100644 index 19617f0e..00000000 --- a/src/serialization/types/StreamedChatResponse.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 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 { ChatStreamStartEvent } from "./ChatStreamStartEvent"; -import { ChatSearchQueriesGenerationEvent } from "./ChatSearchQueriesGenerationEvent"; -import { ChatSearchResultsEvent } from "./ChatSearchResultsEvent"; -import { ChatTextGenerationEvent } from "./ChatTextGenerationEvent"; -import { ChatCitationGenerationEvent } from "./ChatCitationGenerationEvent"; -import { ChatToolCallsGenerationEvent } from "./ChatToolCallsGenerationEvent"; -import { ChatStreamEndEvent } from "./ChatStreamEndEvent"; -import { ChatToolCallsChunkEvent } from "./ChatToolCallsChunkEvent"; -import { ChatDebugEvent } from "./ChatDebugEvent"; - -export const StreamedChatResponse: core.serialization.Schema< - serializers.StreamedChatResponse.Raw, - Cohere.StreamedChatResponse -> = core.serialization - .union(core.serialization.discriminant("eventType", "event_type"), { - "stream-start": ChatStreamStartEvent, - "search-queries-generation": ChatSearchQueriesGenerationEvent, - "search-results": ChatSearchResultsEvent, - "text-generation": ChatTextGenerationEvent, - "citation-generation": ChatCitationGenerationEvent, - "tool-calls-generation": ChatToolCallsGenerationEvent, - "stream-end": ChatStreamEndEvent, - "tool-calls-chunk": ChatToolCallsChunkEvent, - debug: ChatDebugEvent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace StreamedChatResponse { - type Raw = - | StreamedChatResponse.StreamStart - | StreamedChatResponse.SearchQueriesGeneration - | StreamedChatResponse.SearchResults - | StreamedChatResponse.TextGeneration - | StreamedChatResponse.CitationGeneration - | StreamedChatResponse.ToolCallsGeneration - | StreamedChatResponse.StreamEnd - | StreamedChatResponse.ToolCallsChunk - | StreamedChatResponse.Debug; - - interface StreamStart extends ChatStreamStartEvent.Raw { - event_type: "stream-start"; - } - - interface SearchQueriesGeneration extends ChatSearchQueriesGenerationEvent.Raw { - event_type: "search-queries-generation"; - } - - interface SearchResults extends ChatSearchResultsEvent.Raw { - event_type: "search-results"; - } - - interface TextGeneration extends ChatTextGenerationEvent.Raw { - event_type: "text-generation"; - } - - interface CitationGeneration extends ChatCitationGenerationEvent.Raw { - event_type: "citation-generation"; - } - - interface ToolCallsGeneration extends ChatToolCallsGenerationEvent.Raw { - event_type: "tool-calls-generation"; - } - - interface StreamEnd extends ChatStreamEndEvent.Raw { - event_type: "stream-end"; - } - - interface ToolCallsChunk extends ChatToolCallsChunkEvent.Raw { - event_type: "tool-calls-chunk"; - } - - interface Debug extends ChatDebugEvent.Raw { - event_type: "debug"; - } -} diff --git a/src/serialization/types/StreamedChatResponseV2.ts b/src/serialization/types/StreamedChatResponseV2.ts deleted file mode 100644 index 43023467..00000000 --- a/src/serialization/types/StreamedChatResponseV2.ts +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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 { CitationStartEvent } from "./CitationStartEvent"; -import { CitationEndEvent } from "./CitationEndEvent"; -import { ChatMessageEndEvent } from "./ChatMessageEndEvent"; -import { ChatDebugEvent } from "./ChatDebugEvent"; - -export const StreamedChatResponseV2: core.serialization.Schema< - serializers.StreamedChatResponseV2.Raw, - Cohere.StreamedChatResponseV2 -> = 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, - "citation-start": CitationStartEvent, - "citation-end": CitationEndEvent, - "message-end": ChatMessageEndEvent, - debug: ChatDebugEvent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace StreamedChatResponseV2 { - type Raw = - | StreamedChatResponseV2.MessageStart - | StreamedChatResponseV2.ContentStart - | StreamedChatResponseV2.ContentDelta - | StreamedChatResponseV2.ContentEnd - | StreamedChatResponseV2.ToolPlanDelta - | StreamedChatResponseV2.ToolCallStart - | StreamedChatResponseV2.ToolCallDelta - | StreamedChatResponseV2.ToolCallEnd - | StreamedChatResponseV2.CitationStart - | StreamedChatResponseV2.CitationEnd - | StreamedChatResponseV2.MessageEnd - | StreamedChatResponseV2.Debug; - - 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 CitationStart extends CitationStartEvent.Raw { - type: "citation-start"; - } - - interface CitationEnd extends CitationEndEvent.Raw { - type: "citation-end"; - } - - interface MessageEnd extends ChatMessageEndEvent.Raw { - type: "message-end"; - } - - interface Debug extends ChatDebugEvent.Raw { - type: "debug"; - } -} diff --git a/src/serialization/types/SummarizeRequestExtractiveness.ts b/src/serialization/types/SummarizeRequestExtractiveness.ts deleted file mode 100644 index ba5686e1..00000000 --- a/src/serialization/types/SummarizeRequestExtractiveness.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 SummarizeRequestExtractiveness: core.serialization.Schema< - serializers.SummarizeRequestExtractiveness.Raw, - Cohere.SummarizeRequestExtractiveness -> = core.serialization.enum_(["low", "medium", "high"]); - -export declare namespace SummarizeRequestExtractiveness { - type Raw = "low" | "medium" | "high"; -} diff --git a/src/serialization/types/SummarizeRequestFormat.ts b/src/serialization/types/SummarizeRequestFormat.ts deleted file mode 100644 index cdeafb7b..00000000 --- a/src/serialization/types/SummarizeRequestFormat.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 SummarizeRequestFormat: core.serialization.Schema< - serializers.SummarizeRequestFormat.Raw, - Cohere.SummarizeRequestFormat -> = core.serialization.enum_(["paragraph", "bullets"]); - -export declare namespace SummarizeRequestFormat { - type Raw = "paragraph" | "bullets"; -} diff --git a/src/serialization/types/SummarizeRequestLength.ts b/src/serialization/types/SummarizeRequestLength.ts deleted file mode 100644 index 50bfa849..00000000 --- a/src/serialization/types/SummarizeRequestLength.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 SummarizeRequestLength: core.serialization.Schema< - serializers.SummarizeRequestLength.Raw, - Cohere.SummarizeRequestLength -> = core.serialization.enum_(["short", "medium", "long"]); - -export declare namespace SummarizeRequestLength { - type Raw = "short" | "medium" | "long"; -} diff --git a/src/serialization/types/SummarizeResponse.ts b/src/serialization/types/SummarizeResponse.ts deleted file mode 100644 index ed45f61c..00000000 --- a/src/serialization/types/SummarizeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { ApiMeta } from "./ApiMeta"; - -export const SummarizeResponse: core.serialization.ObjectSchema< - serializers.SummarizeResponse.Raw, - Cohere.SummarizeResponse -> = core.serialization.object({ - id: core.serialization.string().optional(), - summary: core.serialization.string().optional(), - meta: ApiMeta.optional(), -}); - -export declare namespace SummarizeResponse { - interface Raw { - id?: string | null; - summary?: string | null; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/SystemMessage.ts b/src/serialization/types/SystemMessage.ts deleted file mode 100644 index fd66e622..00000000 --- a/src/serialization/types/SystemMessage.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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/types/SystemMessageContent.ts b/src/serialization/types/SystemMessageContent.ts deleted file mode 100644 index 943785f4..00000000 --- a/src/serialization/types/SystemMessageContent.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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/types/SystemMessageContentItem.ts b/src/serialization/types/SystemMessageContentItem.ts deleted file mode 100644 index 6e646f08..00000000 --- a/src/serialization/types/SystemMessageContentItem.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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/types/TextContent.ts b/src/serialization/types/TextContent.ts deleted file mode 100644 index 14d98a2d..00000000 --- a/src/serialization/types/TextContent.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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/types/TextResponseFormat.ts b/src/serialization/types/TextResponseFormat.ts deleted file mode 100644 index 248c5a0d..00000000 --- a/src/serialization/types/TextResponseFormat.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 TextResponseFormat: core.serialization.ObjectSchema< - serializers.TextResponseFormat.Raw, - Cohere.TextResponseFormat -> = core.serialization.object({}); - -export declare namespace TextResponseFormat { - interface Raw {} -} diff --git a/src/serialization/types/TextResponseFormatV2.ts b/src/serialization/types/TextResponseFormatV2.ts deleted file mode 100644 index e4213f39..00000000 --- a/src/serialization/types/TextResponseFormatV2.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 TextResponseFormatV2: core.serialization.ObjectSchema< - serializers.TextResponseFormatV2.Raw, - Cohere.TextResponseFormatV2 -> = core.serialization.object({}); - -export declare namespace TextResponseFormatV2 { - interface Raw {} -} diff --git a/src/serialization/types/TokenizeResponse.ts b/src/serialization/types/TokenizeResponse.ts deleted file mode 100644 index fc49f509..00000000 --- a/src/serialization/types/TokenizeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { ApiMeta } from "./ApiMeta"; - -export const TokenizeResponse: core.serialization.ObjectSchema< - serializers.TokenizeResponse.Raw, - Cohere.TokenizeResponse -> = core.serialization.object({ - tokens: core.serialization.list(core.serialization.number()), - tokenStrings: core.serialization.property("token_strings", core.serialization.list(core.serialization.string())), - meta: ApiMeta.optional(), -}); - -export declare namespace TokenizeResponse { - interface Raw { - tokens: number[]; - token_strings: string[]; - meta?: ApiMeta.Raw | null; - } -} diff --git a/src/serialization/types/Tool.ts b/src/serialization/types/Tool.ts deleted file mode 100644 index 8f87b5ef..00000000 --- a/src/serialization/types/Tool.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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 { ToolParameterDefinitionsValue } from "./ToolParameterDefinitionsValue"; - -export const Tool: core.serialization.ObjectSchema = core.serialization.object({ - name: core.serialization.string(), - description: core.serialization.string(), - parameterDefinitions: core.serialization.property( - "parameter_definitions", - core.serialization.record(core.serialization.string(), ToolParameterDefinitionsValue).optional() - ), -}); - -export declare namespace Tool { - interface Raw { - name: string; - description: string; - parameter_definitions?: Record | null; - } -} diff --git a/src/serialization/types/ToolCall.ts b/src/serialization/types/ToolCall.ts deleted file mode 100644 index e4165a04..00000000 --- a/src/serialization/types/ToolCall.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 ToolCall: core.serialization.ObjectSchema = - core.serialization.object({ - name: core.serialization.string(), - parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()), - }); - -export declare namespace ToolCall { - interface Raw { - name: string; - parameters: Record; - } -} diff --git a/src/serialization/types/ToolCallDelta.ts b/src/serialization/types/ToolCallDelta.ts deleted file mode 100644 index 616f19c0..00000000 --- a/src/serialization/types/ToolCallDelta.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 ToolCallDelta: core.serialization.ObjectSchema = - core.serialization.object({ - name: core.serialization.string().optional(), - index: core.serialization.number().optional(), - parameters: core.serialization.string().optional(), - text: core.serialization.string().optional(), - }); - -export declare namespace ToolCallDelta { - interface Raw { - name?: string | null; - index?: number | null; - parameters?: string | null; - text?: string | null; - } -} diff --git a/src/serialization/types/ToolCallV2.ts b/src/serialization/types/ToolCallV2.ts deleted file mode 100644 index b0e497bb..00000000 --- a/src/serialization/types/ToolCallV2.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ToolCallV2Function } from "./ToolCallV2Function"; - -export const ToolCallV2: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string().optional(), - type: core.serialization.stringLiteral("function").optional(), - function: ToolCallV2Function.optional(), - }); - -export declare namespace ToolCallV2 { - interface Raw { - id?: string | null; - type?: "function" | null; - function?: ToolCallV2Function.Raw | null; - } -} diff --git a/src/serialization/types/ToolCallV2Function.ts b/src/serialization/types/ToolCallV2Function.ts deleted file mode 100644 index ccf63867..00000000 --- a/src/serialization/types/ToolCallV2Function.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 ToolCallV2Function: core.serialization.ObjectSchema< - serializers.ToolCallV2Function.Raw, - Cohere.ToolCallV2Function -> = core.serialization.object({ - name: core.serialization.string().optional(), - arguments: core.serialization.string().optional(), -}); - -export declare namespace ToolCallV2Function { - interface Raw { - name?: string | null; - arguments?: string | null; - } -} diff --git a/src/serialization/types/ToolContent.ts b/src/serialization/types/ToolContent.ts deleted file mode 100644 index 398581e8..00000000 --- a/src/serialization/types/ToolContent.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 ToolContent: core.serialization.Schema = - core.serialization - .union("type", { - text: TextContent, - document: DocumentContent, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace ToolContent { - type Raw = ToolContent.Text | ToolContent.Document; - - interface Text extends TextContent.Raw { - type: "text"; - } - - interface Document extends DocumentContent.Raw { - type: "document"; - } -} diff --git a/src/serialization/types/ToolMessage.ts b/src/serialization/types/ToolMessage.ts deleted file mode 100644 index 2844172e..00000000 --- a/src/serialization/types/ToolMessage.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 { ToolResult } from "./ToolResult"; - -export const ToolMessage: core.serialization.ObjectSchema = - core.serialization.object({ - toolResults: core.serialization.property("tool_results", core.serialization.list(ToolResult).optional()), - }); - -export declare namespace ToolMessage { - interface Raw { - tool_results?: ToolResult.Raw[] | null; - } -} diff --git a/src/serialization/types/ToolMessageV2.ts b/src/serialization/types/ToolMessageV2.ts deleted file mode 100644 index 605a8fe7..00000000 --- a/src/serialization/types/ToolMessageV2.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { ToolMessageV2Content } from "./ToolMessageV2Content"; - -export const ToolMessageV2: core.serialization.ObjectSchema = - core.serialization.object({ - toolCallId: core.serialization.property("tool_call_id", core.serialization.string()), - content: ToolMessageV2Content, - }); - -export declare namespace ToolMessageV2 { - interface Raw { - tool_call_id: string; - content: ToolMessageV2Content.Raw; - } -} diff --git a/src/serialization/types/ToolMessageV2Content.ts b/src/serialization/types/ToolMessageV2Content.ts deleted file mode 100644 index c1179733..00000000 --- a/src/serialization/types/ToolMessageV2Content.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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 ToolMessageV2Content: core.serialization.Schema< - serializers.ToolMessageV2Content.Raw, - Cohere.ToolMessageV2Content -> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(ToolContent)]); - -export declare namespace ToolMessageV2Content { - type Raw = string | ToolContent.Raw[]; -} diff --git a/src/serialization/types/ToolParameterDefinitionsValue.ts b/src/serialization/types/ToolParameterDefinitionsValue.ts deleted file mode 100644 index 3f385188..00000000 --- a/src/serialization/types/ToolParameterDefinitionsValue.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 ToolParameterDefinitionsValue: core.serialization.ObjectSchema< - serializers.ToolParameterDefinitionsValue.Raw, - Cohere.ToolParameterDefinitionsValue -> = core.serialization.object({ - description: core.serialization.string().optional(), - type: core.serialization.string(), - required: core.serialization.boolean().optional(), -}); - -export declare namespace ToolParameterDefinitionsValue { - interface Raw { - description?: string | null; - type: string; - required?: boolean | null; - } -} diff --git a/src/serialization/types/ToolResult.ts b/src/serialization/types/ToolResult.ts deleted file mode 100644 index 34e43642..00000000 --- a/src/serialization/types/ToolResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 { ToolCall } from "./ToolCall"; - -export const ToolResult: core.serialization.ObjectSchema = - core.serialization.object({ - call: ToolCall, - outputs: core.serialization.list( - core.serialization.record(core.serialization.string(), core.serialization.unknown()) - ), - }); - -export declare namespace ToolResult { - interface Raw { - call: ToolCall.Raw; - outputs: Record[]; - } -} diff --git a/src/serialization/types/ToolSource.ts b/src/serialization/types/ToolSource.ts deleted file mode 100644 index c97d3688..00000000 --- a/src/serialization/types/ToolSource.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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/types/ToolV2.ts b/src/serialization/types/ToolV2.ts deleted file mode 100644 index 8cbc0e5b..00000000 --- a/src/serialization/types/ToolV2.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 { ToolV2Function } from "./ToolV2Function"; - -export const ToolV2: core.serialization.ObjectSchema = core.serialization.object( - { - type: core.serialization.stringLiteral("function").optional(), - function: ToolV2Function.optional(), - } -); - -export declare namespace ToolV2 { - interface Raw { - type?: "function" | null; - function?: ToolV2Function.Raw | null; - } -} diff --git a/src/serialization/types/ToolV2Function.ts b/src/serialization/types/ToolV2Function.ts deleted file mode 100644 index e56b4608..00000000 --- a/src/serialization/types/ToolV2Function.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 ToolV2Function: core.serialization.ObjectSchema = - core.serialization.object({ - name: core.serialization.string(), - description: core.serialization.string().optional(), - parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()), - }); - -export declare namespace ToolV2Function { - interface Raw { - name: string; - description?: string | null; - parameters: Record; - } -} diff --git a/src/serialization/types/TruncationStrategy.ts b/src/serialization/types/TruncationStrategy.ts deleted file mode 100644 index 96507b34..00000000 --- a/src/serialization/types/TruncationStrategy.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 { TruncationStrategyAutoPreserveOrder } from "./TruncationStrategyAutoPreserveOrder"; -import { TruncationStrategyNone } from "./TruncationStrategyNone"; - -export const TruncationStrategy: core.serialization.Schema< - serializers.TruncationStrategy.Raw, - Cohere.TruncationStrategy -> = core.serialization - .union("type", { - auto: TruncationStrategyAutoPreserveOrder, - none: TruncationStrategyNone, - }) - .transform({ - transform: (value) => value, - untransform: (value) => value, - }); - -export declare namespace TruncationStrategy { - type Raw = TruncationStrategy.Auto | TruncationStrategy.None; - - interface Auto extends TruncationStrategyAutoPreserveOrder.Raw { - type: "auto"; - } - - interface None extends TruncationStrategyNone.Raw { - type: "none"; - } -} diff --git a/src/serialization/types/TruncationStrategyAutoPreserveOrder.ts b/src/serialization/types/TruncationStrategyAutoPreserveOrder.ts deleted file mode 100644 index eb65db7b..00000000 --- a/src/serialization/types/TruncationStrategyAutoPreserveOrder.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 TruncationStrategyAutoPreserveOrder: core.serialization.ObjectSchema< - serializers.TruncationStrategyAutoPreserveOrder.Raw, - Cohere.TruncationStrategyAutoPreserveOrder -> = core.serialization.object({}); - -export declare namespace TruncationStrategyAutoPreserveOrder { - interface Raw {} -} diff --git a/src/serialization/types/TruncationStrategyNone.ts b/src/serialization/types/TruncationStrategyNone.ts deleted file mode 100644 index 65243dab..00000000 --- a/src/serialization/types/TruncationStrategyNone.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 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 TruncationStrategyNone: core.serialization.ObjectSchema< - serializers.TruncationStrategyNone.Raw, - Cohere.TruncationStrategyNone -> = core.serialization.object({}); - -export declare namespace TruncationStrategyNone { - interface Raw {} -} diff --git a/src/serialization/types/UpdateConnectorResponse.ts b/src/serialization/types/UpdateConnectorResponse.ts deleted file mode 100644 index e1bff845..00000000 --- a/src/serialization/types/UpdateConnectorResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 { Connector } from "./Connector"; - -export const UpdateConnectorResponse: core.serialization.ObjectSchema< - serializers.UpdateConnectorResponse.Raw, - Cohere.UpdateConnectorResponse -> = core.serialization.object({ - connector: Connector, -}); - -export declare namespace UpdateConnectorResponse { - interface Raw { - connector: Connector.Raw; - } -} diff --git a/src/serialization/types/Usage.ts b/src/serialization/types/Usage.ts deleted file mode 100644 index 2bb70311..00000000 --- a/src/serialization/types/Usage.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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/types/UsageBilledUnits.ts b/src/serialization/types/UsageBilledUnits.ts deleted file mode 100644 index 41e9f61d..00000000 --- a/src/serialization/types/UsageBilledUnits.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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/types/UsageTokens.ts b/src/serialization/types/UsageTokens.ts deleted file mode 100644 index 20f7a955..00000000 --- a/src/serialization/types/UsageTokens.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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/types/UserMessage.ts b/src/serialization/types/UserMessage.ts deleted file mode 100644 index ec9b75d5..00000000 --- a/src/serialization/types/UserMessage.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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/types/UserMessageContent.ts b/src/serialization/types/UserMessageContent.ts deleted file mode 100644 index 1260a9a2..00000000 --- a/src/serialization/types/UserMessageContent.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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/types/index.ts b/src/serialization/types/index.ts deleted file mode 100644 index e13942c0..00000000 --- a/src/serialization/types/index.ts +++ /dev/null @@ -1,199 +0,0 @@ -export * from "./ChatStreamRequestPromptTruncation"; -export * from "./ChatStreamRequestCitationQuality"; -export * from "./ChatStreamRequestConnectorsSearchOptions"; -export * from "./ChatStreamRequestSafetyMode"; -export * from "./ChatRequestPromptTruncation"; -export * from "./ChatRequestCitationQuality"; -export * from "./ChatRequestConnectorsSearchOptions"; -export * from "./ChatRequestSafetyMode"; -export * from "./GenerateStreamRequestTruncate"; -export * from "./GenerateStreamRequestReturnLikelihoods"; -export * from "./GenerateRequestTruncate"; -export * from "./GenerateRequestReturnLikelihoods"; -export * from "./EmbedRequestTruncate"; -export * from "./EmbedResponse"; -export * from "./RerankRequestDocumentsItem"; -export * from "./RerankResponseResultsItemDocument"; -export * from "./RerankResponseResultsItem"; -export * from "./RerankResponse"; -export * from "./ClassifyRequestTruncate"; -export * from "./ClassifyResponseClassificationsItemLabelsValue"; -export * from "./ClassifyResponseClassificationsItemClassificationType"; -export * from "./ClassifyResponseClassificationsItem"; -export * from "./ClassifyResponse"; -export * from "./SummarizeRequestLength"; -export * from "./SummarizeRequestFormat"; -export * from "./SummarizeRequestExtractiveness"; -export * from "./SummarizeResponse"; -export * from "./TokenizeResponse"; -export * from "./DetokenizeResponse"; -export * from "./CheckApiKeyResponse"; -export * from "./ToolCall"; -export * from "./ChatMessage"; -export * from "./ToolResult"; -export * from "./ToolMessage"; -export * from "./Message"; -export * from "./ChatConnector"; -export * from "./ChatDocument"; -export * from "./ToolParameterDefinitionsValue"; -export * from "./Tool"; -export * from "./TextResponseFormat"; -export * from "./JsonResponseFormat"; -export * from "./ResponseFormat"; -export * from "./ChatCitationType"; -export * from "./ChatCitation"; -export * from "./ChatSearchQuery"; -export * from "./ChatSearchResultConnector"; -export * from "./ChatSearchResult"; -export * from "./FinishReason"; -export * from "./ApiMetaApiVersion"; -export * from "./ApiMetaBilledUnits"; -export * from "./ApiMetaTokens"; -export * from "./ApiMeta"; -export * from "./NonStreamedChatResponse"; -export * from "./ChatStreamEvent"; -export * from "./ChatStreamStartEvent"; -export * from "./ChatSearchQueriesGenerationEvent"; -export * from "./ChatSearchResultsEvent"; -export * from "./ChatTextGenerationEvent"; -export * from "./ChatCitationGenerationEvent"; -export * from "./ChatToolCallsGenerationEvent"; -export * from "./ChatStreamEndEventFinishReason"; -export * from "./ChatStreamEndEvent"; -export * from "./ToolCallDelta"; -export * from "./ChatToolCallsChunkEvent"; -export * from "./ChatDebugEvent"; -export * from "./StreamedChatResponse"; -export * from "./TextContent"; -export * from "./ImageUrl"; -export * from "./ImageContent"; -export * from "./Content"; -export * from "./UserMessageContent"; -export * from "./UserMessage"; -export * from "./ToolCallV2Function"; -export * from "./ToolCallV2"; -export * from "./ToolSource"; -export * from "./DocumentSource"; -export * from "./Source"; -export * from "./CitationType"; -export * from "./Citation"; -export * from "./AssistantMessageContentItem"; -export * from "./AssistantMessageContent"; -export * from "./AssistantMessage"; -export * from "./SystemMessageContentItem"; -export * from "./SystemMessageContent"; -export * from "./SystemMessage"; -export * from "./Document"; -export * from "./DocumentContent"; -export * from "./ToolContent"; -export * from "./ToolMessageV2Content"; -export * from "./ToolMessageV2"; -export * from "./ChatMessageV2"; -export * from "./ChatMessages"; -export * from "./ReasoningEffort"; -export * from "./ToolV2Function"; -export * from "./ToolV2"; -export * from "./CitationOptionsMode"; -export * from "./CitationOptions"; -export * from "./TruncationStrategyAutoPreserveOrder"; -export * from "./TruncationStrategyNone"; -export * from "./TruncationStrategy"; -export * from "./TextResponseFormatV2"; -export * from "./JsonResponseFormatV2"; -export * from "./ResponseFormatV2"; -export * from "./ChatFinishReason"; -export * from "./AssistantMessageResponseContentItem"; -export * from "./AssistantMessageResponse"; -export * from "./UsageBilledUnits"; -export * from "./UsageTokens"; -export * from "./Usage"; -export * from "./LogprobItem"; -export * from "./ChatResponse"; -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 "./ChatToolPlanDeltaEventDeltaMessage"; -export * from "./ChatToolPlanDeltaEventDelta"; -export * from "./ChatToolPlanDeltaEvent"; -export * from "./ChatToolCallStartEventDeltaMessage"; -export * from "./ChatToolCallStartEventDelta"; -export * from "./ChatToolCallStartEvent"; -export * from "./ChatToolCallDeltaEventDeltaMessageToolCallsFunction"; -export * from "./ChatToolCallDeltaEventDeltaMessageToolCalls"; -export * from "./ChatToolCallDeltaEventDeltaMessage"; -export * from "./ChatToolCallDeltaEventDelta"; -export * from "./ChatToolCallDeltaEvent"; -export * from "./ChatToolCallEndEvent"; -export * from "./CitationStartEventDeltaMessage"; -export * from "./CitationStartEventDelta"; -export * from "./CitationStartEvent"; -export * from "./CitationEndEvent"; -export * from "./ChatMessageEndEventDelta"; -export * from "./ChatMessageEndEvent"; -export * from "./StreamedChatResponseV2"; -export * from "./SingleGenerationTokenLikelihoodsItem"; -export * from "./SingleGeneration"; -export * from "./Generation"; -export * from "./GenerateStreamEvent"; -export * from "./GenerateStreamText"; -export * from "./SingleGenerationInStream"; -export * from "./GenerateStreamEndResponse"; -export * from "./GenerateStreamEnd"; -export * from "./GenerateStreamError"; -export * from "./GenerateStreamedResponse"; -export * from "./EmbedInputType"; -export * from "./EmbeddingType"; -export * from "./Image"; -export * from "./EmbedFloatsResponse"; -export * from "./EmbedByTypeResponseEmbeddings"; -export * from "./EmbedByTypeResponse"; -export * from "./EmbedImageUrl"; -export * from "./EmbedImage"; -export * from "./EmbedText"; -export * from "./EmbedContent"; -export * from "./EmbedInput"; -export * from "./EmbedJobStatus"; -export * from "./EmbedJobTruncate"; -export * from "./EmbedJob"; -export * from "./ListEmbedJobResponse"; -export * from "./CreateEmbedJobResponse"; -export * from "./RerankDocument"; -export * from "./ClassifyExample"; -export * from "./DatasetValidationStatus"; -export * from "./DatasetType"; -export * from "./DatasetPart"; -export * from "./ParseInfo"; -export * from "./RerankerDataMetrics"; -export * from "./ChatDataMetrics"; -export * from "./LabelMetric"; -export * from "./ClassifyDataMetrics"; -export * from "./FinetuneDatasetMetrics"; -export * from "./MetricsEmbedDataFieldsItem"; -export * from "./MetricsEmbedData"; -export * from "./Metrics"; -export * from "./Dataset"; -export * from "./ConnectorOAuth"; -export * from "./ConnectorAuthStatus"; -export * from "./Connector"; -export * from "./ListConnectorsResponse"; -export * from "./CreateConnectorOAuth"; -export * from "./AuthTokenType"; -export * from "./CreateConnectorServiceAuth"; -export * from "./CreateConnectorResponse"; -export * from "./GetConnectorResponse"; -export * from "./DeleteConnectorResponse"; -export * from "./UpdateConnectorResponse"; -export * from "./OAuthAuthorizeResponse"; -export * from "./CompatibleEndpoint"; -export * from "./GetModelResponse"; -export * from "./ListModelsResponse"; diff --git a/src/version.ts b/src/version.ts index d200da59..a6db4fb4 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "7.17.1"; +export const SDK_VERSION = "7.18.0"; diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts index fc35704e..79ef9799 100644 --- a/tests/unit/auth/BasicAuth.test.ts +++ b/tests/unit/auth/BasicAuth.test.ts @@ -7,7 +7,7 @@ describe("BasicAuth", () => { BasicAuth.toAuthorizationHeader({ username: "username", password: "password", - }) + }), ).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ="); }); }); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts index ff804217..a32945e9 100644 --- a/tests/unit/fetcher/Fetcher.test.ts +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -1,7 +1,8 @@ import fs from "fs"; -import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; import { join } from "path"; +import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + describe("Test fetcherImpl", () => { it("should handle successful request", async () => { const mockArgs: Fetcher.Args = { @@ -32,7 +33,7 @@ describe("Test fetcherImpl", () => { method: "POST", headers: expect.objectContaining({ "X-Test": "x-test-header" }), body: JSON.stringify({ data: "test" }), - }) + }), ); }); @@ -63,7 +64,7 @@ describe("Test fetcherImpl", () => { method: "POST", headers: expect.objectContaining({ "X-Test": "x-test-header" }), body: expect.any(fs.ReadStream), - }) + }), ); expect(result.ok).toBe(true); if (result.ok) { diff --git a/tests/unit/fetcher/HttpResponsePromise.test.ts b/tests/unit/fetcher/HttpResponsePromise.test.ts new file mode 100644 index 00000000..2216a33e --- /dev/null +++ b/tests/unit/fetcher/HttpResponsePromise.test.ts @@ -0,0 +1,143 @@ +import { beforeEach, describe, expect, it, jest } from "@jest/globals"; + +import { HttpResponsePromise } from "../../../src/core/fetcher/HttpResponsePromise"; +import { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; + +describe("HttpResponsePromise", () => { + const mockRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 200, + statusText: "OK", + type: "basic" as ResponseType, + url: "https://example.com", + }; + const mockData = { id: "123", name: "test" }; + const mockWithRawResponse: WithRawResponse = { + data: mockData, + rawResponse: mockRawResponse, + }; + + describe("fromFunction", () => { + it("should create an HttpResponsePromise from a function", async () => { + const mockFn = jest + .fn<(arg1: string, arg2: string) => Promise>>() + .mockResolvedValue(mockWithRawResponse); + + const responsePromise = HttpResponsePromise.fromFunction(mockFn, "arg1", "arg2"); + + const result = await responsePromise; + expect(result).toEqual(mockData); + expect(mockFn).toHaveBeenCalledWith("arg1", "arg2"); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromPromise", () => { + it("should create an HttpResponsePromise from a promise", async () => { + const promise = Promise.resolve(mockWithRawResponse); + + const responsePromise = HttpResponsePromise.fromPromise(promise); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromExecutor", () => { + it("should create an HttpResponsePromise from an executor function", async () => { + const responsePromise = HttpResponsePromise.fromExecutor((resolve) => { + resolve(mockWithRawResponse); + }); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromResult", () => { + it("should create an HttpResponsePromise from a result", async () => { + const responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("Promise methods", () => { + let responsePromise: HttpResponsePromise; + + beforeEach(() => { + responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + }); + + it("should support then() method", async () => { + const result = await responsePromise.then((data) => ({ + ...data, + modified: true, + })); + + expect(result).toEqual({ + ...mockData, + modified: true, + }); + }); + + it("should support catch() method", async () => { + const errorResponsePromise = HttpResponsePromise.fromExecutor((_, reject) => { + reject(new Error("Test error")); + }); + + const catchSpy = jest.fn(); + await errorResponsePromise.catch(catchSpy); + + expect(catchSpy).toHaveBeenCalled(); + const error = catchSpy.mock.calls[0]?.[0]; + expect(error).toBeInstanceOf(Error); + expect((error as Error).message).toBe("Test error"); + }); + + it("should support finally() method", async () => { + const finallySpy = jest.fn(); + await responsePromise.finally(finallySpy); + + expect(finallySpy).toHaveBeenCalled(); + }); + }); + + describe("withRawResponse", () => { + it("should return both data and raw response", async () => { + const responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + + const result = await responsePromise.withRawResponse(); + + expect(result).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); +}); diff --git a/tests/unit/fetcher/RawResponse.test.ts b/tests/unit/fetcher/RawResponse.test.ts new file mode 100644 index 00000000..9ccd5e1e --- /dev/null +++ b/tests/unit/fetcher/RawResponse.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from "@jest/globals"; + +import { toRawResponse } from "../../../src/core/fetcher/RawResponse"; + +describe("RawResponse", () => { + describe("toRawResponse", () => { + it("should convert Response to RawResponse by removing body, bodyUsed, and ok properties", () => { + const mockHeaders = new Headers({ "content-type": "application/json" }); + const mockResponse = { + body: "test body", + bodyUsed: false, + ok: true, + headers: mockHeaders, + redirected: false, + status: 200, + statusText: "OK", + type: "basic" as ResponseType, + url: "https://example.com", + }; + + const result = toRawResponse(mockResponse as unknown as Response); + + expect("body" in result).toBe(false); + expect("bodyUsed" in result).toBe(false); + expect("ok" in result).toBe(false); + expect(result.headers).toBe(mockHeaders); + expect(result.redirected).toBe(false); + expect(result.status).toBe(200); + expect(result.statusText).toBe("OK"); + expect(result.type).toBe("basic"); + expect(result.url).toBe("https://example.com"); + }); + }); +}); diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index f2cd24b6..486e1e61 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -22,7 +22,7 @@ describe("Test createRequestUrl", () => { const baseUrl = "https://api.example.com"; const queryParams = { filter: { name: "John", age: 30 } }; expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30" + "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", ); }); @@ -34,7 +34,7 @@ describe("Test createRequestUrl", () => { object: { key: "value" }, }; expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value" + "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", ); }); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts index be94ab45..43ed9d11 100644 --- a/tests/unit/fetcher/makeRequest.test.ts +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -1,4 +1,3 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { makeRequest } from "../../../src/core/fetcher/makeRequest"; describe("Test makeRequest", () => { @@ -27,7 +26,7 @@ describe("Test makeRequest", () => { headers: mockHeaders, body: mockBody, credentials: undefined, - }) + }), ); expect(calledOptions.signal).toBeDefined(); expect(calledOptions.signal).toBeInstanceOf(AbortSignal); @@ -46,7 +45,7 @@ describe("Test makeRequest", () => { headers: mockHeaders, body: undefined, credentials: undefined, - }) + }), ); expect(calledOptions.signal).toBeDefined(); expect(calledOptions.signal).toBeInstanceOf(AbortSignal); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts index 6f77f093..3cdaa40a 100644 --- a/tests/unit/fetcher/requestWithRetries.test.ts +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -1,4 +1,3 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; describe("requestWithRetries", () => { @@ -23,12 +22,12 @@ describe("requestWithRetries", () => { }); it("should retry on retryable status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); - const retryableStatuses = [408, 409, 429, 500, 502]; + const retryableStatuses = [408, 429, 500, 502]; let callCount = 0; mockFetch.mockImplementation(async () => { @@ -47,7 +46,7 @@ describe("requestWithRetries", () => { }); it("should respect maxRetries limit", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -64,7 +63,7 @@ describe("requestWithRetries", () => { }); it("should not retry on success status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -86,7 +85,7 @@ describe("requestWithRetries", () => { }); it("should apply correct exponential backoff with jitter", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -110,7 +109,7 @@ describe("requestWithRetries", () => { }); it("should handle concurrent retries independently", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts index 1dc9be0c..172c1c26 100644 --- a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts @@ -159,7 +159,7 @@ describe("Node18UniversalStreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode("test")); diff --git a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts index 0c99d3b2..19c26668 100644 --- a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts @@ -111,7 +111,7 @@ describe("NodePre18StreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); let data = ""; const stream = new NodePre18StreamWrapper(rawStream); diff --git a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts index 1d171ce6..0ea14835 100644 --- a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts @@ -134,7 +134,7 @@ describe("UndiciStreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode("test")); diff --git a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts index 17cf37a2..8004e9ab 100644 --- a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts @@ -1,8 +1,8 @@ import { RUNTIME } from "../../../../src/core/runtime"; -import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; +import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; describe("chooseStreamWrapper", () => { beforeEach(() => { diff --git a/tests/unit/fetcher/stream-wrappers/webpack.test.ts b/tests/unit/fetcher/stream-wrappers/webpack.test.ts index 557db6dc..f7537d3c 100644 --- a/tests/unit/fetcher/stream-wrappers/webpack.test.ts +++ b/tests/unit/fetcher/stream-wrappers/webpack.test.ts @@ -17,7 +17,11 @@ describe("test env compatibility", () => { ], }, resolve: { - extensions: [".tsx", ".ts", ".js"], + extensions: [".tsx", ".ts", ".jsx", ".js"], + extensionAlias: { + ".js": [".ts", ".js"], + ".jsx": [".tsx", ".jsx"], + }, }, }, (err, stats) => { @@ -31,8 +35,8 @@ describe("test env compatibility", () => { } catch (error) { reject(error); } - } + }, ); }); - }, 60_000); + }, 180_000); }); diff --git a/tests/unit/zurg/bigint/bigint.test.ts b/tests/unit/zurg/bigint/bigint.test.ts deleted file mode 100644 index cf9935a7..00000000 --- a/tests/unit/zurg/bigint/bigint.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { bigint } from "../../../../src/core/schemas/builders/bigint"; -import { itSchema } from "../utils/itSchema"; -import { itValidateJson, itValidateParse } from "../utils/itValidate"; - -describe("bigint", () => { - itSchema("converts between raw string and parsed bigint", bigint(), { - raw: "123456789012345678901234567890123456789012345678901234567890", - parsed: BigInt("123456789012345678901234567890123456789012345678901234567890"), - }); - - itValidateParse("non-string", bigint(), 42, [ - { - message: "Expected string. Received 42.", - path: [], - }, - ]); - - itValidateJson("non-bigint", bigint(), "hello", [ - { - message: 'Expected bigint. Received "hello".', - path: [], - }, - ]); -}); diff --git a/tests/unit/zurg/date/date.test.ts b/tests/unit/zurg/date/date.test.ts deleted file mode 100644 index 2790268a..00000000 --- a/tests/unit/zurg/date/date.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { date } from "../../../../src/core/schemas/builders/date"; -import { itSchema } from "../utils/itSchema"; -import { itValidateJson, itValidateParse } from "../utils/itValidate"; - -describe("date", () => { - itSchema("converts between raw ISO string and parsed Date", date(), { - raw: "2022-09-29T05:41:21.939Z", - parsed: new Date("2022-09-29T05:41:21.939Z"), - }); - - itValidateParse("non-string", date(), 42, [ - { - message: "Expected string. Received 42.", - path: [], - }, - ]); - - itValidateParse("non-ISO", date(), "hello world", [ - { - message: 'Expected ISO 8601 date string. Received "hello world".', - path: [], - }, - ]); - - itValidateJson("non-Date", date(), "hello", [ - { - message: 'Expected Date object. Received "hello".', - path: [], - }, - ]); -}); diff --git a/tests/unit/zurg/enum/enum.test.ts b/tests/unit/zurg/enum/enum.test.ts deleted file mode 100644 index ab0df028..00000000 --- a/tests/unit/zurg/enum/enum.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { enum_ } from "../../../../src/core/schemas/builders/enum"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("enum", () => { - itSchemaIdentity(enum_(["A", "B", "C"]), "A"); - - itSchemaIdentity(enum_(["A", "B", "C"]), "D" as any, { - opts: { allowUnrecognizedEnumValues: true }, - }); - - itValidate("invalid enum", enum_(["A", "B", "C"]), "D", [ - { - message: 'Expected enum. Received "D".', - path: [], - }, - ]); - - itValidate( - "non-string", - enum_(["A", "B", "C"]), - [], - [ - { - message: "Expected string. Received list.", - path: [], - }, - ] - ); -}); diff --git a/tests/unit/zurg/lazy/lazy.test.ts b/tests/unit/zurg/lazy/lazy.test.ts deleted file mode 100644 index 6906bf4c..00000000 --- a/tests/unit/zurg/lazy/lazy.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Schema } from "../../../../src/core/schemas/Schema"; -import { lazy, list, object, string } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; - -describe("lazy", () => { - it("doesn't run immediately", () => { - let wasRun = false; - lazy(() => { - wasRun = true; - return string(); - }); - expect(wasRun).toBe(false); - }); - - it("only runs first time", async () => { - let count = 0; - const schema = lazy(() => { - count++; - return string(); - }); - await schema.parse("hello"); - await schema.json("world"); - expect(count).toBe(1); - }); - - itSchemaIdentity( - lazy(() => object({})), - { foo: "hello" }, - { - title: "passes opts through", - opts: { unrecognizedObjectKeys: "passthrough" }, - } - ); - - itSchemaIdentity( - lazy(() => object({ foo: string() })), - { foo: "hello" } - ); - - // eslint-disable-next-line jest/expect-expect - it("self-referencial schema doesn't compile", () => { - () => { - // @ts-expect-error - const a = lazy(() => object({ foo: a })); - }; - }); - - // eslint-disable-next-line jest/expect-expect - it("self-referencial compiles with explicit type", () => { - () => { - interface TreeNode { - children: TreeNode[]; - } - const TreeNode: Schema = lazy(() => object({ children: list(TreeNode) })); - }; - }); -}); diff --git a/tests/unit/zurg/lazy/lazyObject.test.ts b/tests/unit/zurg/lazy/lazyObject.test.ts deleted file mode 100644 index 8813cc9f..00000000 --- a/tests/unit/zurg/lazy/lazyObject.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazyObject, number, object, string } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; - -describe("lazy", () => { - itSchemaIdentity( - lazyObject(() => object({ foo: string() })), - { foo: "hello" } - ); - - itSchemaIdentity( - lazyObject(() => object({ foo: string() })).extend(object({ bar: number() })), - { - foo: "hello", - bar: 42, - }, - { title: "returned schema has object utils" } - ); -}); diff --git a/tests/unit/zurg/lazy/recursive/a.ts b/tests/unit/zurg/lazy/recursive/a.ts deleted file mode 100644 index 8b7d5e40..00000000 --- a/tests/unit/zurg/lazy/recursive/a.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { object } from "../../../../../src/core/schemas/builders/object"; -import { schemaB } from "./b"; - -// @ts-expect-error -export const schemaA = object({ - b: schemaB, -}); diff --git a/tests/unit/zurg/lazy/recursive/b.ts b/tests/unit/zurg/lazy/recursive/b.ts deleted file mode 100644 index fb219d54..00000000 --- a/tests/unit/zurg/lazy/recursive/b.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { object } from "../../../../../src/core/schemas/builders/object"; -import { optional } from "../../../../../src/core/schemas/builders/schema-utils"; -import { schemaA } from "./a"; - -// @ts-expect-error -export const schemaB = object({ - a: optional(schemaA), -}); diff --git a/tests/unit/zurg/list/list.test.ts b/tests/unit/zurg/list/list.test.ts deleted file mode 100644 index 424ed642..00000000 --- a/tests/unit/zurg/list/list.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { list, object, property, string } from "../../../../src/core/schemas/builders"; -import { itSchema, itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("list", () => { - itSchemaIdentity(list(string()), ["hello", "world"], { - title: "functions as identity when item type is primitive", - }); - - itSchema( - "converts objects correctly", - list( - object({ - helloWorld: property("hello_world", string()), - }) - ), - { - raw: [{ hello_world: "123" }], - parsed: [{ helloWorld: "123" }], - } - ); - - itValidate("not a list", list(string()), 42, [ - { - path: [], - message: "Expected list. Received 42.", - }, - ]); - - itValidate( - "invalid item type", - list(string()), - [42], - [ - { - path: ["[0]"], - message: "Expected string. Received 42.", - }, - ] - ); -}); diff --git a/tests/unit/zurg/literals/stringLiteral.test.ts b/tests/unit/zurg/literals/stringLiteral.test.ts deleted file mode 100644 index fa6c8887..00000000 --- a/tests/unit/zurg/literals/stringLiteral.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { stringLiteral } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("stringLiteral", () => { - itSchemaIdentity(stringLiteral("A"), "A"); - - itValidate("incorrect string", stringLiteral("A"), "B", [ - { - path: [], - message: 'Expected "A". Received "B".', - }, - ]); - - itValidate("non-string", stringLiteral("A"), 42, [ - { - path: [], - message: 'Expected "A". Received 42.', - }, - ]); -}); diff --git a/tests/unit/zurg/object-like/withParsedProperties.test.ts b/tests/unit/zurg/object-like/withParsedProperties.test.ts deleted file mode 100644 index 9f5dd0ed..00000000 --- a/tests/unit/zurg/object-like/withParsedProperties.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; - -describe("withParsedProperties", () => { - it("Added properties included on parsed object", async () => { - const schema = object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }).withParsedProperties({ - printFoo: (parsed) => () => parsed.foo, - printHelloWorld: () => () => "Hello world", - helloWorld: "Hello world", - }); - - const parsed = await schema.parse({ raw_foo: "value of foo", bar: "bar" }); - if (!parsed.ok) { - throw new Error("Failed to parse"); - } - expect(parsed.value.printFoo()).toBe("value of foo"); - expect(parsed.value.printHelloWorld()).toBe("Hello world"); - expect(parsed.value.helloWorld).toBe("Hello world"); - }); - - it("Added property is removed on raw object", async () => { - const schema = object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }).withParsedProperties({ - printFoo: (parsed) => () => parsed.foo, - }); - - const original = { raw_foo: "value of foo", bar: "bar" } as const; - const parsed = await schema.parse(original); - if (!parsed.ok) { - throw new Error("Failed to parse()"); - } - - const raw = await schema.json(parsed.value); - - if (!raw.ok) { - throw new Error("Failed to json()"); - } - - expect(raw.value).toEqual(original); - }); - - describe("compile", () => { - // eslint-disable-next-line jest/expect-expect - it("doesn't compile with non-object schema", () => { - () => - object({ - foo: string(), - }) - // @ts-expect-error - .withParsedProperties(42); - }); - }); -}); diff --git a/tests/unit/zurg/object/extend.test.ts b/tests/unit/zurg/object/extend.test.ts deleted file mode 100644 index 54fc8c4e..00000000 --- a/tests/unit/zurg/object/extend.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { boolean, object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; -import { itSchema, itSchemaIdentity } from "../utils/itSchema"; - -describe("extend", () => { - itSchemaIdentity( - object({ - foo: string(), - }).extend( - object({ - bar: stringLiteral("bar"), - }) - ), - { - foo: "", - bar: "bar", - } as const, - { - title: "extended properties are included in schema", - } - ); - - itSchemaIdentity( - object({ - foo: string(), - }) - .extend( - object({ - bar: stringLiteral("bar"), - }) - ) - .extend( - object({ - baz: boolean(), - }) - ), - { - foo: "", - bar: "bar", - baz: true, - } as const, - { - title: "extensions can be extended", - } - ); - - itSchema( - "converts nested object", - object({ - item: object({ - helloWorld: property("hello_world", string()), - }), - }).extend( - object({ - goodbye: property("goodbye_raw", string()), - }) - ), - { - raw: { item: { hello_world: "yo" }, goodbye_raw: "peace" }, - parsed: { item: { helloWorld: "yo" }, goodbye: "peace" }, - } - ); - - itSchema( - "extensions work with raw/parsed property name conversions", - object({ - item: property("item_raw", string()), - }).extend( - object({ - goodbye: property("goodbye_raw", string()), - }) - ), - { - raw: { item_raw: "hi", goodbye_raw: "peace" }, - parsed: { item: "hi", goodbye: "peace" }, - } - ); - - describe("compile", () => { - // eslint-disable-next-line jest/expect-expect - it("doesn't compile with non-object schema", () => { - () => - object({ - foo: string(), - }) - // @ts-expect-error - .extend([]); - }); - }); -}); diff --git a/tests/unit/zurg/object/object.test.ts b/tests/unit/zurg/object/object.test.ts deleted file mode 100644 index 0acf0e24..00000000 --- a/tests/unit/zurg/object/object.test.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { any, number, object, property, string, stringLiteral, unknown } from "../../../../src/core/schemas/builders"; -import { itJson, itParse, itSchema, itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("object", () => { - itSchemaIdentity( - object({ - foo: string(), - bar: stringLiteral("bar"), - }), - { - foo: "", - bar: "bar", - }, - { - title: "functions as identity when values are primitives and property() isn't used", - } - ); - - itSchema( - "uses raw key from property()", - object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }), - { - raw: { raw_foo: "foo", bar: "bar" }, - parsed: { foo: "foo", bar: "bar" }, - } - ); - - itSchema( - "keys with unknown type can be omitted", - object({ - foo: unknown(), - }), - { - raw: {}, - parsed: {}, - } - ); - - itSchema( - "keys with any type can be omitted", - object({ - foo: any(), - }), - { - raw: {}, - parsed: {}, - } - ); - - describe("unrecognizedObjectKeys", () => { - describe("parse", () => { - itParse( - 'includes unknown values when unrecognizedObjectKeys === "passthrough"', - object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }), - { - raw: { - raw_foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - parsed: { - foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - opts: { - unrecognizedObjectKeys: "passthrough", - }, - } - ); - - itParse( - 'strips unknown values when unrecognizedObjectKeys === "strip"', - object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }), - { - raw: { - raw_foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - parsed: { - foo: "foo", - bar: "bar", - }, - opts: { - unrecognizedObjectKeys: "strip", - }, - } - ); - }); - - describe("json", () => { - itJson( - 'includes unknown values when unrecognizedObjectKeys === "passthrough"', - object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }), - { - raw: { - raw_foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - parsed: { - foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - opts: { - unrecognizedObjectKeys: "passthrough", - }, - } - ); - - itJson( - 'strips unknown values when unrecognizedObjectKeys === "strip"', - object({ - foo: property("raw_foo", string()), - bar: stringLiteral("bar"), - }), - { - raw: { - raw_foo: "foo", - bar: "bar", - }, - parsed: { - foo: "foo", - bar: "bar", - // @ts-expect-error - baz: "yoyo", - }, - opts: { - unrecognizedObjectKeys: "strip", - }, - } - ); - }); - }); - - describe("nullish properties", () => { - itSchema("missing properties are not added", object({ foo: property("raw_foo", string().optional()) }), { - raw: {}, - parsed: {}, - }); - - itSchema("undefined properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { - raw: { raw_foo: null }, - parsed: { foo: undefined }, - }); - - itSchema("null properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { - raw: { raw_foo: null }, - parsed: { foo: undefined }, - }); - - describe("extensions", () => { - itSchema( - "undefined properties are not dropped", - object({}).extend(object({ foo: property("raw_foo", string().optional()) })), - { - raw: { raw_foo: null }, - parsed: { foo: undefined }, - } - ); - - describe("parse()", () => { - itParse( - "null properties are not dropped", - object({}).extend(object({ foo: property("raw_foo", string().optional()) })), - { - raw: { raw_foo: null }, - parsed: { foo: undefined }, - } - ); - }); - }); - }); - - itValidate( - "missing property", - object({ - foo: string(), - bar: stringLiteral("bar"), - }), - { foo: "hello" }, - [ - { - path: [], - message: 'Missing required key "bar"', - }, - ] - ); - - itValidate( - "extra property", - object({ - foo: string(), - bar: stringLiteral("bar"), - }), - { foo: "hello", bar: "bar", baz: 42 }, - [ - { - path: ["baz"], - message: 'Unexpected key "baz"', - }, - ] - ); - - itValidate( - "not an object", - object({ - foo: string(), - bar: stringLiteral("bar"), - }), - [], - [ - { - path: [], - message: "Expected object. Received list.", - }, - ] - ); - - itValidate( - "nested validation error", - object({ - foo: object({ - bar: number(), - }), - }), - { foo: { bar: "hello" } }, - [ - { - path: ["foo", "bar"], - message: 'Expected number. Received "hello".', - }, - ] - ); -}); diff --git a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts deleted file mode 100644 index d87a65fe..00000000 --- a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { objectWithoutOptionalProperties, string, stringLiteral } from "../../../../src/core/schemas/builders"; -import { itSchema } from "../utils/itSchema"; - -describe("objectWithoutOptionalProperties", () => { - itSchema( - "all properties are required", - objectWithoutOptionalProperties({ - foo: string(), - bar: stringLiteral("bar").optional(), - }), - { - raw: { - foo: "hello", - }, - // @ts-expect-error - parsed: { - foo: "hello", - }, - } - ); -}); diff --git a/tests/unit/zurg/object/passthrough.test.ts b/tests/unit/zurg/object/passthrough.test.ts deleted file mode 100644 index 28ce3b1f..00000000 --- a/tests/unit/zurg/object/passthrough.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { object, string, stringLiteral } from "../../../../src/core/schemas/builders"; -import { itJson, itParse, itSchema } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("passthrough", () => { - const baseSchema = object({ - foo: string(), - bar: stringLiteral("bar"), - }); - - describe("parse", () => { - itParse("includes unknown values", baseSchema.passthrough(), { - raw: { - foo: "hello", - bar: "bar", - baz: "extra", - }, - parsed: { - foo: "hello", - bar: "bar", - baz: "extra", - }, - }); - - itValidate( - "preserves schema validation", - baseSchema.passthrough(), - { - foo: 123, - bar: "bar", - baz: "extra", - }, - [ - { - path: ["foo"], - message: "Expected string. Received 123.", - }, - ] - ); - }); - - describe("json", () => { - itJson("includes unknown values", baseSchema.passthrough(), { - raw: { - foo: "hello", - bar: "bar", - - baz: "extra", - }, - parsed: { - foo: "hello", - bar: "bar", - - baz: "extra", - }, - }); - - itValidate( - "preserves schema validation", - baseSchema.passthrough(), - { - foo: "hello", - bar: "wrong", - baz: "extra", - }, - [ - { - path: ["bar"], - message: 'Expected "bar". Received "wrong".', - }, - ] - ); - }); - - itSchema("preserves schema validation in both directions", baseSchema.passthrough(), { - raw: { - foo: "hello", - bar: "bar", - extra: 42, - }, - parsed: { - foo: "hello", - bar: "bar", - extra: 42, - }, - }); -}); diff --git a/tests/unit/zurg/primitives/any.test.ts b/tests/unit/zurg/primitives/any.test.ts deleted file mode 100644 index 1adbbe2a..00000000 --- a/tests/unit/zurg/primitives/any.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { any } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; - -describe("any", () => { - itSchemaIdentity(any(), true); -}); diff --git a/tests/unit/zurg/primitives/boolean.test.ts b/tests/unit/zurg/primitives/boolean.test.ts deleted file mode 100644 index 897a8295..00000000 --- a/tests/unit/zurg/primitives/boolean.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { boolean } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("boolean", () => { - itSchemaIdentity(boolean(), true); - - itValidate("non-boolean", boolean(), {}, [ - { - path: [], - message: "Expected boolean. Received object.", - }, - ]); -}); diff --git a/tests/unit/zurg/primitives/number.test.ts b/tests/unit/zurg/primitives/number.test.ts deleted file mode 100644 index 2d01415a..00000000 --- a/tests/unit/zurg/primitives/number.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { number } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("number", () => { - itSchemaIdentity(number(), 42); - - itValidate("non-number", number(), "hello", [ - { - path: [], - message: 'Expected number. Received "hello".', - }, - ]); -}); diff --git a/tests/unit/zurg/primitives/string.test.ts b/tests/unit/zurg/primitives/string.test.ts deleted file mode 100644 index 57b23687..00000000 --- a/tests/unit/zurg/primitives/string.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { string } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("string", () => { - itSchemaIdentity(string(), "hello"); - - itValidate("non-string", string(), 42, [ - { - path: [], - message: "Expected string. Received 42.", - }, - ]); -}); diff --git a/tests/unit/zurg/primitives/unknown.test.ts b/tests/unit/zurg/primitives/unknown.test.ts deleted file mode 100644 index 4d17a7db..00000000 --- a/tests/unit/zurg/primitives/unknown.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { unknown } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; - -describe("unknown", () => { - itSchemaIdentity(unknown(), true); -}); diff --git a/tests/unit/zurg/record/record.test.ts b/tests/unit/zurg/record/record.test.ts deleted file mode 100644 index 7e4ba39c..00000000 --- a/tests/unit/zurg/record/record.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { number, record, string } from "../../../../src/core/schemas/builders"; -import { itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("record", () => { - itSchemaIdentity(record(string(), string()), { hello: "world" }); - itSchemaIdentity(record(number(), string()), { 42: "world" }); - - itValidate( - "non-record", - record(number(), string()), - [], - [ - { - path: [], - message: "Expected object. Received list.", - }, - ] - ); - - itValidate("invalid key type", record(number(), string()), { hello: "world" }, [ - { - path: ["hello (key)"], - message: 'Expected number. Received "hello".', - }, - ]); - - itValidate("invalid value type", record(string(), number()), { hello: "world" }, [ - { - path: ["hello"], - message: 'Expected number. Received "world".', - }, - ]); -}); diff --git a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts deleted file mode 100644 index da10086b..00000000 --- a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { object, string } from "../../../../src/core/schemas/builders"; -import { itSchema } from "../utils/itSchema"; - -describe("getSchemaUtils", () => { - describe("optional()", () => { - itSchema("optional fields allow original schema", string().optional(), { - raw: "hello", - parsed: "hello", - }); - - itSchema("optional fields are not required", string().optional(), { - raw: null, - parsed: undefined, - }); - }); - - describe("transform()", () => { - itSchema( - "transorm and untransform run correctly", - string().transform({ - transform: (x) => x + "X", - untransform: (x) => (x as string).slice(0, -1), - }), - { - raw: "hello", - parsed: "helloX", - } - ); - }); - - describe("parseOrThrow()", () => { - it("parses valid value", async () => { - const value = string().parseOrThrow("hello"); - expect(value).toBe("hello"); - }); - - it("throws on invalid value", async () => { - const value = () => object({ a: string(), b: string() }).parseOrThrow({ a: 24 }); - expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); - }); - }); - - describe("jsonOrThrow()", () => { - it("serializes valid value", async () => { - const value = string().jsonOrThrow("hello"); - expect(value).toBe("hello"); - }); - - it("throws on invalid value", async () => { - const value = () => object({ a: string(), b: string() }).jsonOrThrow({ a: 24 }); - expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); - }); - }); - - describe("omitUndefined", () => { - it("serializes undefined as null", async () => { - const value = object({ - a: string().optional(), - b: string().optional(), - }).jsonOrThrow({ - a: "hello", - b: undefined, - }); - expect(value).toEqual({ a: "hello", b: null }); - }); - - it("omits undefined values", async () => { - const value = object({ - a: string().optional(), - b: string().optional(), - }).jsonOrThrow( - { - a: "hello", - b: undefined, - }, - { - omitUndefined: true, - } - ); - expect(value).toEqual({ a: "hello" }); - }); - }); -}); diff --git a/tests/unit/zurg/schema.test.ts b/tests/unit/zurg/schema.test.ts deleted file mode 100644 index 94089a9a..00000000 --- a/tests/unit/zurg/schema.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - boolean, - discriminant, - list, - number, - object, - string, - stringLiteral, - union, -} from "../../../src/core/schemas/builders"; -import { booleanLiteral } from "../../../src/core/schemas/builders/literals/booleanLiteral"; -import { property } from "../../../src/core/schemas/builders/object/property"; -import { itSchema } from "./utils/itSchema"; - -describe("Schema", () => { - itSchema( - "large nested object", - object({ - a: string(), - b: stringLiteral("b value"), - c: property( - "raw_c", - list( - object({ - animal: union(discriminant("type", "_type"), { - dog: object({ value: boolean() }), - cat: object({ value: property("raw_cat", number()) }), - }), - }) - ) - ), - d: property("raw_d", boolean()), - e: booleanLiteral(true), - }), - { - raw: { - a: "hello", - b: "b value", - raw_c: [ - { - animal: { - _type: "dog", - value: true, - }, - }, - { - animal: { - _type: "cat", - raw_cat: 42, - }, - }, - ], - raw_d: false, - e: true, - }, - parsed: { - a: "hello", - b: "b value", - c: [ - { - animal: { - type: "dog", - value: true, - }, - }, - { - animal: { - type: "cat", - value: 42, - }, - }, - ], - d: false, - e: true, - }, - } - ); -}); diff --git a/tests/unit/zurg/set/set.test.ts b/tests/unit/zurg/set/set.test.ts deleted file mode 100644 index e17f908c..00000000 --- a/tests/unit/zurg/set/set.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { set, string } from "../../../../src/core/schemas/builders"; -import { itSchema } from "../utils/itSchema"; -import { itValidateJson, itValidateParse } from "../utils/itValidate"; - -describe("set", () => { - itSchema("converts between raw list and parsed Set", set(string()), { - raw: ["A", "B"], - parsed: new Set(["A", "B"]), - }); - - itValidateParse("not a list", set(string()), 42, [ - { - path: [], - message: "Expected list. Received 42.", - }, - ]); - - itValidateJson( - "not a Set", - set(string()), - [], - [ - { - path: [], - message: "Expected Set. Received list.", - }, - ] - ); - - itValidateParse( - "invalid item type", - set(string()), - [42], - [ - { - path: ["[0]"], - message: "Expected string. Received 42.", - }, - ] - ); - - itValidateJson("invalid item type", set(string()), new Set([42]), [ - { - path: ["[0]"], - message: "Expected string. Received 42.", - }, - ]); -}); diff --git a/tests/unit/zurg/skipValidation.test.ts b/tests/unit/zurg/skipValidation.test.ts deleted file mode 100644 index 5dc88096..00000000 --- a/tests/unit/zurg/skipValidation.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* eslint-disable no-console */ - -import { boolean, number, object, property, string, undiscriminatedUnion } from "../../../src/core/schemas/builders"; - -describe("skipValidation", () => { - it("allows data that doesn't conform to the schema", async () => { - const warningLogs: string[] = []; - const originalConsoleWarn = console.warn; - console.warn = (...args) => warningLogs.push(args.join(" ")); - - const schema = object({ - camelCase: property("snake_case", string()), - numberProperty: number(), - requiredProperty: boolean(), - anyPrimitive: undiscriminatedUnion([string(), number(), boolean()]), - }); - - const parsed = await schema.parse( - { - snake_case: "hello", - numberProperty: "oops", - anyPrimitive: true, - }, - { - skipValidation: true, - } - ); - - expect(parsed).toEqual({ - ok: true, - value: { - camelCase: "hello", - numberProperty: "oops", - anyPrimitive: true, - }, - }); - - expect(warningLogs).toEqual([ - `Failed to validate. - - numberProperty: Expected number. Received "oops".`, - ]); - - console.warn = originalConsoleWarn; - }); -}); diff --git a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts deleted file mode 100644 index 0e664333..00000000 --- a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { number, object, property, string, undiscriminatedUnion } from "../../../../src/core/schemas/builders"; -import { itSchema, itSchemaIdentity } from "../utils/itSchema"; - -describe("undiscriminatedUnion", () => { - itSchemaIdentity(undiscriminatedUnion([string(), number()]), "hello world"); - - itSchemaIdentity(undiscriminatedUnion([object({ hello: string() }), object({ goodbye: string() })]), { - goodbye: "foo", - }); - - itSchema( - "Correctly transforms", - undiscriminatedUnion([object({ hello: string() }), object({ helloWorld: property("hello_world", string()) })]), - { - raw: { hello_world: "foo " }, - parsed: { helloWorld: "foo " }, - } - ); - - it("Returns errors for all variants", async () => { - const result = await undiscriminatedUnion([string(), number()]).parse(true); - if (result.ok) { - throw new Error("Unexpectedly passed validation"); - } - expect(result.errors).toEqual([ - { - message: "[Variant 0] Expected string. Received true.", - path: [], - }, - { - message: "[Variant 1] Expected number. Received true.", - path: [], - }, - ]); - }); - - describe("compile", () => { - // eslint-disable-next-line jest/expect-expect - it("doesn't compile with zero members", () => { - // @ts-expect-error - () => undiscriminatedUnion([]); - }); - }); -}); diff --git a/tests/unit/zurg/union/union.test.ts b/tests/unit/zurg/union/union.test.ts deleted file mode 100644 index 79018460..00000000 --- a/tests/unit/zurg/union/union.test.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { boolean, discriminant, number, object, string, union } from "../../../../src/core/schemas/builders"; -import { itSchema, itSchemaIdentity } from "../utils/itSchema"; -import { itValidate } from "../utils/itValidate"; - -describe("union", () => { - itSchemaIdentity( - union("type", { - lion: object({ - meows: boolean(), - }), - giraffe: object({ - heightInInches: number(), - }), - }), - { type: "lion", meows: true }, - { title: "doesn't transform discriminant when it's a string" } - ); - - itSchema( - "transforms discriminant when it's a discriminant()", - union(discriminant("type", "_type"), { - lion: object({ meows: boolean() }), - giraffe: object({ heightInInches: number() }), - }), - { - raw: { _type: "lion", meows: true }, - parsed: { type: "lion", meows: true }, - } - ); - - describe("allowUnrecognizedUnionMembers", () => { - itSchema( - "transforms discriminant & passes through values when discriminant value is unrecognized", - union(discriminant("type", "_type"), { - lion: object({ meows: boolean() }), - giraffe: object({ heightInInches: number() }), - }), - { - // @ts-expect-error - raw: { _type: "moose", isAMoose: true }, - // @ts-expect-error - parsed: { type: "moose", isAMoose: true }, - opts: { - allowUnrecognizedUnionMembers: true, - }, - } - ); - }); - - describe("withParsedProperties", () => { - it("Added property is included on parsed object", async () => { - const schema = union("type", { - lion: object({}), - tiger: object({ value: string() }), - }).withParsedProperties({ - printType: (parsed) => () => parsed.type, - }); - - const parsed = await schema.parse({ type: "lion" }); - if (!parsed.ok) { - throw new Error("Failed to parse"); - } - expect(parsed.value.printType()).toBe("lion"); - }); - }); - - itValidate( - "non-object", - union("type", { - lion: object({}), - tiger: object({ value: string() }), - }), - [], - [ - { - path: [], - message: "Expected object. Received list.", - }, - ] - ); - - itValidate( - "missing discriminant", - union("type", { - lion: object({}), - tiger: object({ value: string() }), - }), - {}, - [ - { - path: [], - message: 'Missing discriminant ("type")', - }, - ] - ); - - itValidate( - "unrecognized discriminant value", - union("type", { - lion: object({}), - tiger: object({ value: string() }), - }), - { - type: "bear", - }, - [ - { - path: ["type"], - message: 'Expected enum. Received "bear".', - }, - ] - ); -}); diff --git a/tests/unit/zurg/utils/itSchema.ts b/tests/unit/zurg/utils/itSchema.ts deleted file mode 100644 index 67b6c928..00000000 --- a/tests/unit/zurg/utils/itSchema.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* eslint-disable jest/no-export */ -import { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; - -export function itSchemaIdentity( - schema: Schema, - value: T, - { title = "functions as identity", opts }: { title?: string; opts?: SchemaOptions } = {} -): void { - itSchema(title, schema, { raw: value, parsed: value, opts }); -} - -export function itSchema( - title: string, - schema: Schema, - { - raw, - parsed, - opts, - only = false, - }: { - raw: Raw; - parsed: Parsed; - opts?: SchemaOptions; - only?: boolean; - } -): void { - // eslint-disable-next-line jest/valid-title - (only ? describe.only : describe)(title, () => { - itParse("parse()", schema, { raw, parsed, opts }); - itJson("json()", schema, { raw, parsed, opts }); - }); -} - -export function itParse( - title: string, - schema: Schema, - { - raw, - parsed, - opts, - }: { - raw: Raw; - parsed: Parsed; - opts?: SchemaOptions; - } -): void { - // eslint-disable-next-line jest/valid-title - it(title, () => { - const maybeValid = schema.parse(raw, opts); - if (!maybeValid.ok) { - throw new Error("Failed to parse() " + JSON.stringify(maybeValid.errors, undefined, 4)); - } - expect(maybeValid.value).toStrictEqual(parsed); - }); -} - -export function itJson( - title: string, - schema: Schema, - { - raw, - parsed, - opts, - }: { - raw: Raw; - parsed: Parsed; - opts?: SchemaOptions; - } -): void { - // eslint-disable-next-line jest/valid-title - it(title, () => { - const maybeValid = schema.json(parsed, opts); - if (!maybeValid.ok) { - throw new Error("Failed to json() " + JSON.stringify(maybeValid.errors, undefined, 4)); - } - expect(maybeValid.value).toStrictEqual(raw); - }); -} diff --git a/tests/unit/zurg/utils/itValidate.ts b/tests/unit/zurg/utils/itValidate.ts deleted file mode 100644 index 75b2c08b..00000000 --- a/tests/unit/zurg/utils/itValidate.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable jest/no-export */ -import { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; - -export function itValidate( - title: string, - schema: Schema, - input: unknown, - errors: ValidationError[], - opts?: SchemaOptions -): void { - // eslint-disable-next-line jest/valid-title - describe("parse()", () => { - itValidateParse(title, schema, input, errors, opts); - }); - describe("json()", () => { - itValidateJson(title, schema, input, errors, opts); - }); -} - -export function itValidateParse( - title: string, - schema: Schema, - raw: unknown, - errors: ValidationError[], - opts?: SchemaOptions -): void { - describe("parse", () => { - // eslint-disable-next-line jest/valid-title - it(title, async () => { - const maybeValid = await schema.parse(raw, opts); - if (maybeValid.ok) { - throw new Error("Value passed validation"); - } - expect(maybeValid.errors).toStrictEqual(errors); - }); - }); -} - -export function itValidateJson( - title: string, - schema: Schema, - parsed: unknown, - errors: ValidationError[], - opts?: SchemaOptions -): void { - describe("json", () => { - // eslint-disable-next-line jest/valid-title - it(title, async () => { - const maybeValid = await schema.json(parsed, opts); - if (maybeValid.ok) { - throw new Error("Value passed validation"); - } - expect(maybeValid.errors).toStrictEqual(errors); - }); - }); -} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000..c75083dc --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "extendedDiagnostics": true, + "strict": true, + "target": "ES6", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "baseUrl": "src" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 00000000..5c11446f --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist/cjs" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 00000000..95a5eb73 --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.json b/tsconfig.json index 538c94fe..d77fdf00 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,3 @@ { - "compilerOptions": { - "extendedDiagnostics": true, - "strict": true, - "target": "ES6", - "module": "CommonJS", - "moduleResolution": "node", - "esModuleInterop": true, - "skipLibCheck": true, - "declaration": true, - "outDir": "dist", - "rootDir": "src", - "baseUrl": "src" - }, - "include": ["src"], - "exclude": [] + "extends": "./tsconfig.cjs.json" } diff --git a/yarn.lock b/yarn.lock index ae9427f5..994d6ed6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -66,379 +66,385 @@ "@smithy/util-utf8" "^2.0.0" tslib "^2.6.2" -"@aws-sdk/client-cognito-identity@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.758.0.tgz#d7094cdb9cb2d9d2de50da4528d53d604205118e" - integrity sha512-8bOXVYtf/0OUN0jXTIHLv3V0TAS6kvvCRAy7nmiL/fDde0O+ChW1WZU7CVPAOtFEpFCdKskDcxFspM7m1k6qyg== +"@aws-sdk/client-cognito-identity@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.828.0.tgz#782bdc15aa8a701493c36cb7e982d47c085e7f0f" + integrity sha512-If4vBVbOxFfTW6JP92lWQGhis5fIt4PIS071DoSBf931ss/mISDnslpGGz1rXp6vyS8l7fODb3LDMAzSPyooNg== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/credential-provider-node" "3.758.0" - "@aws-sdk/middleware-host-header" "3.734.0" - "@aws-sdk/middleware-logger" "3.734.0" - "@aws-sdk/middleware-recursion-detection" "3.734.0" - "@aws-sdk/middleware-user-agent" "3.758.0" - "@aws-sdk/region-config-resolver" "3.734.0" - "@aws-sdk/types" "3.734.0" - "@aws-sdk/util-endpoints" "3.743.0" - "@aws-sdk/util-user-agent-browser" "3.734.0" - "@aws-sdk/util-user-agent-node" "3.758.0" - "@smithy/config-resolver" "^4.0.1" - "@smithy/core" "^3.1.5" - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/hash-node" "^4.0.1" - "@smithy/invalid-dependency" "^4.0.1" - "@smithy/middleware-content-length" "^4.0.1" - "@smithy/middleware-endpoint" "^4.0.6" - "@smithy/middleware-retry" "^4.0.7" - "@smithy/middleware-serde" "^4.0.2" - "@smithy/middleware-stack" "^4.0.1" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/protocol-http" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/credential-provider-node" "3.828.0" + "@aws-sdk/middleware-host-header" "3.821.0" + "@aws-sdk/middleware-logger" "3.821.0" + "@aws-sdk/middleware-recursion-detection" "3.821.0" + "@aws-sdk/middleware-user-agent" "3.828.0" + "@aws-sdk/region-config-resolver" "3.821.0" + "@aws-sdk/types" "3.821.0" + "@aws-sdk/util-endpoints" "3.828.0" + "@aws-sdk/util-user-agent-browser" "3.821.0" + "@aws-sdk/util-user-agent-node" "3.828.0" + "@smithy/config-resolver" "^4.1.4" + "@smithy/core" "^3.5.3" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/hash-node" "^4.0.4" + "@smithy/invalid-dependency" "^4.0.4" + "@smithy/middleware-content-length" "^4.0.4" + "@smithy/middleware-endpoint" "^4.1.11" + "@smithy/middleware-retry" "^4.1.12" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/middleware-stack" "^4.0.4" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/protocol-http" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.7" - "@smithy/util-defaults-mode-node" "^4.0.7" - "@smithy/util-endpoints" "^3.0.1" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-retry" "^4.0.1" + "@smithy/util-defaults-mode-browser" "^4.0.19" + "@smithy/util-defaults-mode-node" "^4.0.19" + "@smithy/util-endpoints" "^3.0.6" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-retry" "^4.0.5" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" "@aws-sdk/client-sagemaker@^3.583.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sagemaker/-/client-sagemaker-3.758.0.tgz#ee8ae07e774af4141d655330600fb52faf368224" - integrity sha512-w9Ks0XNtZupU7BSqo8JywFosiPeEB8+m6iYDjFLbESe6dWF1eptaU9cT74l6HUVmd3wzQmTaBkZ6ycKkVxkxWQ== + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sagemaker/-/client-sagemaker-3.828.0.tgz#b41224f545ed40ae4e07a23354c7ca20e490c18a" + integrity sha512-/i1jAR9FwpoZyXkxpKGuzQhvckIfo7xTKjxvUaO+cSspkzXTZn348a8+rZtyGKp0/DL6SF3aIo4yjsDXtCYUEA== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/credential-provider-node" "3.758.0" - "@aws-sdk/middleware-host-header" "3.734.0" - "@aws-sdk/middleware-logger" "3.734.0" - "@aws-sdk/middleware-recursion-detection" "3.734.0" - "@aws-sdk/middleware-user-agent" "3.758.0" - "@aws-sdk/region-config-resolver" "3.734.0" - "@aws-sdk/types" "3.734.0" - "@aws-sdk/util-endpoints" "3.743.0" - "@aws-sdk/util-user-agent-browser" "3.734.0" - "@aws-sdk/util-user-agent-node" "3.758.0" - "@smithy/config-resolver" "^4.0.1" - "@smithy/core" "^3.1.5" - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/hash-node" "^4.0.1" - "@smithy/invalid-dependency" "^4.0.1" - "@smithy/middleware-content-length" "^4.0.1" - "@smithy/middleware-endpoint" "^4.0.6" - "@smithy/middleware-retry" "^4.0.7" - "@smithy/middleware-serde" "^4.0.2" - "@smithy/middleware-stack" "^4.0.1" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/protocol-http" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/credential-provider-node" "3.828.0" + "@aws-sdk/middleware-host-header" "3.821.0" + "@aws-sdk/middleware-logger" "3.821.0" + "@aws-sdk/middleware-recursion-detection" "3.821.0" + "@aws-sdk/middleware-user-agent" "3.828.0" + "@aws-sdk/region-config-resolver" "3.821.0" + "@aws-sdk/types" "3.821.0" + "@aws-sdk/util-endpoints" "3.828.0" + "@aws-sdk/util-user-agent-browser" "3.821.0" + "@aws-sdk/util-user-agent-node" "3.828.0" + "@smithy/config-resolver" "^4.1.4" + "@smithy/core" "^3.5.3" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/hash-node" "^4.0.4" + "@smithy/invalid-dependency" "^4.0.4" + "@smithy/middleware-content-length" "^4.0.4" + "@smithy/middleware-endpoint" "^4.1.11" + "@smithy/middleware-retry" "^4.1.12" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/middleware-stack" "^4.0.4" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/protocol-http" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.7" - "@smithy/util-defaults-mode-node" "^4.0.7" - "@smithy/util-endpoints" "^3.0.1" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-retry" "^4.0.1" + "@smithy/util-defaults-mode-browser" "^4.0.19" + "@smithy/util-defaults-mode-node" "^4.0.19" + "@smithy/util-endpoints" "^3.0.6" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-retry" "^4.0.5" "@smithy/util-utf8" "^4.0.0" - "@smithy/util-waiter" "^4.0.2" + "@smithy/util-waiter" "^4.0.5" "@types/uuid" "^9.0.1" tslib "^2.6.2" uuid "^9.0.1" -"@aws-sdk/client-sso@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.758.0.tgz#59a249abdfa52125fbe98b1d59c11e4f08ca6527" - integrity sha512-BoGO6IIWrLyLxQG6txJw6RT2urmbtlwfggapNCrNPyYjlXpzTSJhBYjndg7TpDATFd0SXL0zm8y/tXsUXNkdYQ== +"@aws-sdk/client-sso@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.828.0.tgz#ad37249c8424d4250b5cb4f9452a5bbdb9f3199b" + integrity sha512-qxw8JcPTaFaBwTBUr4YmLajaMh3En65SuBWAKEtjctbITRRekzR7tvr/TkwoyVOh+XoAtkwOn+BQeQbX+/wgHw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/middleware-host-header" "3.734.0" - "@aws-sdk/middleware-logger" "3.734.0" - "@aws-sdk/middleware-recursion-detection" "3.734.0" - "@aws-sdk/middleware-user-agent" "3.758.0" - "@aws-sdk/region-config-resolver" "3.734.0" - "@aws-sdk/types" "3.734.0" - "@aws-sdk/util-endpoints" "3.743.0" - "@aws-sdk/util-user-agent-browser" "3.734.0" - "@aws-sdk/util-user-agent-node" "3.758.0" - "@smithy/config-resolver" "^4.0.1" - "@smithy/core" "^3.1.5" - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/hash-node" "^4.0.1" - "@smithy/invalid-dependency" "^4.0.1" - "@smithy/middleware-content-length" "^4.0.1" - "@smithy/middleware-endpoint" "^4.0.6" - "@smithy/middleware-retry" "^4.0.7" - "@smithy/middleware-serde" "^4.0.2" - "@smithy/middleware-stack" "^4.0.1" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/protocol-http" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/middleware-host-header" "3.821.0" + "@aws-sdk/middleware-logger" "3.821.0" + "@aws-sdk/middleware-recursion-detection" "3.821.0" + "@aws-sdk/middleware-user-agent" "3.828.0" + "@aws-sdk/region-config-resolver" "3.821.0" + "@aws-sdk/types" "3.821.0" + "@aws-sdk/util-endpoints" "3.828.0" + "@aws-sdk/util-user-agent-browser" "3.821.0" + "@aws-sdk/util-user-agent-node" "3.828.0" + "@smithy/config-resolver" "^4.1.4" + "@smithy/core" "^3.5.3" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/hash-node" "^4.0.4" + "@smithy/invalid-dependency" "^4.0.4" + "@smithy/middleware-content-length" "^4.0.4" + "@smithy/middleware-endpoint" "^4.1.11" + "@smithy/middleware-retry" "^4.1.12" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/middleware-stack" "^4.0.4" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/protocol-http" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.7" - "@smithy/util-defaults-mode-node" "^4.0.7" - "@smithy/util-endpoints" "^3.0.1" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-retry" "^4.0.1" + "@smithy/util-defaults-mode-browser" "^4.0.19" + "@smithy/util-defaults-mode-node" "^4.0.19" + "@smithy/util-endpoints" "^3.0.6" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-retry" "^4.0.5" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@aws-sdk/core@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.758.0.tgz#d13a4bb95de0460d5269cd5a40503c85b344b0b4" - integrity sha512-0RswbdR9jt/XKemaLNuxi2gGr4xGlHyGxkTdhSQzCyUe9A9OPCoLl3rIESRguQEech+oJnbHk/wuiwHqTuP9sg== - dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/core" "^3.1.5" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/protocol-http" "^5.0.1" - "@smithy/signature-v4" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/util-middleware" "^4.0.1" +"@aws-sdk/core@3.826.0": + version "3.826.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.826.0.tgz#da55a524e09775b2a97e4b5d12a3137dd68547fa" + integrity sha512-BGbQYzWj3ps+dblq33FY5tz/SsgJCcXX0zjQlSC07tYvU1jHTUvsefphyig+fY38xZ4wdKjbTop+KUmXUYrOXw== + dependencies: + "@aws-sdk/types" "3.821.0" + "@aws-sdk/xml-builder" "3.821.0" + "@smithy/core" "^3.5.3" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/property-provider" "^4.0.4" + "@smithy/protocol-http" "^5.1.2" + "@smithy/signature-v4" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/util-base64" "^4.0.0" + "@smithy/util-body-length-browser" "^4.0.0" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-utf8" "^4.0.0" fast-xml-parser "4.4.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-cognito-identity@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.758.0.tgz#40b2a6a785cb8110c0f76a26f7379735b8db0801" - integrity sha512-y/rHZqyChlEkNRr59gn4hv0gjhJwGmdCdW0JI1K9p3P9p7EurWGjr2M6+goTn3ilOlcAwrl5oFKR5jLt27TkOA== +"@aws-sdk/credential-provider-cognito-identity@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.828.0.tgz#e4fe748281e07dd2926ce5e90c50456625ca2649" + integrity sha512-JmQivvkif6KLVeIKCSybl80aZgbVXREAAa0VwhJg3z2E3r8dm9qnH3XeDAzzoZrJAQmK3czuowWpwlI/PHVX8w== dependencies: - "@aws-sdk/client-cognito-identity" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/client-cognito-identity" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-env@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.758.0.tgz#6193d1607eedd0929640ff64013f7787f29ff6a1" - integrity sha512-N27eFoRrO6MeUNumtNHDW9WOiwfd59LPXPqDrIa3kWL/s+fOKFHb9xIcF++bAwtcZnAxKkgpDCUP+INNZskE+w== +"@aws-sdk/credential-provider-env@3.826.0": + version "3.826.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.826.0.tgz#213d08a1324a2970a2785151bcb6975b2f88716c" + integrity sha512-DK3pQY8+iKK3MGDdC3uOZQ2psU01obaKlTYhEwNu4VWzgwQL4Vi3sWj4xSWGEK41vqZxiRLq6fOq7ysRI+qEZA== dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-http@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.758.0.tgz#f7b28d642f2ac933e81a7add08ce582b398c1635" - integrity sha512-Xt9/U8qUCiw1hihztWkNeIR+arg6P+yda10OuCHX6kFVx3auTlU7+hCqs3UxqniGU4dguHuftf3mRpi5/GJ33Q== - dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/property-provider" "^4.0.1" - "@smithy/protocol-http" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/util-stream" "^4.1.2" +"@aws-sdk/credential-provider-http@3.826.0": + version "3.826.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.826.0.tgz#507591b684b3ed8d24cfa179995c1f93efc914cc" + integrity sha512-N+IVZBh+yx/9GbMZTKO/gErBi/FYZQtcFRItoLbY+6WU+0cSWyZYfkoeOxHmQV3iX9k65oljERIWUmL9x6OSQg== + dependencies: + "@aws-sdk/core" "3.826.0" + "@aws-sdk/types" "3.821.0" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/property-provider" "^4.0.4" + "@smithy/protocol-http" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/util-stream" "^4.2.2" tslib "^2.6.2" -"@aws-sdk/credential-provider-ini@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.758.0.tgz#66457e71d8f5013e18111b25629c2367ed8ef116" - integrity sha512-cymSKMcP5d+OsgetoIZ5QCe1wnp2Q/tq+uIxVdh9MbfdBBEnl9Ecq6dH6VlYS89sp4QKuxHxkWXVnbXU3Q19Aw== - dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/credential-provider-env" "3.758.0" - "@aws-sdk/credential-provider-http" "3.758.0" - "@aws-sdk/credential-provider-process" "3.758.0" - "@aws-sdk/credential-provider-sso" "3.758.0" - "@aws-sdk/credential-provider-web-identity" "3.758.0" - "@aws-sdk/nested-clients" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/credential-provider-imds" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" +"@aws-sdk/credential-provider-ini@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.828.0.tgz#1947ecd69161fe0f174ceacfd682aa6493478b55" + integrity sha512-T3DJMo2/j7gCPpFg2+xEHWgua05t8WP89ye7PaZxA2Fc6CgScHkZsJZTri1QQIU2h+eOZ75EZWkeFLIPgN0kRQ== + dependencies: + "@aws-sdk/core" "3.826.0" + "@aws-sdk/credential-provider-env" "3.826.0" + "@aws-sdk/credential-provider-http" "3.826.0" + "@aws-sdk/credential-provider-process" "3.826.0" + "@aws-sdk/credential-provider-sso" "3.828.0" + "@aws-sdk/credential-provider-web-identity" "3.828.0" + "@aws-sdk/nested-clients" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/credential-provider-imds" "^4.0.6" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-node@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.758.0.tgz#b0a5d18e5d7f1b091fd891e2e8088578c0246cef" - integrity sha512-+DaMv63wiq7pJrhIQzZYMn4hSarKiizDoJRvyR7WGhnn0oQ/getX9Z0VNCV3i7lIFoLNTb7WMmQ9k7+z/uD5EQ== - dependencies: - "@aws-sdk/credential-provider-env" "3.758.0" - "@aws-sdk/credential-provider-http" "3.758.0" - "@aws-sdk/credential-provider-ini" "3.758.0" - "@aws-sdk/credential-provider-process" "3.758.0" - "@aws-sdk/credential-provider-sso" "3.758.0" - "@aws-sdk/credential-provider-web-identity" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/credential-provider-imds" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" +"@aws-sdk/credential-provider-node@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.828.0.tgz#aa5757f00481534617b83115a2be582b08887ff0" + integrity sha512-9z3iPwVYOQYNzVZj8qycZaS/BOSKRXWA+QVNQlfEnQ4sA4sOcKR4kmV2h+rJcuBsSFfmOF62ZDxyIBGvvM4t/w== + dependencies: + "@aws-sdk/credential-provider-env" "3.826.0" + "@aws-sdk/credential-provider-http" "3.826.0" + "@aws-sdk/credential-provider-ini" "3.828.0" + "@aws-sdk/credential-provider-process" "3.826.0" + "@aws-sdk/credential-provider-sso" "3.828.0" + "@aws-sdk/credential-provider-web-identity" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/credential-provider-imds" "^4.0.6" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-process@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.758.0.tgz#563bfae58049afd9968ca60f61672753834ff506" - integrity sha512-AzcY74QTPqcbXWVgjpPZ3HOmxQZYPROIBz2YINF0OQk0MhezDWV/O7Xec+K1+MPGQO3qS6EDrUUlnPLjsqieHA== +"@aws-sdk/credential-provider-process@3.826.0": + version "3.826.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.826.0.tgz#3b7e54994cf04c8ba20a90caf4f79af9f1335ea4" + integrity sha512-kURrc4amu3NLtw1yZw7EoLNEVhmOMRUTs+chaNcmS+ERm3yK0nKjaJzmKahmwlTQTSl3wJ8jjK7x962VPo+zWw== dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-sso@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.758.0.tgz#5098c196a2dd38ba467aca052fc5193476b8a404" - integrity sha512-x0FYJqcOLUCv8GLLFDYMXRAQKGjoM+L0BG4BiHYZRDf24yQWFCAZsCQAYKo6XZYh2qznbsW6f//qpyJ5b0QVKQ== - dependencies: - "@aws-sdk/client-sso" "3.758.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/token-providers" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" +"@aws-sdk/credential-provider-sso@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.828.0.tgz#32105dd1fb67423c691fa7c24ba317dd7271e73f" + integrity sha512-9CEAXzUDSzOjOCb3XfM15TZhTaM+l07kumZyx2z8NC6T2U4qbCJqn4h8mFlRvYrs6cBj2SN40sD3r5Wp0Cq2Kw== + dependencies: + "@aws-sdk/client-sso" "3.828.0" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/token-providers" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-web-identity@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.758.0.tgz#ea88729ee0e5de0bf5f31929d60dfd148934b6a5" - integrity sha512-XGguXhBqiCXMXRxcfCAVPlMbm3VyJTou79r/3mxWddHWF0XbhaQiBIbUz6vobVTD25YQRbWSmSch7VA8kI5Lrw== +"@aws-sdk/credential-provider-web-identity@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.828.0.tgz#b14085bd47284be79c05149f44b8151111d2ec0f" + integrity sha512-MguDhGHlQBeK9CQ/P4NOY0whAJ4HJU4x+f1dphg3I1sGlccFqfB8Moor2vXNKu0Th2kvAwkn9pr7gGb/+NGR9g== dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/nested-clients" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/nested-clients" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@aws-sdk/credential-providers@^3.583.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-providers/-/credential-providers-3.758.0.tgz#302b5339fccaeb3db3cb699a0aeb897e58c12d48" - integrity sha512-BaGVBdm9ynsErIc/mLuUwJ1OQcL/pkhCuAm24jpsif3evZ5wgyZnEAZB2yRin+mQnQaQT3L+KvTbdKGfjL8+fQ== - dependencies: - "@aws-sdk/client-cognito-identity" "3.758.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/credential-provider-cognito-identity" "3.758.0" - "@aws-sdk/credential-provider-env" "3.758.0" - "@aws-sdk/credential-provider-http" "3.758.0" - "@aws-sdk/credential-provider-ini" "3.758.0" - "@aws-sdk/credential-provider-node" "3.758.0" - "@aws-sdk/credential-provider-process" "3.758.0" - "@aws-sdk/credential-provider-sso" "3.758.0" - "@aws-sdk/credential-provider-web-identity" "3.758.0" - "@aws-sdk/nested-clients" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/core" "^3.1.5" - "@smithy/credential-provider-imds" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-providers/-/credential-providers-3.828.0.tgz#954e3c0351a8b456a9a18aeaeef83a4c36cbcd5f" + integrity sha512-PuLp94Brs3lpZ+H8Ata0nolqUEdmV1geiggEzRdLt93cggs7UXPJG9TG87py6W4qPmRvkE34QSwO/1NXpm4eGw== + dependencies: + "@aws-sdk/client-cognito-identity" "3.828.0" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/credential-provider-cognito-identity" "3.828.0" + "@aws-sdk/credential-provider-env" "3.826.0" + "@aws-sdk/credential-provider-http" "3.826.0" + "@aws-sdk/credential-provider-ini" "3.828.0" + "@aws-sdk/credential-provider-node" "3.828.0" + "@aws-sdk/credential-provider-process" "3.826.0" + "@aws-sdk/credential-provider-sso" "3.828.0" + "@aws-sdk/credential-provider-web-identity" "3.828.0" + "@aws-sdk/nested-clients" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/config-resolver" "^4.1.4" + "@smithy/core" "^3.5.3" + "@smithy/credential-provider-imds" "^4.0.6" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/property-provider" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/middleware-host-header@3.734.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-host-header/-/middleware-host-header-3.734.0.tgz#a9a02c055352f5c435cc925a4e1e79b7ba41b1b5" - integrity sha512-LW7RRgSOHHBzWZnigNsDIzu3AiwtjeI2X66v+Wn1P1u+eXssy1+up4ZY/h+t2sU4LU36UvEf+jrZti9c6vRnFw== +"@aws-sdk/middleware-host-header@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-host-header/-/middleware-host-header-3.821.0.tgz#1dfda8da4e0f9499648dab9a989d10706e289cc7" + integrity sha512-xSMR+sopSeWGx5/4pAGhhfMvGBHioVBbqGvDs6pG64xfNwM5vq5s5v6D04e2i+uSTj4qGa71dLUs5I0UzAK3sw== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/types" "3.821.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/middleware-logger@3.734.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-logger/-/middleware-logger-3.734.0.tgz#d31e141ae7a78667e372953a3b86905bc6124664" - integrity sha512-mUMFITpJUW3LcKvFok176eI5zXAUomVtahb9IQBwLzkqFYOrMJvWAvoV4yuxrJ8TlQBG8gyEnkb9SnhZvjg67w== +"@aws-sdk/middleware-logger@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-logger/-/middleware-logger-3.821.0.tgz#87067907a25cdc6c155d3a35fe32e399c1ef87e6" + integrity sha512-0cvI0ipf2tGx7fXYEEN5fBeZDz2RnHyb9xftSgUsEq7NBxjV0yTZfLJw6Za5rjE6snC80dRN8+bTNR1tuG89zA== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/types" "^4.1.0" + "@aws-sdk/types" "3.821.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/middleware-recursion-detection@3.734.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.734.0.tgz#4fa1deb9887455afbb39130f7d9bc89ccee17168" - integrity sha512-CUat2d9ITsFc2XsmeiRQO96iWpxSKYFjxvj27Hc7vo87YUHRnfMfnc8jw1EpxEwMcvBD7LsRa6vDNky6AjcrFA== +"@aws-sdk/middleware-recursion-detection@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.821.0.tgz#bc34b08efc1e1af7b14a58023a79bfb75a0b64fa" + integrity sha512-efmaifbhBoqKG3bAoEfDdcM8hn1psF+4qa7ykWuYmfmah59JBeqHLfz5W9m9JoTwoKPkFcVLWZxnyZzAnVBOIg== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/types" "3.821.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/middleware-user-agent@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.758.0.tgz#f3c9d2025aa55fd400acb1d699c1fbd6b4f68f34" - integrity sha512-iNyehQXtQlj69JCgfaOssgZD4HeYGOwxcaKeG6F+40cwBjTAi0+Ph1yfDwqk2qiBPIRWJ/9l2LodZbxiBqgrwg== - dependencies: - "@aws-sdk/core" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@aws-sdk/util-endpoints" "3.743.0" - "@smithy/core" "^3.1.5" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" +"@aws-sdk/middleware-user-agent@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.828.0.tgz#195ed26c87727fb5f78f9bce5d6ab947f1273dcd" + integrity sha512-nixvI/SETXRdmrVab4D9LvXT3lrXkwAWGWk2GVvQvzlqN1/M/RfClj+o37Sn4FqRkGH9o9g7Fqb1YqZ4mqDAtA== + dependencies: + "@aws-sdk/core" "3.826.0" + "@aws-sdk/types" "3.821.0" + "@aws-sdk/util-endpoints" "3.828.0" + "@smithy/core" "^3.5.3" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/nested-clients@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.758.0.tgz#571c853602d38f5e8faa10178347e711e4f0e444" - integrity sha512-YZ5s7PSvyF3Mt2h1EQulCG93uybprNGbBkPmVuy/HMMfbFTt4iL3SbKjxqvOZelm86epFfj7pvK7FliI2WOEcg== +"@aws-sdk/nested-clients@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.828.0.tgz#2af1c0e8c3f108472d544f0fb174c92b308e8eca" + integrity sha512-xmeOILiR9LvfC8MctgeRXXN8nQTwbOvO4wHvgE8tDRsjnBpyyO0j50R4+viHXdMUGtgGkHEXRv8fFNBq54RgnA== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.758.0" - "@aws-sdk/middleware-host-header" "3.734.0" - "@aws-sdk/middleware-logger" "3.734.0" - "@aws-sdk/middleware-recursion-detection" "3.734.0" - "@aws-sdk/middleware-user-agent" "3.758.0" - "@aws-sdk/region-config-resolver" "3.734.0" - "@aws-sdk/types" "3.734.0" - "@aws-sdk/util-endpoints" "3.743.0" - "@aws-sdk/util-user-agent-browser" "3.734.0" - "@aws-sdk/util-user-agent-node" "3.758.0" - "@smithy/config-resolver" "^4.0.1" - "@smithy/core" "^3.1.5" - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/hash-node" "^4.0.1" - "@smithy/invalid-dependency" "^4.0.1" - "@smithy/middleware-content-length" "^4.0.1" - "@smithy/middleware-endpoint" "^4.0.6" - "@smithy/middleware-retry" "^4.0.7" - "@smithy/middleware-serde" "^4.0.2" - "@smithy/middleware-stack" "^4.0.1" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/protocol-http" "^5.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" + "@aws-sdk/core" "3.826.0" + "@aws-sdk/middleware-host-header" "3.821.0" + "@aws-sdk/middleware-logger" "3.821.0" + "@aws-sdk/middleware-recursion-detection" "3.821.0" + "@aws-sdk/middleware-user-agent" "3.828.0" + "@aws-sdk/region-config-resolver" "3.821.0" + "@aws-sdk/types" "3.821.0" + "@aws-sdk/util-endpoints" "3.828.0" + "@aws-sdk/util-user-agent-browser" "3.821.0" + "@aws-sdk/util-user-agent-node" "3.828.0" + "@smithy/config-resolver" "^4.1.4" + "@smithy/core" "^3.5.3" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/hash-node" "^4.0.4" + "@smithy/invalid-dependency" "^4.0.4" + "@smithy/middleware-content-length" "^4.0.4" + "@smithy/middleware-endpoint" "^4.1.11" + "@smithy/middleware-retry" "^4.1.12" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/middleware-stack" "^4.0.4" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/protocol-http" "^5.1.2" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.7" - "@smithy/util-defaults-mode-node" "^4.0.7" - "@smithy/util-endpoints" "^3.0.1" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-retry" "^4.0.1" + "@smithy/util-defaults-mode-browser" "^4.0.19" + "@smithy/util-defaults-mode-node" "^4.0.19" + "@smithy/util-endpoints" "^3.0.6" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-retry" "^4.0.5" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" @@ -450,16 +456,16 @@ "@smithy/protocol-http" "^1.1.0" tslib "^2.5.0" -"@aws-sdk/region-config-resolver@3.734.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.734.0.tgz#45ffbc56a3e94cc5c9e0cd596b0fda60f100f70b" - integrity sha512-Lvj1kPRC5IuJBr9DyJ9T9/plkh+EfKLy+12s/mykOy1JaKHDpvj+XGy2YO6YgYVOb8JFtaqloid+5COtje4JTQ== +"@aws-sdk/region-config-resolver@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.821.0.tgz#2f1cd54ca140cbdc821a604d8b20444f9b0b77cf" + integrity sha512-t8og+lRCIIy5nlId0bScNpCkif8sc0LhmtaKsbm0ZPm3sCa/WhCbSZibjbZ28FNjVCV+p0D9RYZx0VDDbtWyjw== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/types" "3.821.0" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/types" "^4.3.1" "@smithy/util-config-provider" "^4.0.0" - "@smithy/util-middleware" "^4.0.1" + "@smithy/util-middleware" "^4.0.4" tslib "^2.6.2" "@aws-sdk/signature-v4@^3.374.0": @@ -470,62 +476,63 @@ "@smithy/signature-v4" "^1.0.1" tslib "^2.5.0" -"@aws-sdk/token-providers@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.758.0.tgz#fcab3885ba2b222ff8bb7817448d3c786dc2ddf9" - integrity sha512-ckptN1tNrIfQUaGWm/ayW1ddG+imbKN7HHhjFdS4VfItsP0QQOB0+Ov+tpgb4MoNR4JaUghMIVStjIeHN2ks1w== - dependencies: - "@aws-sdk/nested-clients" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" +"@aws-sdk/token-providers@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.828.0.tgz#423f00ffc68a7f96ade2792acec4eddaa52a5f53" + integrity sha512-JdOjI/TxkfQpY/bWbdGMdCiePESXTbtl6MfnJxz35zZ3tfHvBnxAWCoYJirdmjzY/j/dFo5oEyS6mQuXAG9w2w== + dependencies: + "@aws-sdk/core" "3.826.0" + "@aws-sdk/nested-clients" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/types@3.734.0", "@aws-sdk/types@^3.222.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.734.0.tgz#af5e620b0e761918282aa1c8e53cac6091d169a2" - integrity sha512-o11tSPTT70nAkGV1fN9wm/hAIiLPyWX6SuGf+9JyTp7S/rC2cFWhR26MvA69nplcjNaXVzB0f+QFrLXXjOqCrg== +"@aws-sdk/types@3.821.0", "@aws-sdk/types@^3.222.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.821.0.tgz#edfd4595208e4e9f24f397fbc8cb82e3ec336649" + integrity sha512-Znroqdai1a90TlxGaJ+FK1lwC0fHpo97Xjsp5UKGR5JODYm7f9+/fF17ebO1KdoBr/Rm0UIFiF5VmI8ts9F1eA== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@aws-sdk/util-endpoints@3.743.0": - version "3.743.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.743.0.tgz#fba654e0c5f1c8ba2b3e175dfee8e3ba4df2394a" - integrity sha512-sN1l559zrixeh5x+pttrnd0A3+r34r0tmPkJ/eaaMaAzXqsmKU/xYre9K3FNnsSS1J1k4PEfk/nHDTVUgFYjnw== +"@aws-sdk/util-endpoints@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.828.0.tgz#a02f9c99d9749123fabad38d3b6cd51f4c8489db" + integrity sha512-RvKch111SblqdkPzg3oCIdlGxlQs+k+P7Etory9FmxPHyPDvsP1j1c74PmgYqtzzMWmoXTjd+c9naUHh9xG8xg== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/types" "^4.1.0" - "@smithy/util-endpoints" "^3.0.1" + "@aws-sdk/types" "3.821.0" + "@smithy/types" "^4.3.1" + "@smithy/util-endpoints" "^3.0.6" tslib "^2.6.2" "@aws-sdk/util-locate-window@^3.0.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.723.0.tgz#174551bfdd2eb36d3c16e7023fd7e7ee96ad0fa9" - integrity sha512-Yf2CS10BqK688DRsrKI/EO6B8ff5J86NXe4C+VCysK7UOgN0l1zOTeTukZ3H8Q9tYYX3oaF1961o8vRkFm7Nmw== + version "3.804.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.804.0.tgz#a2ee8dc5d9c98276986e8e1ba03c0c84d9afb0f5" + integrity sha512-zVoRfpmBVPodYlnMjgVjfGoEZagyRF5IPn3Uo6ZvOZp24chnW/FRstH7ESDHDDRga4z3V+ElUQHKpFDXWyBW5A== dependencies: tslib "^2.6.2" -"@aws-sdk/util-user-agent-browser@3.734.0": - version "3.734.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.734.0.tgz#bbf3348b14bd7783f60346e1ce86978999450fe7" - integrity sha512-xQTCus6Q9LwUuALW+S76OL0jcWtMOVu14q+GoLnWPUM7QeUw963oQcLhF7oq0CtaLLKyl4GOUfcwc773Zmwwng== +"@aws-sdk/util-user-agent-browser@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.821.0.tgz#32962fd3ae20986da128944b88a231508e017f5b" + integrity sha512-irWZHyM0Jr1xhC+38OuZ7JB6OXMLPZlj48thElpsO1ZSLRkLZx5+I7VV6k3sp2yZ7BYbKz/G2ojSv4wdm7XTLw== dependencies: - "@aws-sdk/types" "3.734.0" - "@smithy/types" "^4.1.0" + "@aws-sdk/types" "3.821.0" + "@smithy/types" "^4.3.1" bowser "^2.11.0" tslib "^2.6.2" -"@aws-sdk/util-user-agent-node@3.758.0": - version "3.758.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.758.0.tgz#604ccb02a5d11c9cedaea0bea279641ea9d4194d" - integrity sha512-A5EZw85V6WhoKMV2hbuFRvb9NPlxEErb4HPO6/SPXYY4QrjprIzScHxikqcWv1w4J3apB1wto9LPU3IMsYtfrw== +"@aws-sdk/util-user-agent-node@3.828.0": + version "3.828.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.828.0.tgz#f47192429a9407a43c94d7e980c32f330bba4cad" + integrity sha512-LdN6fTBzTlQmc8O8f1wiZN0qF3yBWVGis7NwpWK7FUEzP9bEZRxYfIkV9oV9zpt6iNRze1SedK3JQVB/udxBoA== dependencies: - "@aws-sdk/middleware-user-agent" "3.758.0" - "@aws-sdk/types" "3.734.0" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@aws-sdk/middleware-user-agent" "3.828.0" + "@aws-sdk/types" "3.821.0" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@aws-sdk/util-utf8-browser@^3.0.0": @@ -535,114 +542,122 @@ dependencies: tslib "^2.3.1" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.26.2": - version "7.26.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" - integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== +"@aws-sdk/xml-builder@3.821.0": + version "3.821.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/xml-builder/-/xml-builder-3.821.0.tgz#ff89bf1276fca41276ed508b9c8ae21978d91177" + integrity sha512-DIIotRnefVL6DiaHtO6/21DhJ4JZnnIwdNbpwiAhdt/AVbttcE4yw925gsjur0OGv5BTYXQXU3YnANBYnZjuQA== dependencies: - "@babel/helper-validator-identifier" "^7.25.9" + "@smithy/types" "^4.3.1" + tslib "^2.6.2" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" + integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== + dependencies: + "@babel/helper-validator-identifier" "^7.27.1" js-tokens "^4.0.0" - picocolors "^1.0.0" + picocolors "^1.1.1" -"@babel/compat-data@^7.26.5": - version "7.26.8" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.8.tgz#821c1d35641c355284d4a870b8a4a7b0c141e367" - integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ== +"@babel/compat-data@^7.27.2": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.5.tgz#7d0658ec1a8420fc866d1df1b03bea0e79934c82" + integrity sha512-KiRAp/VoJaWkkte84TvUd9qjdbZAdiqyvMxrGl1N6vzFogKmaLgoM3L1kgtLicp2HP5fBJS8JrZKLVIZGVJAVg== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.9.tgz#71838542a4b1e49dfed353d7acbc6eb89f4a76f2" - integrity sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw== + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" + integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.26.9" - "@babel/helper-compilation-targets" "^7.26.5" - "@babel/helper-module-transforms" "^7.26.0" - "@babel/helpers" "^7.26.9" - "@babel/parser" "^7.26.9" - "@babel/template" "^7.26.9" - "@babel/traverse" "^7.26.9" - "@babel/types" "^7.26.9" + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-module-transforms" "^7.27.3" + "@babel/helpers" "^7.27.4" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/traverse" "^7.27.4" + "@babel/types" "^7.27.3" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.26.9", "@babel/generator@^7.7.2": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.9.tgz#75a9482ad3d0cc7188a537aa4910bc59db67cbca" - integrity sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg== +"@babel/generator@^7.27.3", "@babel/generator@^7.7.2": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.5.tgz#3eb01866b345ba261b04911020cbe22dd4be8c8c" + integrity sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw== dependencies: - "@babel/parser" "^7.26.9" - "@babel/types" "^7.26.9" + "@babel/parser" "^7.27.5" + "@babel/types" "^7.27.3" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" -"@babel/helper-compilation-targets@^7.26.5": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8" - integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA== +"@babel/helper-compilation-targets@^7.27.2": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" + integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== dependencies: - "@babel/compat-data" "^7.26.5" - "@babel/helper-validator-option" "^7.25.9" + "@babel/compat-data" "^7.27.2" + "@babel/helper-validator-option" "^7.27.1" browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-module-imports@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" - integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== +"@babel/helper-module-imports@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" + integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== dependencies: - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.25.9" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/helper-module-transforms@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" - integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== +"@babel/helper-module-transforms@^7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" + integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== dependencies: - "@babel/helper-module-imports" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + "@babel/traverse" "^7.27.3" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.8.0": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" - integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" + integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== -"@babel/helper-string-parser@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" - integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/helper-validator-identifier@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" - integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== +"@babel/helper-validator-identifier@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" + integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== -"@babel/helper-validator-option@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" - integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== +"@babel/helper-validator-option@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" + integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== -"@babel/helpers@^7.26.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.9.tgz#28f3fb45252fc88ef2dc547c8a911c255fc9fef6" - integrity sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA== +"@babel/helpers@^7.27.4": + version "7.27.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.6.tgz#6456fed15b2cb669d2d1fabe84b66b34991d812c" + integrity sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug== dependencies: - "@babel/template" "^7.26.9" - "@babel/types" "^7.26.9" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.6" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.26.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.9.tgz#d9e78bee6dc80f9efd8f2349dcfbbcdace280fd5" - integrity sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" + integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== dependencies: - "@babel/types" "^7.26.9" + "@babel/types" "^7.27.3" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -673,11 +688,11 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-import-attributes@^7.24.7": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz#3b1412847699eea739b4f2602c74ce36f6b0b0f7" - integrity sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A== + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" + integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" @@ -694,11 +709,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" - integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" + integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" @@ -757,41 +772,41 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" - integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== - dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - -"@babel/template@^7.26.9", "@babel/template@^7.3.3": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2" - integrity sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA== - dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/parser" "^7.26.9" - "@babel/types" "^7.26.9" - -"@babel/traverse@^7.25.9", "@babel/traverse@^7.26.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a" - integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg== - dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.26.9" - "@babel/parser" "^7.26.9" - "@babel/template" "^7.26.9" - "@babel/types" "^7.26.9" + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" + integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/template@^7.27.2", "@babel/template@^7.3.3": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" + integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== + dependencies: + "@babel/code-frame" "^7.27.1" + "@babel/parser" "^7.27.2" + "@babel/types" "^7.27.1" + +"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.4.tgz#b0045ac7023c8472c3d35effd7cc9ebd638da6ea" + integrity sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA== + dependencies: + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.9", "@babel/types@^7.3.3": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.9.tgz#08b43dec79ee8e682c2ac631c010bdcac54a21ce" - integrity sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6", "@babel/types@^7.3.3": + version "7.27.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.6.tgz#a434ca7add514d4e646c80f7375c0aa2befc5535" + integrity sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q== dependencies: - "@babel/helper-string-parser" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -1065,48 +1080,49 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@smithy/abort-controller@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-4.0.1.tgz#7c5e73690c4105ad264c2896bd1ea822450c3819" - integrity sha512-fiUIYgIgRjMWznk6iLJz35K2YxSLHzLBA/RC6lBrKfQ8fHbPfvk7Pk9UvpKoHgJjI18MnbPuEju53zcVy6KF1g== +"@smithy/abort-controller@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-4.0.4.tgz#ab991d521fc78b5c7f24907fcd6803c0f2da51d9" + integrity sha512-gJnEjZMvigPDQWHrW3oPrFhQtkrgqBkyjj3pCIdF3A5M6vsZODG93KNlfJprv6bp4245bdT32fsHK4kkH3KYDA== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/config-resolver@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/config-resolver/-/config-resolver-4.0.1.tgz#3d6c78bbc51adf99c9819bb3f0ea197fe03ad363" - integrity sha512-Igfg8lKu3dRVkTSEm98QpZUvKEOa71jDX4vKRcvJVyRc3UgN3j7vFMf0s7xLQhYmKa8kyJGQgUJDOV5V3neVlQ== +"@smithy/config-resolver@^4.1.4": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@smithy/config-resolver/-/config-resolver-4.1.4.tgz#05d8eab8bb8eb73bec90c222fc19ac5608b1384e" + integrity sha512-prmU+rDddxHOH0oNcwemL+SwnzcG65sBF2yXRO7aeXIn/xTlq2pX7JLVbkBnVLowHLg4/OL4+jBmv9hVrVGS+w== dependencies: - "@smithy/node-config-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/types" "^4.3.1" "@smithy/util-config-provider" "^4.0.0" - "@smithy/util-middleware" "^4.0.1" + "@smithy/util-middleware" "^4.0.4" tslib "^2.6.2" -"@smithy/core@^3.1.5": - version "3.1.5" - resolved "https://registry.yarnpkg.com/@smithy/core/-/core-3.1.5.tgz#cc260229e45964d8354a3737bf3dedb56e373616" - integrity sha512-HLclGWPkCsekQgsyzxLhCQLa8THWXtB5PxyYN+2O6nkyLt550KQKTlbV2D1/j5dNIQapAZM1+qFnpBFxZQkgCA== +"@smithy/core@^3.5.3": + version "3.5.3" + resolved "https://registry.yarnpkg.com/@smithy/core/-/core-3.5.3.tgz#39969839e7cfd656be38fed09951d1691525f8d5" + integrity sha512-xa5byV9fEguZNofCclv6v9ra0FYh5FATQW/da7FQUVTic94DfrN/NvmKZjrMyzbpqfot9ZjBaO8U1UeTbmSLuA== dependencies: - "@smithy/middleware-serde" "^4.0.2" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" + "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-stream" "^4.1.2" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-stream" "^4.2.2" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@smithy/credential-provider-imds@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.1.tgz#807110739982acd1588a4847b61e6edf196d004e" - integrity sha512-l/qdInaDq1Zpznpmev/+52QomsJNZ3JkTl5yrTl02V6NBgJOQ4LY0SFw/8zsMwj3tLe8vqiIuwF6nxaEwgf6mg== +"@smithy/credential-provider-imds@^4.0.6": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.6.tgz#4cfd79a619cdbc9a75fcdc51a1193685f6a8944e" + integrity sha512-hKMWcANhUiNbCJouYkZ9V3+/Qf9pteR1dnwgdyzR09R4ODEYx8BbUysHwRSyex4rZ9zapddZhLFTnT4ZijR4pw== dependencies: - "@smithy/node-config-provider" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/property-provider" "^4.0.4" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" tslib "^2.6.2" "@smithy/eventstream-codec@^1.1.0": @@ -1119,33 +1135,33 @@ "@smithy/util-hex-encoding" "^1.1.0" tslib "^2.5.0" -"@smithy/fetch-http-handler@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@smithy/fetch-http-handler/-/fetch-http-handler-5.0.1.tgz#8463393442ca6a1644204849e42c386066f0df79" - integrity sha512-3aS+fP28urrMW2KTjb6z9iFow6jO8n3MFfineGbndvzGZit3taZhKWtTorf+Gp5RpFDDafeHlhfsGlDCXvUnJA== +"@smithy/fetch-http-handler@^5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@smithy/fetch-http-handler/-/fetch-http-handler-5.0.4.tgz#c68601b4676787e049b5d464d5f4b825dbb44013" + integrity sha512-AMtBR5pHppYMVD7z7G+OlHHAcgAN7v0kVKEpHuTO4Gb199Gowh0taYi9oDStFeUhetkeP55JLSVlTW1n9rFtUw== dependencies: - "@smithy/protocol-http" "^5.0.1" - "@smithy/querystring-builder" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/querystring-builder" "^4.0.4" + "@smithy/types" "^4.3.1" "@smithy/util-base64" "^4.0.0" tslib "^2.6.2" -"@smithy/hash-node@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/hash-node/-/hash-node-4.0.1.tgz#ce78fc11b848a4f47c2e1e7a07fb6b982d2f130c" - integrity sha512-TJ6oZS+3r2Xu4emVse1YPB3Dq3d8RkZDKcPr71Nj/lJsdAP1c7oFzYqEn1IBc915TsgLl2xIJNuxCz+gLbLE0w== +"@smithy/hash-node@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/hash-node/-/hash-node-4.0.4.tgz#f867cfe6b702ed8893aacd3e097f8ca8ecba579e" + integrity sha512-qnbTPUhCVnCgBp4z4BUJUhOEkVwxiEi1cyFM+Zj6o+aY8OFGxUQleKWq8ltgp3dujuhXojIvJWdoqpm6dVO3lQ== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" "@smithy/util-buffer-from" "^4.0.0" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@smithy/invalid-dependency@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/invalid-dependency/-/invalid-dependency-4.0.1.tgz#704d1acb6fac105558c17d53f6d55da6b0d6b6fc" - integrity sha512-gdudFPf4QRQ5pzj7HEnu6FhKRi61BfH/Gk5Yf6O0KiSbr1LlVhgjThcvjdu658VE6Nve8vaIWB8/fodmS1rBPQ== +"@smithy/invalid-dependency@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/invalid-dependency/-/invalid-dependency-4.0.4.tgz#8c2c539b2f22e857b4652bd2427a3d7a8befd610" + integrity sha512-bNYMi7WKTJHu0gn26wg8OscncTt1t2b8KcsZxvOv56XA6cyXtOAAAaNP7+m45xfppXfOatXF3Sb1MNsLUgVLTw== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@smithy/is-array-buffer@^1.1.0": @@ -1169,87 +1185,88 @@ dependencies: tslib "^2.6.2" -"@smithy/middleware-content-length@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/middleware-content-length/-/middleware-content-length-4.0.1.tgz#378bc94ae623f45e412fb4f164b5bb90b9de2ba3" - integrity sha512-OGXo7w5EkB5pPiac7KNzVtfCW2vKBTZNuCctn++TTSOMpe6RZO/n6WEC1AxJINn3+vWLKW49uad3lo/u0WJ9oQ== +"@smithy/middleware-content-length@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/middleware-content-length/-/middleware-content-length-4.0.4.tgz#fad1f125779daf8d5f261dae6dbebba0f60c234b" + integrity sha512-F7gDyfI2BB1Kc+4M6rpuOLne5LOcEknH1n6UQB69qv+HucXBR1rkzXBnQTB2q46sFy1PM/zuSJOB532yc8bg3w== dependencies: - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/middleware-endpoint@^4.0.6": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-4.0.6.tgz#7ead08fcfda92ee470786a7f458e9b59048407eb" - integrity sha512-ftpmkTHIFqgaFugcjzLZv3kzPEFsBFSnq1JsIkr2mwFzCraZVhQk2gqN51OOeRxqhbPTkRFj39Qd2V91E/mQxg== - dependencies: - "@smithy/core" "^3.1.5" - "@smithy/middleware-serde" "^4.0.2" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" - "@smithy/url-parser" "^4.0.1" - "@smithy/util-middleware" "^4.0.1" +"@smithy/middleware-endpoint@^4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.11.tgz#bf23781c55cc3768c5d0f8866d2428bbce786bb4" + integrity sha512-zDogwtRLzKl58lVS8wPcARevFZNBOOqnmzWWxVe9XiaXU2CADFjvJ9XfNibgkOWs08sxLuSr81NrpY4mgp9OwQ== + dependencies: + "@smithy/core" "^3.5.3" + "@smithy/middleware-serde" "^4.0.8" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" + "@smithy/url-parser" "^4.0.4" + "@smithy/util-middleware" "^4.0.4" tslib "^2.6.2" -"@smithy/middleware-retry@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-4.0.7.tgz#8bb2014842a6144f230967db502f5fe6adcd6529" - integrity sha512-58j9XbUPLkqAcV1kHzVX/kAR16GT+j7DUZJqwzsxh1jtz7G82caZiGyyFgUvogVfNTg3TeAOIJepGc8TXF4AVQ== - dependencies: - "@smithy/node-config-provider" "^4.0.1" - "@smithy/protocol-http" "^5.0.1" - "@smithy/service-error-classification" "^4.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" - "@smithy/util-middleware" "^4.0.1" - "@smithy/util-retry" "^4.0.1" +"@smithy/middleware-retry@^4.1.12": + version "4.1.12" + resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-4.1.12.tgz#4d0b60bba95201539c99911c0a36f9275d973802" + integrity sha512-wvIH70c4e91NtRxdaLZF+mbLZ/HcC6yg7ySKUiufL6ESp6zJUSnJucZ309AvG9nqCFHSRB5I6T3Ez1Q9wCh0Ww== + dependencies: + "@smithy/node-config-provider" "^4.1.3" + "@smithy/protocol-http" "^5.1.2" + "@smithy/service-error-classification" "^4.0.5" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" + "@smithy/util-middleware" "^4.0.4" + "@smithy/util-retry" "^4.0.5" tslib "^2.6.2" uuid "^9.0.1" -"@smithy/middleware-serde@^4.0.2": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@smithy/middleware-serde/-/middleware-serde-4.0.2.tgz#f792d72f6ad8fa6b172e3f19c6fe1932a856a56d" - integrity sha512-Sdr5lOagCn5tt+zKsaW+U2/iwr6bI9p08wOkCp6/eL6iMbgdtc2R5Ety66rf87PeohR0ExI84Txz9GYv5ou3iQ== +"@smithy/middleware-serde@^4.0.8": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@smithy/middleware-serde/-/middleware-serde-4.0.8.tgz#3704c8cc46acd0a7f910a78ee1d2f23ce928701f" + integrity sha512-iSSl7HJoJaGyMIoNn2B7czghOVwJ9nD7TMvLhMWeSB5vt0TnEYyRRqPJu/TqW76WScaNvYYB8nRoiBHR9S1Ddw== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/middleware-stack@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/middleware-stack/-/middleware-stack-4.0.1.tgz#c157653f9df07f7c26e32f49994d368e4e071d22" - integrity sha512-dHwDmrtR/ln8UTHpaIavRSzeIk5+YZTBtLnKwDW3G2t6nAupCiQUvNzNoHBpik63fwUaJPtlnMzXbQrNFWssIA== +"@smithy/middleware-stack@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/middleware-stack/-/middleware-stack-4.0.4.tgz#58e0c6a0d7678c6ad4d6af8dd9a00f749ffac7c5" + integrity sha512-kagK5ggDrBUCCzI93ft6DjteNSfY8Ulr83UtySog/h09lTIOAJ/xUSObutanlPT0nhoHAkpmW9V5K8oPyLh+QA== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/node-config-provider@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/node-config-provider/-/node-config-provider-4.0.1.tgz#4e84fe665c0774d5f4ebb75144994fc6ebedf86e" - integrity sha512-8mRTjvCtVET8+rxvmzRNRR0hH2JjV0DFOmwXPrISmTIJEfnCBugpYYGAsCj8t41qd+RB5gbheSQ/6aKZCQvFLQ== +"@smithy/node-config-provider@^4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@smithy/node-config-provider/-/node-config-provider-4.1.3.tgz#6626fe26c6fe7b0df34f71cb72764ccba414a815" + integrity sha512-HGHQr2s59qaU1lrVH6MbLlmOBxadtzTsoO4c+bF5asdgVik3I8o7JIOzoeqWc5MjVa+vD36/LWE0iXKpNqooRw== dependencies: - "@smithy/property-provider" "^4.0.1" - "@smithy/shared-ini-file-loader" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/shared-ini-file-loader" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/node-http-handler@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@smithy/node-http-handler/-/node-http-handler-4.0.3.tgz#363e1d453168b4e37e8dd456d0a368a4e413bc98" - integrity sha512-dYCLeINNbYdvmMLtW0VdhW1biXt+PPCGazzT5ZjKw46mOtdgToQEwjqZSS9/EN8+tNs/RO0cEWG044+YZs97aA== +"@smithy/node-http-handler@^4.0.6": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@smithy/node-http-handler/-/node-http-handler-4.0.6.tgz#a022da499ba3af4b6b4c815104fde973c0eccc40" + integrity sha512-NqbmSz7AW2rvw4kXhKGrYTiJVDHnMsFnX4i+/FzcZAfbOBauPYs2ekuECkSbtqaxETLLTu9Rl/ex6+I2BKErPA== dependencies: - "@smithy/abort-controller" "^4.0.1" - "@smithy/protocol-http" "^5.0.1" - "@smithy/querystring-builder" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/abort-controller" "^4.0.4" + "@smithy/protocol-http" "^5.1.2" + "@smithy/querystring-builder" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/property-provider@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/property-provider/-/property-provider-4.0.1.tgz#8d35d5997af2a17cf15c5e921201ef6c5e3fc870" - integrity sha512-o+VRiwC2cgmk/WFV0jaETGOtX16VNPp2bSQEzu0whbReqE1BMqsP2ami2Vi3cbGVdKu1kq9gQkDAGKbt0WOHAQ== +"@smithy/property-provider@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/property-provider/-/property-provider-4.0.4.tgz#303a8fd99665fff61eeb6ec3922eee53838962c5" + integrity sha512-qHJ2sSgu4FqF4U/5UUp4DhXNmdTrgmoAai6oQiM+c5RZ/sbDwJ12qxB1M6FnP+Tn/ggkPZf9ccn4jqKSINaquw== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@smithy/protocol-http@^1.1.0": @@ -1260,44 +1277,44 @@ "@smithy/types" "^1.2.0" tslib "^2.5.0" -"@smithy/protocol-http@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@smithy/protocol-http/-/protocol-http-5.0.1.tgz#37c248117b29c057a9adfad4eb1d822a67079ff1" - integrity sha512-TE4cpj49jJNB/oHyh/cRVEgNZaoPaxd4vteJNB0yGidOCVR0jCw/hjPVsT8Q8FRmj8Bd3bFZt8Dh7xGCT+xMBQ== +"@smithy/protocol-http@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@smithy/protocol-http/-/protocol-http-5.1.2.tgz#8094860c2407f250b80c95899e0385112d6eb98b" + integrity sha512-rOG5cNLBXovxIrICSBm95dLqzfvxjEmuZx4KK3hWwPFHGdW3lxY0fZNXfv2zebfRO7sJZ5pKJYHScsqopeIWtQ== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/querystring-builder@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/querystring-builder/-/querystring-builder-4.0.1.tgz#37e1e05d0d33c6f694088abc3e04eafb65cb6976" - integrity sha512-wU87iWZoCbcqrwszsOewEIuq+SU2mSoBE2CcsLwE0I19m0B2gOJr1MVjxWcDQYOzHbR1xCk7AcOBbGFUYOKvdg== +"@smithy/querystring-builder@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/querystring-builder/-/querystring-builder-4.0.4.tgz#f7546efd59d457b3d2525a330c6137e5f907864c" + integrity sha512-SwREZcDnEYoh9tLNgMbpop+UTGq44Hl9tdj3rf+yeLcfH7+J8OXEBaMc2kDxtyRHu8BhSg9ADEx0gFHvpJgU8w== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" "@smithy/util-uri-escape" "^4.0.0" tslib "^2.6.2" -"@smithy/querystring-parser@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/querystring-parser/-/querystring-parser-4.0.1.tgz#312dc62b146f8bb8a67558d82d4722bb9211af42" - integrity sha512-Ma2XC7VS9aV77+clSFylVUnPZRindhB7BbmYiNOdr+CHt/kZNJoPP0cd3QxCnCFyPXC4eybmyE98phEHkqZ5Jw== +"@smithy/querystring-parser@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/querystring-parser/-/querystring-parser-4.0.4.tgz#307ab95ee5f1a142ab46c2eddebeae68cb2f703d" + integrity sha512-6yZf53i/qB8gRHH/l2ZwUG5xgkPgQF15/KxH0DdXMDHjesA9MeZje/853ifkSY0x4m5S+dfDZ+c4x439PF0M2w== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/service-error-classification@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-4.0.1.tgz#84e78579af46c7b79c900b6d6cc822c9465f3259" - integrity sha512-3JNjBfOWpj/mYfjXJHB4Txc/7E4LVq32bwzE7m28GN79+M1f76XHflUaSUkhOriprPDzev9cX/M+dEB80DNDKA== +"@smithy/service-error-classification@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-4.0.5.tgz#cd912cdd0510de9369db6a4d34dc36f36de54a59" + integrity sha512-LvcfhrnCBvCmTee81pRlh1F39yTS/+kYleVeLCwNtkY8wtGg8V/ca9rbZZvYIl8OjlMtL6KIjaiL/lgVqHD2nA== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" -"@smithy/shared-ini-file-loader@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.1.tgz#d35c21c29454ca4e58914a4afdde68d3b2def1ee" - integrity sha512-hC8F6qTBbuHRI/uqDgqqi6J0R4GtEZcgrZPhFQnMhfJs3MnUTGSnR1NSJCJs5VWlMydu0kJz15M640fJlRsIOw== +"@smithy/shared-ini-file-loader@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.4.tgz#33c63468b95cfd5e7d642c8131d7acc034025e00" + integrity sha512-63X0260LoFBjrHifPDs+nM9tV0VMkOTl4JRMYNuKh/f5PauSjowTfvF3LogfkWdcPoxsA9UjqEOgjeYIbhb7Nw== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@smithy/signature-v4@^1.0.1": @@ -1314,31 +1331,31 @@ "@smithy/util-utf8" "^1.1.0" tslib "^2.5.0" -"@smithy/signature-v4@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-5.0.1.tgz#f93401b176150286ba246681031b0503ec359270" - integrity sha512-nCe6fQ+ppm1bQuw5iKoeJ0MJfz2os7Ic3GBjOkLOPtavbD1ONoyE3ygjBfz2ythFWm4YnRm6OxW+8p/m9uCoIA== +"@smithy/signature-v4@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-5.1.2.tgz#5afd9d428bd26bb660bee8075b6e89fe93600c22" + integrity sha512-d3+U/VpX7a60seHziWnVZOHuEgJlclufjkS6zhXvxcJgkJq4UWdH5eOBLzHRMx6gXjsdT9h6lfpmLzbrdupHgQ== dependencies: "@smithy/is-array-buffer" "^4.0.0" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" "@smithy/util-hex-encoding" "^4.0.0" - "@smithy/util-middleware" "^4.0.1" + "@smithy/util-middleware" "^4.0.4" "@smithy/util-uri-escape" "^4.0.0" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@smithy/smithy-client@^4.1.6": - version "4.1.6" - resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-4.1.6.tgz#2183c922d086d33252012232be891f29a008d932" - integrity sha512-UYDolNg6h2O0L+cJjtgSyKKvEKCOa/8FHYJnBobyeoeWDmNpXjwOAtw16ezyeu1ETuuLEOZbrynK0ZY1Lx9Jbw== - dependencies: - "@smithy/core" "^3.1.5" - "@smithy/middleware-endpoint" "^4.0.6" - "@smithy/middleware-stack" "^4.0.1" - "@smithy/protocol-http" "^5.0.1" - "@smithy/types" "^4.1.0" - "@smithy/util-stream" "^4.1.2" +"@smithy/smithy-client@^4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-4.4.3.tgz#37499b5bdec39d9a738f3ac1566a49bcb5cad255" + integrity sha512-xxzNYgA0HD6ETCe5QJubsxP0hQH3QK3kbpJz3QrosBCuIWyEXLR/CO5hFb2OeawEKUxMNhz3a1nuJNN2np2RMA== + dependencies: + "@smithy/core" "^3.5.3" + "@smithy/middleware-endpoint" "^4.1.11" + "@smithy/middleware-stack" "^4.0.4" + "@smithy/protocol-http" "^5.1.2" + "@smithy/types" "^4.3.1" + "@smithy/util-stream" "^4.2.2" tslib "^2.6.2" "@smithy/types@^1.2.0": @@ -1348,20 +1365,20 @@ dependencies: tslib "^2.5.0" -"@smithy/types@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@smithy/types/-/types-4.1.0.tgz#19de0b6087bccdd4182a334eb5d3d2629699370f" - integrity sha512-enhjdwp4D7CXmwLtD6zbcDMbo6/T6WtuuKCY49Xxc6OMOmUWlBEBDREsxxgV2LIdeQPW756+f97GzcgAwp3iLw== +"@smithy/types@^4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@smithy/types/-/types-4.3.1.tgz#c11276ea16235d798f47a68aef9f44d3dbb70dd4" + integrity sha512-UqKOQBL2x6+HWl3P+3QqFD4ncKq0I8Nuz9QItGv5WuKuMHuuwlhvqcZCoXGfc+P1QmfJE7VieykoYYmrOoFJxA== dependencies: tslib "^2.6.2" -"@smithy/url-parser@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/url-parser/-/url-parser-4.0.1.tgz#b47743f785f5b8d81324878cbb1b5f834bf8d85a" - integrity sha512-gPXcIEUtw7VlK8f/QcruNXm7q+T5hhvGu9tl63LsJPZ27exB6dtNwvh2HIi0v7JcXJ5emBxB+CJxwaLEdJfA+g== +"@smithy/url-parser@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/url-parser/-/url-parser-4.0.4.tgz#049143f4c156356e177bd69242675db26fe4f4db" + integrity sha512-eMkc144MuN7B0TDA4U2fKs+BqczVbk3W+qIvcoCY6D1JY3hnAdCuhCZODC+GAeaxj0p6Jroz4+XMUn3PCxQQeQ== dependencies: - "@smithy/querystring-parser" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/querystring-parser" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@smithy/util-base64@^4.0.0": @@ -1418,37 +1435,37 @@ dependencies: tslib "^2.6.2" -"@smithy/util-defaults-mode-browser@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.7.tgz#54595ab3da6765bfb388e8e8b594276e0f485710" - integrity sha512-CZgDDrYHLv0RUElOsmZtAnp1pIjwDVCSuZWOPhIOBvG36RDfX1Q9+6lS61xBf+qqvHoqRjHxgINeQz47cYFC2Q== +"@smithy/util-defaults-mode-browser@^4.0.19": + version "4.0.19" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.19.tgz#4deaa41201458d353166ab05ffa465b30898d671" + integrity sha512-mvLMh87xSmQrV5XqnUYEPoiFFeEGYeAKIDDKdhE2ahqitm8OHM3aSvhqL6rrK6wm1brIk90JhxDf5lf2hbrLbQ== dependencies: - "@smithy/property-provider" "^4.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" + "@smithy/property-provider" "^4.0.4" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" bowser "^2.11.0" tslib "^2.6.2" -"@smithy/util-defaults-mode-node@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.7.tgz#0dea136de9096a36d84416f6af5843d866621491" - integrity sha512-79fQW3hnfCdrfIi1soPbK3zmooRFnLpSx3Vxi6nUlqaaQeC5dm8plt4OTNDNqEEEDkvKghZSaoti684dQFVrGQ== - dependencies: - "@smithy/config-resolver" "^4.0.1" - "@smithy/credential-provider-imds" "^4.0.1" - "@smithy/node-config-provider" "^4.0.1" - "@smithy/property-provider" "^4.0.1" - "@smithy/smithy-client" "^4.1.6" - "@smithy/types" "^4.1.0" +"@smithy/util-defaults-mode-node@^4.0.19": + version "4.0.19" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.19.tgz#4150b5c807ca90cac7e40a5d29f2e30e3cdb1f34" + integrity sha512-8tYnx+LUfj6m+zkUUIrIQJxPM1xVxfRBvoGHua7R/i6qAxOMjqR6CpEpDwKoIs1o0+hOjGvkKE23CafKL0vJ9w== + dependencies: + "@smithy/config-resolver" "^4.1.4" + "@smithy/credential-provider-imds" "^4.0.6" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/property-provider" "^4.0.4" + "@smithy/smithy-client" "^4.4.3" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/util-endpoints@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@smithy/util-endpoints/-/util-endpoints-3.0.1.tgz#44ccbf1721447966f69496c9003b87daa8f61975" - integrity sha512-zVdUENQpdtn9jbpD9SCFK4+aSiavRb9BxEtw9ZGUR1TYo6bBHbIoi7VkrFQ0/RwZlzx0wRBaRmPclj8iAoJCLA== +"@smithy/util-endpoints@^3.0.6": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@smithy/util-endpoints/-/util-endpoints-3.0.6.tgz#a24b0801a1b94c0de26ad83da206b9add68117f2" + integrity sha512-YARl3tFL3WgPuLzljRUnrS2ngLiUtkwhQtj8PAL13XZSyUiNLQxwG3fBBq3QXFqGFUXepIN73pINp3y8c2nBmA== dependencies: - "@smithy/node-config-provider" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/node-config-provider" "^4.1.3" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@smithy/util-hex-encoding@^1.1.0": @@ -1472,31 +1489,31 @@ dependencies: tslib "^2.5.0" -"@smithy/util-middleware@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/util-middleware/-/util-middleware-4.0.1.tgz#58d363dcd661219298c89fa176a28e98ccc4bf43" - integrity sha512-HiLAvlcqhbzhuiOa0Lyct5IIlyIz0PQO5dnMlmQ/ubYM46dPInB+3yQGkfxsk6Q24Y0n3/JmcA1v5iEhmOF5mA== +"@smithy/util-middleware@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@smithy/util-middleware/-/util-middleware-4.0.4.tgz#8f639de049082c687841ea5e69c6c36e12e31a3c" + integrity sha512-9MLKmkBmf4PRb0ONJikCbCwORACcil6gUWojwARCClT7RmLzF04hUR4WdRprIXal7XVyrddadYNfp2eF3nrvtQ== dependencies: - "@smithy/types" "^4.1.0" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/util-retry@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-4.0.1.tgz#fb5f26492383dcb9a09cc4aee23a10f839cd0769" - integrity sha512-WmRHqNVwn3kI3rKk1LsKcVgPBG6iLTBGC1iYOV3GQegwJ3E8yjzHytPt26VNzOWr1qu0xE03nK0Ug8S7T7oufw== +"@smithy/util-retry@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-4.0.5.tgz#58eea5bb1869745dac28a3f81a5904f225ec1207" + integrity sha512-V7MSjVDTlEt/plmOFBn1762Dyu5uqMrV2Pl2X0dYk4XvWfdWJNe9Bs5Bzb56wkCuiWjSfClVMGcsuKrGj7S/yg== dependencies: - "@smithy/service-error-classification" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/service-error-classification" "^4.0.5" + "@smithy/types" "^4.3.1" tslib "^2.6.2" -"@smithy/util-stream@^4.1.2": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@smithy/util-stream/-/util-stream-4.1.2.tgz#b867f25bc8b016de0582810a2f4092a71c5e3244" - integrity sha512-44PKEqQ303d3rlQuiDpcCcu//hV8sn+u2JBo84dWCE0rvgeiVl0IlLMagbU++o0jCWhYCsHaAt9wZuZqNe05Hw== +"@smithy/util-stream@^4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@smithy/util-stream/-/util-stream-4.2.2.tgz#beeb1edf690db9b7d7983f46ca4fb66e22253608" + integrity sha512-aI+GLi7MJoVxg24/3J1ipwLoYzgkB4kUfogZfnslcYlynj3xsQ0e7vk4TnTro9hhsS5PvX1mwmkRqqHQjwcU7w== dependencies: - "@smithy/fetch-http-handler" "^5.0.1" - "@smithy/node-http-handler" "^4.0.3" - "@smithy/types" "^4.1.0" + "@smithy/fetch-http-handler" "^5.0.4" + "@smithy/node-http-handler" "^4.0.6" + "@smithy/types" "^4.3.1" "@smithy/util-base64" "^4.0.0" "@smithy/util-buffer-from" "^4.0.0" "@smithy/util-hex-encoding" "^4.0.0" @@ -1541,13 +1558,13 @@ "@smithy/util-buffer-from" "^4.0.0" tslib "^2.6.2" -"@smithy/util-waiter@^4.0.2": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@smithy/util-waiter/-/util-waiter-4.0.2.tgz#0a73a0fcd30ea7bbc3009cf98ad199f51b8eac51" - integrity sha512-piUTHyp2Axx3p/kc2CIJkYSv0BAaheBQmbACZgQSSfWUumWNW+R1lL+H9PDBxKJkvOeEX+hKYEFiwO8xagL8AQ== +"@smithy/util-waiter@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@smithy/util-waiter/-/util-waiter-4.0.5.tgz#cc7c65c86f5f8330445e27f9cc47d42c53c69bb7" + integrity sha512-4QvC49HTteI1gfemu0I1syWovJgPvGn7CVUoN9ZFkdvr/cCFkrEL7qNCdx/2eICqDWEGnnr68oMdSIPCLAriSQ== dependencies: - "@smithy/abort-controller" "^4.0.1" - "@smithy/types" "^4.1.0" + "@smithy/abort-controller" "^4.0.4" + "@smithy/types" "^4.3.1" tslib "^2.6.2" "@tootallnate/once@2": @@ -1567,9 +1584,9 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.6.8" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" - integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== + version "7.27.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.27.0.tgz#b5819294c51179957afaec341442f9341e4108a9" + integrity sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg== dependencies: "@babel/types" "^7.0.0" @@ -1582,9 +1599,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.20.6" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" - integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.7.tgz#968cdc2366ec3da159f61166428ee40f370e56c2" + integrity sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng== dependencies: "@babel/types" "^7.20.7" @@ -1612,9 +1629,9 @@ "@types/json-schema" "*" "@types/estree@*", "@types/estree@^1.0.6": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" - integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== "@types/graceful-fs@^4.1.3": version "4.1.9" @@ -1642,10 +1659,10 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@29.5.5": - version "29.5.5" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a" - integrity sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg== +"@types/jest@^29.5.14": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -1659,43 +1676,44 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/node-fetch@2.6.9": - version "2.6.9" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" - integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== +"@types/node-fetch@^2.6.12": + version "2.6.12" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" + integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== dependencies: "@types/node" "*" form-data "^4.0.0" "@types/node@*": - version "22.13.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.13.6.tgz#9e6ffd5239524e8432c0bca2de80311e068dad62" - integrity sha512-GYmF65GI7417CpZXsEXMjT8goQQDnpRnJnDw6jIYa+le3V/lMazPZ4vZmK1B/9R17fh2VLr2zuy9d/h5xgrLAg== + version "24.0.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.1.tgz#e9bfcb1c35547437c294403b7bec497772a88b0a" + integrity sha512-MX4Zioh39chHlDJbKmEgydJDS3tspMP/lnQC67G3SWsTnb9NeYVWOjkxpOSy4oMfPs4StcWHwBrvUb4ybfnuaw== dependencies: - undici-types "~6.20.0" + undici-types "~7.8.0" -"@types/node@17.0.33": - version "17.0.33" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" - integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== +"@types/node@^18.19.70": + version "18.19.111" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.111.tgz#e95b89efc24cc625834b43bcd70bd5591a5dfba5" + integrity sha512-90sGdgA+QLJr1F9X79tQuEut0gEYIfkX9pydI4XGRgvFo9g2JWswefI+WUSUHPYVBHYSEfTEqBxA5hQvAZB3Mw== + dependencies: + undici-types "~5.26.4" -"@types/qs@6.9.8": - version "6.9.8" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" - integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== +"@types/qs@^6.9.17": + version "6.14.0" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" + integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== "@types/readable-stream@^4.0.14": - version "4.0.18" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.18.tgz#5d8d15d26c776500ce573cae580787d149823bfc" - integrity sha512-21jK/1j+Wg+7jVw1xnSwy/2Q1VgVjWuFssbYGTREPUBeZ+rqVFl2udq0IkxzPC0ZhOzVceUbyIACFZKLqKEBlA== + version "4.0.21" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.21.tgz#716558454a5e0c3c0651520f8154efc3288f59cb" + integrity sha512-19eKVv9tugr03IgfXlA9UVUVRbW6IuqRO5B92Dl4a6pT7K8uaGrNS0GkxiZD0BOk6PLuXl5FhWl//eX/pzYdTQ== dependencies: "@types/node" "*" - safe-buffer "~5.1.1" "@types/stack-utils@^2.0.0": version "2.0.3" @@ -1887,10 +1905,10 @@ acorn-walk@^8.0.2: dependencies: acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.14.0, acorn@^8.8.1, acorn@^8.8.2: - version "8.14.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" - integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.14.0, acorn@^8.8.1: + version "8.15.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" + integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== agent-base@6: version "6.0.2" @@ -2051,17 +2069,17 @@ bowser@^2.11.0: integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + version "1.1.12" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" + integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + version "2.0.2" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" + integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== dependencies: balanced-match "^1.0.0" @@ -2073,14 +2091,14 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.24.0: - version "4.24.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.4.tgz#c6b2865a3f08bcb860a0e827389003b9fe686e4b" - integrity sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A== + version "4.25.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.0.tgz#986aa9c6d87916885da2b50d8eb577ac8d133b2c" + integrity sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA== dependencies: - caniuse-lite "^1.0.30001688" - electron-to-chromium "^1.5.73" + caniuse-lite "^1.0.30001718" + electron-to-chromium "^1.5.160" node-releases "^2.0.19" - update-browserslist-db "^1.1.1" + update-browserslist-db "^1.1.3" bs-logger@^0.2.6: version "0.2.6" @@ -2118,12 +2136,12 @@ call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: function-bind "^1.1.2" call-bound@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.3.tgz#41cfd032b593e39176a71533ab4f384aa04fd681" - integrity sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA== + version "1.0.4" + resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" + integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== dependencies: - call-bind-apply-helpers "^1.0.1" - get-intrinsic "^1.2.6" + call-bind-apply-helpers "^1.0.2" + get-intrinsic "^1.3.0" callsites@^3.0.0: version "3.1.0" @@ -2140,10 +2158,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001688: - version "1.0.30001701" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz#ad9c90301f7153cf6b3314d16cc30757285bf9e7" - integrity sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw== +caniuse-lite@^1.0.30001718: + version "1.0.30001722" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001722.tgz#ec25a2b3085b25b9079b623db83c22a70882ce85" + integrity sha512-DCQHBBZtiK6JVkAGw7drvAMK0Q0POD/xZvEmDp6baiMMP6QXXk9HpD6mNYBZWhOPG6LvIDb82ITqtWjhDckHCA== chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0: version "4.1.2" @@ -2283,9 +2301,9 @@ data-urls@^3.0.2: whatwg-url "^11.0.0" debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.4.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" - integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + version "4.4.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" + integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== dependencies: ms "^2.1.3" @@ -2295,9 +2313,9 @@ decimal.js@^10.4.2: integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw== dedent@^1.0.0: - version "1.5.3" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" - integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== + version "1.6.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" + integrity sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA== deepmerge@^4.2.2: version "4.3.1" @@ -2342,10 +2360,10 @@ ejs@^3.1.10: dependencies: jake "^10.8.5" -electron-to-chromium@^1.5.73: - version "1.5.109" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.109.tgz#905a573d2b4cbb31412a2de6267fb22cf45e097e" - integrity sha512-AidaH9JETVRr9DIPGfp1kAarm/W6hRJTPuCnkF+2MqhF4KaAgRIcBc8nvjk+YMXZhwfISof/7WG29eS4iGxQLQ== +electron-to-chromium@^1.5.160: + version "1.5.166" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.166.tgz#3fff386ed473cc2169dbe2d3ace9592262601114" + integrity sha512-QPWqHL0BglzPYyJJ1zSSmwFFL6MFXhbACOCcsCdUMCkzPdS9/OIBVxg516X/Ado2qwAq8k0nJJ7phQPCqiaFAw== emittery@^0.13.1: version "0.13.1" @@ -2365,10 +2383,10 @@ enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: graceful-fs "^4.2.4" tapable "^2.2.0" -entities@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" - integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== +entities@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-6.0.1.tgz#c28c34a43379ca7f61d074130b2f5f7020a30694" + integrity sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g== error-ex@^1.3.1: version "1.3.2" @@ -2388,9 +2406,9 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-module-lexer@^1.2.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.6.0.tgz#da49f587fd9e68ee2404fe4e256c0c7d3a81be21" - integrity sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ== + version "1.7.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" + integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: version "1.1.1" @@ -2558,18 +2576,19 @@ find-up@^4.0.0, find-up@^4.1.0: path-exists "^4.0.0" form-data-encoder@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-4.0.2.tgz#dd286fd5f9049e8ded1d44ce427f5e29185c7c12" - integrity sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw== + version "4.1.0" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-4.1.0.tgz#497cedc94810bd5d53b99b5d4f6c152d5cbc9db2" + integrity sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw== form-data@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.2.tgz#35cabbdd30c3ce73deb2c42d3c8d3ed9ca51794c" - integrity sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.3.tgz#608b1b3f3e28be0fccf5901fc85fb3641e5cf0ae" + integrity sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" es-set-tostringtag "^2.1.0" + hasown "^2.0.2" mime-types "^2.1.12" formdata-node@^6.0.3: @@ -2602,7 +2621,7 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.2.5, get-intrinsic@^1.2.6: +get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== @@ -2977,7 +2996,7 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" -jest-environment-jsdom@29.7.0: +jest-environment-jsdom@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== @@ -3183,7 +3202,7 @@ jest-snapshot@^29.7.0: pretty-format "^29.7.0" semver "^7.5.3" -jest-util@^29.0.0, jest-util@^29.7.0: +jest-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== @@ -3250,10 +3269,10 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -js-base64@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.2.tgz#816d11d81a8aff241603d19ce5761e13e41d7745" - integrity sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ== +js-base64@3.7.7: + version "3.7.7" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== js-tokens@^4.0.0: version "4.0.0" @@ -3447,7 +3466,7 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-fetch@2.7.0: +node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -3477,9 +3496,9 @@ npm-run-path@^4.0.1: path-key "^3.0.0" nwsapi@^2.2.2: - version "2.2.16" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.16.tgz#177760bba02c351df1d2644e220c31dfec8cdb43" - integrity sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ== + version "2.2.20" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" + integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== object-inspect@^1.13.3: version "1.13.4" @@ -3537,11 +3556,11 @@ parse-json@^5.2.0: lines-and-columns "^1.1.6" parse5@^7.0.0, parse5@^7.1.1: - version "7.2.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.2.1.tgz#8928f55915e6125f430cc44309765bf17556a33a" - integrity sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ== + version "7.3.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.3.0.tgz#d7e224fa72399c7a175099f45fc2ad024b05ec05" + integrity sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw== dependencies: - entities "^4.5.0" + entities "^6.0.0" path-exists@^4.0.0: version "4.0.0" @@ -3563,7 +3582,7 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -picocolors@^1.0.0, picocolors@^1.1.1: +picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== @@ -3574,9 +3593,9 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pirates@^4.0.4: - version "4.0.6" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" - integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + version "4.0.7" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" + integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== pkg-dir@^4.2.0: version "4.2.0" @@ -3585,10 +3604,10 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -prettier@2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@^3.4.2: + version "3.5.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5" + integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" @@ -3629,12 +3648,12 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -qs@6.11.2: - version "6.11.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" - integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== +qs@^6.13.1: + version "6.14.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.0.tgz#c63fa40680d2c5c941412a0e899c89af60c0a930" + integrity sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w== dependencies: - side-channel "^1.0.4" + side-channel "^1.1.0" querystringify@^2.1.1: version "2.2.0" @@ -3710,11 +3729,6 @@ safe-buffer@^5.1.0, safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -3727,10 +3741,10 @@ saxes@^6.0.0: dependencies: xmlchars "^2.2.0" -schema-utils@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.0.tgz#3b669f04f71ff2dfb5aba7ce2d5a9d79b35622c0" - integrity sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g== +schema-utils@^4.3.0, schema-utils@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.2.tgz#0c10878bf4a73fd2b1dfd14b9462b26788c806ae" + integrity sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ== dependencies: "@types/json-schema" "^7.0.9" ajv "^8.9.0" @@ -3742,10 +3756,10 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.7.1: - version "7.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" - integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== +semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.7.2: + version "7.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" + integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== serialize-javascript@^6.0.2: version "6.0.2" @@ -3795,7 +3809,7 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.0.4: +side-channel@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== @@ -3935,14 +3949,14 @@ symbol-tree@^3.2.4: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== tapable@^2.1.1, tapable@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" - integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + version "2.2.2" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.2.tgz#ab4984340d30cb9989a490032f086dbb8b56d872" + integrity sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg== terser-webpack-plugin@^5.3.11: - version "5.3.12" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz#d9518c80493081bace668aa8613b22e4a838810c" - integrity sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg== + version "5.3.14" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz#9031d48e57ab27567f02ace85c7d690db66c3e06" + integrity sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw== dependencies: "@jridgewell/trace-mapping" "^0.3.25" jest-worker "^27.4.5" @@ -3951,12 +3965,12 @@ terser-webpack-plugin@^5.3.11: terser "^5.31.1" terser@^5.31.1: - version "5.39.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.39.0.tgz#0e82033ed57b3ddf1f96708d123cca717d86ca3a" - integrity sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw== + version "5.42.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.42.0.tgz#1db8493aa0f3f866e488ec0fcf7e0c28eb43a2f5" + integrity sha512-UYCvU9YQW2f/Vwl+P0GfhxJxbUGLwd+5QrrGgLajzWAtC/23AX0vcise32kkP7Eu0Wu9VlzzHAXkLObgjQfFlQ== dependencies: "@jridgewell/source-map" "^0.3.3" - acorn "^8.8.2" + acorn "^8.14.0" commander "^2.20.0" source-map-support "~0.5.20" @@ -4004,18 +4018,18 @@ tr46@~0.0.3: integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== ts-jest@^29.1.2: - version "29.2.6" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.2.6.tgz#df53edf8b72fb89de032cfa310abf37582851d9a" - integrity sha512-yTNZVZqc8lSixm+QGVFcPe6+yj7+TWZwIesuOWvfcn4B9bz5x4NDzVCQQjOs7Hfouu36aEqfEbo9Qpo+gq8dDg== + version "29.4.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.0.tgz#bef0ee98d94c83670af7462a1617bf2367a83740" + integrity sha512-d423TJMnJGu80/eSgfQ5w/R+0zFJvdtTxwtF9KzFFunOpSeD+79lHJQIiAhluJoyGRbvj9NZJsl9WjCUo0ND7Q== dependencies: bs-logger "^0.2.6" ejs "^3.1.10" fast-json-stable-stringify "^2.1.0" - jest-util "^29.0.0" json5 "^2.2.3" lodash.memoize "^4.1.2" make-error "^1.3.6" - semver "^7.7.1" + semver "^7.7.2" + type-fest "^4.41.0" yargs-parser "^21.1.1" ts-loader@^9.5.1: @@ -4049,22 +4063,32 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typescript@4.6.4: - version "4.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" - integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== +type-fest@^4.41.0: + version "4.41.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" + integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== + +typescript@~5.7.2: + version "5.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" + integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici-types@~6.20.0: - version "6.20.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" - integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg== +undici-types@~7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" + integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== universalify@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== -update-browserslist-db@^1.1.1: +update-browserslist-db@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw== @@ -4114,9 +4138,9 @@ walker@^1.0.8: makeerror "1.0.12" watchpack@^2.4.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" - integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + version "2.4.4" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.4.tgz#473bda72f0850453da6425081ea46fc0d7602947" + integrity sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" @@ -4132,17 +4156,18 @@ webidl-conversions@^7.0.0: integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== webpack-sources@^3.2.3: - version "3.2.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" - integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + version "3.3.2" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.2.tgz#0ab55ab0b380ce53c45ca40cb7b33bab3149ea85" + integrity sha512-ykKKus8lqlgXX/1WjudpIEjqsafjOTcOJqxnAbMLAu/KCsDCJ6GBtvscewvTkrn24HsnvFwrSCbenFrhtcCsAA== webpack@^5.91.0: - version "5.98.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.98.0.tgz#44ae19a8f2ba97537978246072fb89d10d1fbd17" - integrity sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA== + version "5.99.9" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.99.9.tgz#d7de799ec17d0cce3c83b70744b4aedb537d8247" + integrity sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg== dependencies: "@types/eslint-scope" "^3.7.7" "@types/estree" "^1.0.6" + "@types/json-schema" "^7.0.15" "@webassemblyjs/ast" "^1.14.1" "@webassemblyjs/wasm-edit" "^1.14.1" "@webassemblyjs/wasm-parser" "^1.14.1" @@ -4159,7 +4184,7 @@ webpack@^5.91.0: loader-runner "^4.2.0" mime-types "^2.1.27" neo-async "^2.6.2" - schema-utils "^4.3.0" + schema-utils "^4.3.2" tapable "^2.1.1" terser-webpack-plugin "^5.3.11" watchpack "^2.4.1" @@ -4223,9 +4248,9 @@ write-file-atomic@^4.0.2: signal-exit "^3.0.7" ws@^8.11.0: - version "8.18.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.1.tgz#ea131d3784e1dfdff91adb0a4a116b127515e3cb" - integrity sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w== + version "8.18.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.2.tgz#42738b2be57ced85f46154320aabb51ab003705a" + integrity sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ== xml-name-validator@^4.0.0: version "4.0.0"