From 2385563bee4c45c3c55b54ca321d8e14affb31db Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:18:11 -0500 Subject: [PATCH] SDK regeneration (#152) Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> --- .gitignore | 12 +- package.json | 16 +- src/Client.ts | 91 ++++++++--- src/api/client/requests/ChatRequest.ts | 30 ++++ src/api/client/requests/ChatStreamRequest.ts | 46 ++++++ src/api/client/requests/ClassifyRequest.ts | 148 ++++++++++++++++++ src/api/client/requests/DetokenizeRequest.ts | 12 ++ src/api/client/requests/EmbedRequest.ts | 37 +++++ src/api/client/requests/GenerateRequest.ts | 28 ++++ .../client/requests/GenerateStreamRequest.ts | 36 +++++ src/api/client/requests/RerankRequest.ts | 16 +- src/api/client/requests/SummarizeRequest.ts | 10 ++ src/api/client/requests/TokenizeRequest.ts | 24 +++ src/api/resources/connectors/client/Client.ts | 46 ++++-- .../client/requests/ConnectorsListRequest.ts | 24 +++ .../ConnectorsOAuthAuthorizeRequest.ts | 25 +++ .../client/requests/CreateConnectorRequest.ts | 30 ++++ .../client/requests/UpdateConnectorRequest.ts | 18 +++ src/api/resources/datasets/client/Client.ts | 45 ++++-- .../client/requests/DatasetsCreateRequest.ts | 37 +++++ .../client/requests/DatasetsListRequest.ts | 18 +++ src/api/resources/embedJobs/client/Client.ts | 22 ++- .../client/requests/CreateEmbedJobRequest.ts | 28 ++++ src/api/resources/finetuning/client/Client.ts | 63 ++++++-- .../requests/FinetuningListEventsRequest.ts | 49 ++++++ .../FinetuningListFinetunedModelsRequest.ts | 49 ++++++ ...inetuningListTrainingStepMetricsRequest.ts | 42 +++++ .../FinetuningUpdateFinetunedModelRequest.ts | 77 +++++++++ src/api/resources/models/client/Client.ts | 23 ++- .../client/requests/ModelsListRequest.ts | 20 +++ src/api/types/GetModelResponse.ts | 2 + src/core/schemas/builders/object/object.ts | 12 +- .../client/requests/ChatRequest.ts | 46 +++--- .../client/requests/ChatStreamRequest.ts | 45 +++--- .../client/requests/ClassifyRequest.ts | 12 +- .../client/requests/EmbedRequest.ts | 20 ++- .../client/requests/GenerateRequest.ts | 10 +- .../client/requests/GenerateStreamRequest.ts | 10 +- .../client/requests/RerankRequest.ts | 7 +- .../client/requests/SummarizeRequest.ts | 17 +- .../client/requests/CreateConnectorRequest.ts | 13 +- .../client/requests/UpdateConnectorRequest.ts | 13 +- .../datasets/types/DatasetsGetResponse.ts | 5 +- .../datasets/types/DatasetsListResponse.ts | 7 +- .../client/requests/CreateEmbedJobRequest.ts | 25 ++- .../FinetuningUpdateFinetunedModelRequest.ts | 10 +- .../resources/finetuning/types/BaseModel.ts | 13 +- .../types/CreateFinetunedModelResponse.ts | 8 +- .../resources/finetuning/types/Event.ts | 5 +- .../finetuning/types/FinetunedModel.ts | 10 +- .../types/GetFinetunedModelResponse.ts | 8 +- .../finetuning/types/ListEventsResponse.ts | 7 +- .../types/ListFinetunedModelsResponse.ts | 7 +- .../types/ListTrainingStepMetricsResponse.ts | 14 +- .../resources/finetuning/types/Settings.ts | 15 +- .../types/UpdateFinetunedModelResponse.ts | 8 +- src/serialization/types/ApiMeta.ts | 21 ++- .../types/ChatCitationGenerationEvent.ts | 12 +- src/serialization/types/ChatMessage.ts | 5 +- .../types/ChatRequestToolResultsItem.ts | 5 +- .../types/ChatSearchQueriesGenerationEvent.ts | 13 +- src/serialization/types/ChatSearchResult.ts | 13 +- .../types/ChatSearchResultsEvent.ts | 19 ++- src/serialization/types/ChatStreamEndEvent.ts | 18 +-- .../types/ChatStreamRequestToolResultsItem.ts | 5 +- .../types/ChatStreamStartEvent.ts | 5 +- .../types/ChatTextGenerationEvent.ts | 5 +- .../types/ChatToolCallsGenerationEvent.ts | 13 +- .../types/ClassifyDataMetrics.ts | 8 +- src/serialization/types/ClassifyResponse.ts | 12 +- .../ClassifyResponseClassificationsItem.ts | 13 +- src/serialization/types/Connector.ts | 13 +- .../types/CreateConnectorResponse.ts | 5 +- .../types/CreateConnectorServiceAuth.ts | 5 +- .../types/CreateEmbedJobResponse.ts | 5 +- src/serialization/types/Dataset.ts | 26 ++- src/serialization/types/DetokenizeResponse.ts | 5 +- .../types/EmbedByTypeResponse.ts | 10 +- .../types/EmbedFloatsResponse.ts | 5 +- src/serialization/types/EmbedJob.ts | 15 +- src/serialization/types/EmbedResponse.ts | 10 +- src/serialization/types/GenerateStreamEnd.ts | 18 +-- .../types/GenerateStreamEndResponse.ts | 7 +- .../types/GenerateStreamError.ts | 13 +- src/serialization/types/GenerateStreamText.ts | 5 +- .../types/GenerateStreamedResponse.ts | 15 +- src/serialization/types/Generation.ts | 12 +- .../types/GetConnectorResponse.ts | 5 +- src/serialization/types/GetModelResponse.ts | 12 +- .../types/ListConnectorsResponse.ts | 5 +- .../types/ListEmbedJobResponse.ts | 8 +- src/serialization/types/ListModelsResponse.ts | 5 +- src/serialization/types/Metrics.ts | 5 +- .../types/NonStreamedChatResponse.ts | 63 +++----- .../types/RerankRequestDocumentsItem.ts | 8 +- src/serialization/types/RerankResponse.ts | 12 +- .../types/RerankResponseResultsItem.ts | 7 +- src/serialization/types/SingleGeneration.ts | 7 +- .../types/SingleGenerationInStream.ts | 8 +- .../types/StreamedChatResponse.ts | 41 ++--- src/serialization/types/SummarizeResponse.ts | 5 +- src/serialization/types/TokenizeResponse.ts | 5 +- src/serialization/types/Tool.ts | 10 +- .../types/UpdateConnectorResponse.ts | 5 +- tests/client.test.ts | 11 -- tsconfig.json | 6 +- yarn.lock | 30 ++-- 107 files changed, 1472 insertions(+), 593 deletions(-) delete mode 100644 tests/client.test.ts diff --git a/.gitignore b/.gitignore index 1498321..72271e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,3 @@ node_modules .DS_Store -/dist -/Client.d.ts -/Client.js -/environments.d.ts -/environments.js -/index.d.ts -/index.js -/api -/core -/errors -/serialization \ No newline at end of file +/dist \ No newline at end of file diff --git a/package.json b/package.json index f53c466..298e209 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,14 @@ { "name": "cohere-ai", - "version": "7.9.3", + "version": "7.9.4", "private": false, "repository": "https://github.com/cohere-ai/cohere-typescript", "main": "./index.js", "types": "./index.d.ts", "scripts": { - "format": "prettier --write 'src/**/*.ts'", + "format": "prettier . --write --ignore-unknown", "build": "tsc", - "prepack": "cp -rv dist/. .", - "test": "jest" + "prepack": "cp -rv dist/. ." }, "dependencies": { "url-join": "4.0.1", @@ -22,11 +21,10 @@ "@types/url-join": "4.0.1", "@types/qs": "6.9.8", "@types/node-fetch": "2.6.9", - "jest": "^29.7.0", - "@types/jest": "^29.5.5", - "ts-jest": "^29.1.2", "@types/node": "17.0.33", "prettier": "2.7.1", - "typescript": "4.6.4" + "typescript": "4.6.4", + "jest": "^29.7.0", + "ts-jest": "^29.1.2" } -} \ No newline at end of file +} diff --git a/src/Client.ts b/src/Client.ts index 4065c1b..22cc6c2 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -53,13 +53,17 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", body: { - ...(await serializers.ChatStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" })), + ...(await serializers.ChatStreamRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + })), stream: true, }, responseType: "streaming", @@ -147,13 +151,17 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", body: { - ...(await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" })), + ...(await serializers.ChatRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + })), stream: false, }, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, @@ -221,13 +229,17 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", body: { - ...(await serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" })), + ...(await serializers.GenerateStreamRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + })), stream: true, }, responseType: "streaming", @@ -316,13 +328,17 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", body: { - ...(await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" })), + ...(await serializers.GenerateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + })), stream: false, }, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, @@ -378,6 +394,15 @@ export class CohereClient { * @throws {@link Cohere.BadRequestError} * @throws {@link Cohere.TooManyRequestsError} * @throws {@link Cohere.InternalServerError} + * + * @example + * await cohere.embed({ + * texts: ["string"], + * model: "string", + * inputType: Cohere.EmbedInputType.SearchDocument, + * embeddingTypes: [Cohere.EmbeddingType.Float], + * truncate: Cohere.EmbedRequestTruncate.None + * }) */ public async embed( request: Cohere.EmbedRequest, @@ -397,12 +422,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.EmbedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.EmbedRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -476,12 +505,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.RerankRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.RerankRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -584,12 +617,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ClassifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.ClassifyRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -665,12 +702,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SummarizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.SummarizeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -741,12 +782,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.TokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.TokenizeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -819,12 +864,16 @@ export class CohereClient { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.DetokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough" }), + body: await serializers.DetokenizeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -896,7 +945,7 @@ export class CohereClient { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/client/requests/ChatRequest.ts b/src/api/client/requests/ChatRequest.ts index dd26517..3527625 100644 --- a/src/api/client/requests/ChatRequest.ts +++ b/src/api/client/requests/ChatRequest.ts @@ -5,6 +5,36 @@ import * as Cohere from "../.."; /** + * @example + * { + * message: "Can you give me a global market overview of solar panels?", + * stream: false, + * chatHistory: [{ + * role: Cohere.ChatMessageRole.Chatbot, + * message: "Hi!" + * }, { + * role: Cohere.ChatMessageRole.Chatbot, + * message: "How can I help you today?" + * }], + * promptTruncation: Cohere.ChatRequestPromptTruncation.Off, + * temperature: 0.3 + * } + * + * @example + * { + * message: "Can you give me a global market overview of solar panels?", + * stream: false, + * chatHistory: [{ + * role: Cohere.ChatMessageRole.Chatbot, + * message: "Hi!" + * }, { + * role: Cohere.ChatMessageRole.Chatbot, + * message: "How can I help you today?" + * }], + * promptTruncation: Cohere.ChatRequestPromptTruncation.Off, + * temperature: 0.3 + * } + * * @example * { * message: "Can you give me a global market overview of solar panels?", diff --git a/src/api/client/requests/ChatStreamRequest.ts b/src/api/client/requests/ChatStreamRequest.ts index 97400a5..575192c 100644 --- a/src/api/client/requests/ChatStreamRequest.ts +++ b/src/api/client/requests/ChatStreamRequest.ts @@ -4,6 +4,52 @@ import * as Cohere from "../.."; +/** + * @example + * { + * message: "Can you give me a global market overview of solar panels?", + * stream: true, + * chatHistory: [{ + * role: Cohere.ChatMessageRole.Chatbot, + * message: "Hi!" + * }, { + * role: Cohere.ChatMessageRole.Chatbot, + * message: "How can I help you today?" + * }], + * promptTruncation: Cohere.ChatStreamRequestPromptTruncation.Off, + * temperature: 0.3 + * } + * + * @example + * { + * message: "Can you give me a global market overview of solar panels?", + * stream: true, + * chatHistory: [{ + * role: Cohere.ChatMessageRole.Chatbot, + * message: "Hi!" + * }, { + * role: Cohere.ChatMessageRole.Chatbot, + * message: "How can I help you today?" + * }], + * promptTruncation: Cohere.ChatStreamRequestPromptTruncation.Off, + * temperature: 0.3 + * } + * + * @example + * { + * message: "Can you give me a global market overview of solar panels?", + * stream: true, + * chatHistory: [{ + * role: Cohere.ChatMessageRole.Chatbot, + * message: "Hi!" + * }, { + * role: Cohere.ChatMessageRole.Chatbot, + * message: "How can I help you today?" + * }], + * promptTruncation: Cohere.ChatStreamRequestPromptTruncation.Off, + * temperature: 0.3 + * } + */ export interface ChatStreamRequest { /** * Text input for the model to respond to. diff --git a/src/api/client/requests/ClassifyRequest.ts b/src/api/client/requests/ClassifyRequest.ts index 0fd0419..dc0c622 100644 --- a/src/api/client/requests/ClassifyRequest.ts +++ b/src/api/client/requests/ClassifyRequest.ts @@ -5,6 +5,154 @@ import * as Cohere from "../.."; /** + * @example + * { + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * 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\u2019s meeting", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * 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\u2019s meeting", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * 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\u2019s meeting", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * inputs: ["Confirm your email address", "hey i need u to send some $"], + * 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\u2019s meeting", + * label: "Not spam" + * }, { + * text: "Pre-read for tomorrow", + * label: "Not spam" + * }], + * preset: "my-preset-a58sbd" + * } + * * @example * { * inputs: ["Confirm your email address", "hey i need u to send some $"], diff --git a/src/api/client/requests/DetokenizeRequest.ts b/src/api/client/requests/DetokenizeRequest.ts index deb55ec..f937f47 100644 --- a/src/api/client/requests/DetokenizeRequest.ts +++ b/src/api/client/requests/DetokenizeRequest.ts @@ -3,6 +3,18 @@ */ /** + * @example + * { + * tokens: [10104, 12221, 1315, 34, 1420, 69], + * model: "command" + * } + * + * @example + * { + * tokens: [10104, 12221, 1315, 34, 1420, 69], + * model: "command" + * } + * * @example * { * tokens: [10104, 12221, 1315, 34, 1420, 69], diff --git a/src/api/client/requests/EmbedRequest.ts b/src/api/client/requests/EmbedRequest.ts index 247e275..26bde83 100644 --- a/src/api/client/requests/EmbedRequest.ts +++ b/src/api/client/requests/EmbedRequest.ts @@ -4,6 +4,43 @@ import * as Cohere from "../.."; +/** + * @example + * { + * texts: ["string"], + * model: "string", + * inputType: Cohere.EmbedInputType.SearchDocument, + * embeddingTypes: [Cohere.EmbeddingType.Float], + * truncate: Cohere.EmbedRequestTruncate.None + * } + * + * @example + * { + * texts: ["string"], + * model: "string", + * inputType: Cohere.EmbedInputType.SearchDocument, + * embeddingTypes: [Cohere.EmbeddingType.Float], + * truncate: Cohere.EmbedRequestTruncate.None + * } + * + * @example + * { + * texts: ["string"], + * model: "string", + * inputType: Cohere.EmbedInputType.SearchDocument, + * embeddingTypes: [Cohere.EmbeddingType.Float], + * truncate: Cohere.EmbedRequestTruncate.None + * } + * + * @example + * { + * texts: ["string"], + * model: "string", + * inputType: Cohere.EmbedInputType.SearchDocument, + * embeddingTypes: [Cohere.EmbeddingType.Float], + * truncate: Cohere.EmbedRequestTruncate.None + * } + */ 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. */ texts: string[]; diff --git a/src/api/client/requests/GenerateRequest.ts b/src/api/client/requests/GenerateRequest.ts index 1aabb93..b992670 100644 --- a/src/api/client/requests/GenerateRequest.ts +++ b/src/api/client/requests/GenerateRequest.ts @@ -5,6 +5,34 @@ import * as Cohere from "../.."; /** + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: false, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: false, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: false, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: false, + * preset: "my-preset-a58sbd" + * } + * * @example * { * prompt: "Please explain to me how LLMs work", diff --git a/src/api/client/requests/GenerateStreamRequest.ts b/src/api/client/requests/GenerateStreamRequest.ts index 747dfbd..d3e2eb8 100644 --- a/src/api/client/requests/GenerateStreamRequest.ts +++ b/src/api/client/requests/GenerateStreamRequest.ts @@ -4,6 +4,42 @@ import * as Cohere from "../.."; +/** + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: true, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: true, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: true, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: true, + * preset: "my-preset-a58sbd" + * } + * + * @example + * { + * prompt: "Please explain to me how LLMs work", + * stream: true, + * preset: "my-preset-a58sbd" + * } + */ export interface GenerateStreamRequest { /** * The input text that serves as the starting point for generating the response. diff --git a/src/api/client/requests/RerankRequest.ts b/src/api/client/requests/RerankRequest.ts index 6451784..2d69ba0 100644 --- a/src/api/client/requests/RerankRequest.ts +++ b/src/api/client/requests/RerankRequest.ts @@ -5,6 +5,20 @@ import * as Cohere from "../.."; /** + * @example + * { + * model: "rerank-english-v2.0", + * query: "What is the capital of the United States?", + * 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.", "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 (the death penalty) 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."] + * } + * + * @example + * { + * model: "rerank-english-v2.0", + * query: "What is the capital of the United States?", + * 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.", "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 (the death penalty) 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."] + * } + * * @example * { * model: "rerank-english-v2.0", @@ -13,7 +27,7 @@ import * as Cohere from "../.."; * } */ export interface RerankRequest { - /** The identifier of the model to use, one of : `rerank-english-v2.0`, `rerank-multilingual-v2.0` */ + /** The identifier of the model to use, one of : `rerank-english-v3.0`, `rerank-multilingual-v3.0`, `rerank-english-v2.0`, `rerank-multilingual-v2.0` */ model?: string; /** The search query */ query: string; diff --git a/src/api/client/requests/SummarizeRequest.ts b/src/api/client/requests/SummarizeRequest.ts index e3a940d..94b1ed6 100644 --- a/src/api/client/requests/SummarizeRequest.ts +++ b/src/api/client/requests/SummarizeRequest.ts @@ -5,6 +5,16 @@ import * as Cohere from "../.."; /** + * @example + * { + * 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." + * } + * + * @example + * { + * 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." + * } + * * @example * { * 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." diff --git a/src/api/client/requests/TokenizeRequest.ts b/src/api/client/requests/TokenizeRequest.ts index 25a8c97..3cc120d 100644 --- a/src/api/client/requests/TokenizeRequest.ts +++ b/src/api/client/requests/TokenizeRequest.ts @@ -3,6 +3,30 @@ */ /** + * @example + * { + * text: "tokenize me! :D", + * model: "command" + * } + * + * @example + * { + * text: "tokenize me! :D", + * model: "command" + * } + * + * @example + * { + * text: "tokenize me! :D", + * model: "command" + * } + * + * @example + * { + * text: "tokenize me! :D", + * model: "command" + * } + * * @example * { * text: "tokenize me! :D", diff --git a/src/api/resources/connectors/client/Client.ts b/src/api/resources/connectors/client/Client.ts index 2e1d2e9..49c9314 100644 --- a/src/api/resources/connectors/client/Client.ts +++ b/src/api/resources/connectors/client/Client.ts @@ -33,6 +33,12 @@ export class Connectors { * * @example * await cohere.connectors.list() + * + * @example + * await cohere.connectors.list({ + * limit: 1.1, + * offset: 1.1 + * }) */ public async list( request: Cohere.ConnectorsListRequest = {}, @@ -62,7 +68,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -143,12 +149,16 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CreateConnectorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.CreateConnectorRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -204,6 +214,9 @@ export class Connectors { * * @example * await cohere.connectors.get("id") + * + * @example + * await cohere.connectors.get("string") */ public async get(id: string, requestOptions?: Connectors.RequestOptions): Promise { const _response = await core.fetcher({ @@ -220,7 +233,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -281,6 +294,9 @@ export class Connectors { * * @example * await cohere.connectors.delete("id") + * + * @example + * await cohere.connectors.delete("string") */ public async delete( id: string, @@ -300,7 +316,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -363,6 +379,9 @@ export class Connectors { * * @example * await cohere.connectors.update("id") + * + * @example + * await cohere.connectors.update("string") */ public async update( id: string, @@ -383,12 +402,16 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.UpdateConnectorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.UpdateConnectorRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -446,6 +469,11 @@ export class Connectors { * * @example * await cohere.connectors.oAuthAuthorize("id") + * + * @example + * await cohere.connectors.oAuthAuthorize("string", { + * afterTokenRedirect: "string" + * }) */ public async oAuthAuthorize( id: string, @@ -472,7 +500,7 @@ export class Connectors { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -525,7 +553,7 @@ export class Connectors { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/resources/connectors/client/requests/ConnectorsListRequest.ts b/src/api/resources/connectors/client/requests/ConnectorsListRequest.ts index 318c4a0..0ae21de 100644 --- a/src/api/resources/connectors/client/requests/ConnectorsListRequest.ts +++ b/src/api/resources/connectors/client/requests/ConnectorsListRequest.ts @@ -5,6 +5,30 @@ /** * @example * {} + * + * @example + * { + * limit: 1.1, + * offset: 1.1 + * } + * + * @example + * { + * limit: 1.1, + * offset: 1.1 + * } + * + * @example + * { + * limit: 1.1, + * offset: 1.1 + * } + * + * @example + * { + * limit: 1.1, + * offset: 1.1 + * } */ export interface ConnectorsListRequest { /** diff --git a/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts index d3a9c10..5c0fe9a 100644 --- a/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts +++ b/src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts @@ -5,6 +5,31 @@ /** * @example * {} + * + * @example + * { + * afterTokenRedirect: "string" + * } + * + * @example + * { + * afterTokenRedirect: "string" + * } + * + * @example + * { + * afterTokenRedirect: "string" + * } + * + * @example + * { + * afterTokenRedirect: "string" + * } + * + * @example + * { + * afterTokenRedirect: "string" + * } */ export interface ConnectorsOAuthAuthorizeRequest { /** diff --git a/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts index 90b4224..4a5142c 100644 --- a/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts +++ b/src/api/resources/connectors/client/requests/CreateConnectorRequest.ts @@ -5,6 +5,36 @@ import * as Cohere from "../../../.."; /** + * @example + * { + * name: "name", + * url: "url" + * } + * + * @example + * { + * name: "name", + * url: "url" + * } + * + * @example + * { + * name: "name", + * url: "url" + * } + * + * @example + * { + * name: "name", + * url: "url" + * } + * + * @example + * { + * name: "name", + * url: "url" + * } + * * @example * { * name: "name", diff --git a/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts index 6f3ebf3..2094e27 100644 --- a/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts +++ b/src/api/resources/connectors/client/requests/UpdateConnectorRequest.ts @@ -5,6 +5,24 @@ import * as Cohere from "../../../.."; /** + * @example + * {} + * + * @example + * {} + * + * @example + * {} + * + * @example + * {} + * + * @example + * {} + * + * @example + * {} + * * @example * {} */ diff --git a/src/api/resources/datasets/client/Client.ts b/src/api/resources/datasets/client/Client.ts index 45e958f..e3ba297 100644 --- a/src/api/resources/datasets/client/Client.ts +++ b/src/api/resources/datasets/client/Client.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import { default as FormData } from "form-data"; -import * as fs from "fs"; -import urlJoin from "url-join"; -import * as Cohere from "../../.."; -import * as core from "../../../../core"; import * as environments from "../../../../environments"; -import * as errors from "../../../../errors"; +import * as core from "../../../../core"; +import * as Cohere from "../../.."; +import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; +import * as fs from "fs"; +import { default as FormData } from "form-data"; export declare namespace Datasets { interface Options { @@ -25,7 +25,7 @@ export declare namespace Datasets { } export class Datasets { - constructor(protected readonly _options: Datasets.Options = {}) { } + constructor(protected readonly _options: Datasets.Options = {}) {} /** * List datasets that have been created. @@ -33,6 +33,15 @@ export class Datasets { * * @example * await cohere.datasets.list() + * + * @example + * await cohere.datasets.list({ + * datasetType: "string", + * before: new Date("2024-01-15T09:30:00.000Z"), + * after: new Date("2024-01-15T09:30:00.000Z"), + * limit: 1.1, + * offset: 1.1 + * }) */ public async list( request: Cohere.DatasetsListRequest = {}, @@ -74,7 +83,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -165,6 +174,10 @@ export class Datasets { _queryParams["csv_delimiter"] = request.csvDelimiter; } + if (request.dryRun != null) { + _queryParams["dry_run"] = request.dryRun.toString(); + } + const _request = new FormData(); _request.append("data", data); if (evalData != null) { @@ -185,7 +198,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -254,7 +267,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -305,6 +318,9 @@ export class Datasets { * * @example * await cohere.datasets.get("id") + * + * @example + * await cohere.datasets.get("string") */ public async get(id: string, requestOptions?: Datasets.RequestOptions): Promise { const _response = await core.fetcher({ @@ -321,7 +337,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -372,6 +388,9 @@ export class Datasets { * * @example * await cohere.datasets.delete("id") + * + * @example + * await cohere.datasets.delete("string") */ public async delete(id: string, requestOptions?: Datasets.RequestOptions): Promise> { const _response = await core.fetcher({ @@ -388,7 +407,7 @@ export class Datasets { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -434,7 +453,7 @@ export class Datasets { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts index 554cffd..14b5bae 100644 --- a/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts +++ b/src/api/resources/datasets/client/requests/DatasetsCreateRequest.ts @@ -4,6 +4,39 @@ import * as Cohere from "../../../.."; +/** + * @example + * { + * name: "name", + * type: Cohere.DatasetType.EmbedInput + * } + * + * @example + * { + * name: "string", + * type: Cohere.DatasetType.EmbedInput, + * keepOriginalFile: true, + * skipMalformedInput: true, + * keepFields: "string", + * optionalFields: "string", + * textSeparator: "string", + * csvDelimiter: "string", + * dryRun: true + * } + * + * @example + * { + * name: "string", + * type: Cohere.DatasetType.EmbedInput, + * keepOriginalFile: true, + * skipMalformedInput: true, + * keepFields: "string", + * optionalFields: "string", + * textSeparator: "string", + * csvDelimiter: "string", + * dryRun: true + * } + */ export interface DatasetsCreateRequest { /** * The name of the uploaded dataset. @@ -37,4 +70,8 @@ export interface DatasetsCreateRequest { * The delimiter used for .csv uploads. */ csvDelimiter?: string; + /** + * flag to enable dry_run mode + */ + dryRun?: boolean; } diff --git a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts index d62c631..4c99721 100644 --- a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts +++ b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts @@ -5,6 +5,24 @@ /** * @example * {} + * + * @example + * { + * datasetType: "string", + * before: new Date("2024-01-15T09:30:00.000Z"), + * after: new Date("2024-01-15T09:30:00.000Z"), + * limit: 1.1, + * offset: 1.1 + * } + * + * @example + * { + * datasetType: "string", + * before: new Date("2024-01-15T09:30:00.000Z"), + * after: new Date("2024-01-15T09:30:00.000Z"), + * limit: 1.1, + * offset: 1.1 + * } */ export interface DatasetsListRequest { /** diff --git a/src/api/resources/embedJobs/client/Client.ts b/src/api/resources/embedJobs/client/Client.ts index d5a273b..6d938ab 100644 --- a/src/api/resources/embedJobs/client/Client.ts +++ b/src/api/resources/embedJobs/client/Client.ts @@ -49,7 +49,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -129,12 +129,16 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CreateEmbedJobRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.CreateEmbedJobRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -188,6 +192,9 @@ export class EmbedJobs { * * @example * await cohere.embedJobs.get("id") + * + * @example + * await cohere.embedJobs.get("string") */ public async get(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { const _response = await core.fetcher({ @@ -204,7 +211,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -264,6 +271,9 @@ export class EmbedJobs { * * @example * await cohere.embedJobs.cancel("id") + * + * @example + * await cohere.embedJobs.cancel("string") */ public async cancel(id: string, requestOptions?: EmbedJobs.RequestOptions): Promise { const _response = await core.fetcher({ @@ -280,7 +290,7 @@ export class EmbedJobs { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -326,7 +336,7 @@ export class EmbedJobs { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts index 433b816..b474316 100644 --- a/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts +++ b/src/api/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts @@ -5,6 +5,34 @@ import * as Cohere from "../../../.."; /** + * @example + * { + * model: "model", + * datasetId: "dataset_id", + * inputType: Cohere.EmbedInputType.SearchDocument + * } + * + * @example + * { + * model: "model", + * datasetId: "dataset_id", + * inputType: Cohere.EmbedInputType.SearchDocument + * } + * + * @example + * { + * model: "model", + * datasetId: "dataset_id", + * inputType: Cohere.EmbedInputType.SearchDocument + * } + * + * @example + * { + * model: "model", + * datasetId: "dataset_id", + * inputType: Cohere.EmbedInputType.SearchDocument + * } + * * @example * { * model: "model", diff --git a/src/api/resources/finetuning/client/Client.ts b/src/api/resources/finetuning/client/Client.ts index f22dc68..43ef148 100644 --- a/src/api/resources/finetuning/client/Client.ts +++ b/src/api/resources/finetuning/client/Client.ts @@ -38,6 +38,13 @@ export class Finetuning { * * @example * await cohere.finetuning.listFinetunedModels() + * + * @example + * await cohere.finetuning.listFinetunedModels({ + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * }) */ public async listFinetunedModels( request: Cohere.FinetuningListFinetunedModelsRequest = {}, @@ -71,7 +78,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -180,12 +187,16 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.finetuning.FinetunedModel.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.finetuning.FinetunedModel.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, }); @@ -262,6 +273,9 @@ export class Finetuning { * * @example * await cohere.finetuning.getFinetunedModel("id") + * + * @example + * await cohere.finetuning.getFinetunedModel("string") */ public async getFinetunedModel( id: string, @@ -281,7 +295,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -362,6 +376,9 @@ export class Finetuning { * * @example * await cohere.finetuning.deleteFinetunedModel("id") + * + * @example + * await cohere.finetuning.deleteFinetunedModel("string") */ public async deleteFinetunedModel( id: string, @@ -381,7 +398,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -470,6 +487,17 @@ export class Finetuning { * datasetId: "dataset_id" * } * }) + * + * @example + * await cohere.finetuning.updateFinetunedModel("string", { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * }) */ public async updateFinetunedModel( id: string, @@ -490,13 +518,15 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", body: await serializers.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 300000, maxRetries: requestOptions?.maxRetries, @@ -574,6 +604,13 @@ export class Finetuning { * * @example * await cohere.finetuning.listEvents("finetuned_model_id") + * + * @example + * await cohere.finetuning.listEvents("string", { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * }) */ public async listEvents( finetunedModelId: string, @@ -608,7 +645,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -690,6 +727,12 @@ export class Finetuning { * * @example * await cohere.finetuning.listTrainingStepMetrics("finetuned_model_id") + * + * @example + * await cohere.finetuning.listTrainingStepMetrics("string", { + * pageSize: 1, + * pageToken: "string" + * }) */ public async listTrainingStepMetrics( finetunedModelId: string, @@ -720,7 +763,7 @@ export class Finetuning { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -793,7 +836,7 @@ export class Finetuning { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts index b96e5bd..868cd6e 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListEventsRequest.ts @@ -5,6 +5,55 @@ /** * @example * {} + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } */ export interface FinetuningListEventsRequest { /** diff --git a/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts index 833f92d..09233ab 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListFinetunedModelsRequest.ts @@ -5,6 +5,55 @@ /** * @example * {} + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string", + * orderBy: "string" + * } */ export interface FinetuningListFinetunedModelsRequest { /** diff --git a/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts index 535c0b8..b54b0f3 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts @@ -5,6 +5,48 @@ /** * @example * {} + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } + * + * @example + * { + * pageSize: 1, + * pageToken: "string" + * } */ export interface FinetuningListTrainingStepMetricsRequest { /** diff --git a/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts b/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts index 3bb5f81..24a4441 100644 --- a/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts +++ b/src/api/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts @@ -5,6 +5,83 @@ import * as Cohere from "../../../.."; /** + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * + * @example + * { + * name: "name", + * settings: { + * baseModel: { + * baseType: Cohere.finetuning.BaseType.BaseTypeUnspecified + * }, + * datasetId: "dataset_id" + * } + * } + * * @example * { * name: "name", diff --git a/src/api/resources/models/client/Client.ts b/src/api/resources/models/client/Client.ts index a36222e..d71a48d 100644 --- a/src/api/resources/models/client/Client.ts +++ b/src/api/resources/models/client/Client.ts @@ -33,6 +33,9 @@ export class Models { * * @example * await cohere.models.get("model") + * + * @example + * await cohere.models.get("string") */ public async get(model: string, requestOptions?: Models.RequestOptions): Promise { const _response = await core.fetcher({ @@ -49,7 +52,7 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -104,12 +107,20 @@ export class Models { * * @example * await cohere.models.list() + * + * @example + * await cohere.models.list({ + * pageSize: 1.1, + * pageToken: "string", + * endpoint: Cohere.CompatibleEndpoint.Chat, + * defaultOnly: true + * }) */ public async list( request: Cohere.ModelsListRequest = {}, requestOptions?: Models.RequestOptions ): Promise { - const { pageSize, pageToken, endpoint } = request; + const { pageSize, pageToken, endpoint, defaultOnly } = request; const _queryParams: Record = {}; if (pageSize != null) { _queryParams["page_size"] = pageSize.toString(); @@ -123,6 +134,10 @@ export class Models { _queryParams["endpoint"] = endpoint; } + if (defaultOnly != null) { + _queryParams["default_only"] = defaultOnly.toString(); + } + const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, @@ -137,7 +152,7 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "cohere-ai", - "X-Fern-SDK-Version": "7.9.3", + "X-Fern-SDK-Version": "7.9.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -184,7 +199,7 @@ export class Models { } protected async _getAuthorizationHeader() { - const bearer = (await core.Supplier.get(this._options.token)) ?? process.env["CO_API_KEY"]; + 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.", diff --git a/src/api/resources/models/client/requests/ModelsListRequest.ts b/src/api/resources/models/client/requests/ModelsListRequest.ts index 5f53181..a47d570 100644 --- a/src/api/resources/models/client/requests/ModelsListRequest.ts +++ b/src/api/resources/models/client/requests/ModelsListRequest.ts @@ -7,6 +7,22 @@ import * as Cohere from "../../../.."; /** * @example * {} + * + * @example + * { + * pageSize: 1.1, + * pageToken: "string", + * endpoint: Cohere.CompatibleEndpoint.Chat, + * defaultOnly: true + * } + * + * @example + * { + * pageSize: 1.1, + * pageToken: "string", + * endpoint: Cohere.CompatibleEndpoint.Chat, + * defaultOnly: true + * } */ export interface ModelsListRequest { /** @@ -22,4 +38,8 @@ export interface ModelsListRequest { * When provided, filters the list of models to only those that are compatible with the specified endpoint. */ endpoint?: Cohere.CompatibleEndpoint; + /** + * 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; } diff --git a/src/api/types/GetModelResponse.ts b/src/api/types/GetModelResponse.ts index cc140f1..7c29995 100644 --- a/src/api/types/GetModelResponse.ts +++ b/src/api/types/GetModelResponse.ts @@ -18,4 +18,6 @@ export interface GetModelResponse { contextLength?: number; /** Public URL to the tokenizer's configuration file. */ tokenizerUrl?: string; + /** The API endpoints that the model is default to. */ + defaultEndpoints?: Cohere.CompatibleEndpoint[]; } diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts index 4abadfb..6427678 100644 --- a/src/core/schemas/builders/object/object.ts +++ b/src/core/schemas/builders/object/object.ts @@ -60,7 +60,7 @@ export function object): Promise { - return !(await isSchemaOptional(schema)); +function isSchemaRequired(schema: Schema): boolean { + return !isSchemaOptional(schema); } -async function isSchemaOptional(schema: Schema): Promise { - switch (await schema.getType()) { +function isSchemaOptional(schema: Schema): boolean { + switch (schema.getType()) { case SchemaType.ANY: case SchemaType.UNKNOWN: case SchemaType.OPTIONAL: diff --git a/src/serialization/client/requests/ChatRequest.ts b/src/serialization/client/requests/ChatRequest.ts index b67e00f..0d557c8 100644 --- a/src/serialization/client/requests/ChatRequest.ts +++ b/src/serialization/client/requests/ChatRequest.ts @@ -5,30 +5,24 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; import * as core from "../../../core"; +import { ChatMessage } from "../../types/ChatMessage"; +import { ChatRequestPromptTruncation } from "../../types/ChatRequestPromptTruncation"; +import { ChatConnector } from "../../types/ChatConnector"; +import { ChatDocument } from "../../types/ChatDocument"; +import { Tool } from "../../types/Tool"; +import { ChatRequestToolResultsItem } from "../../types/ChatRequestToolResultsItem"; export const ChatRequest: core.serialization.Schema = 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(core.serialization.lazyObject(async () => (await import("../..")).ChatMessage)) - .optional() - ), + chatHistory: core.serialization.property("chat_history", core.serialization.list(ChatMessage).optional()), conversationId: core.serialization.property("conversation_id", core.serialization.string().optional()), - promptTruncation: core.serialization.property( - "prompt_truncation", - core.serialization.lazy(async () => (await import("../..")).ChatRequestPromptTruncation).optional() - ), - connectors: core.serialization - .list(core.serialization.lazyObject(async () => (await import("../..")).ChatConnector)) - .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(core.serialization.lazy(async () => (await import("../..")).ChatDocument)) - .optional(), + documents: core.serialization.list(ChatDocument).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()), @@ -42,14 +36,10 @@ export const ChatRequest: core.serialization.Schema (await import("../..")).Tool)) - .optional(), + tools: core.serialization.list(Tool).optional(), toolResults: core.serialization.property( "tool_results", - core.serialization - .list(core.serialization.lazyObject(async () => (await import("../..")).ChatRequestToolResultsItem)) - .optional() + core.serialization.list(ChatRequestToolResultsItem).optional() ), }); @@ -58,12 +48,12 @@ export declare namespace ChatRequest { message: string; model?: string | null; preamble?: string | null; - chat_history?: serializers.ChatMessage.Raw[] | null; + chat_history?: ChatMessage.Raw[] | null; conversation_id?: string | null; - prompt_truncation?: serializers.ChatRequestPromptTruncation.Raw | null; - connectors?: serializers.ChatConnector.Raw[] | null; + prompt_truncation?: ChatRequestPromptTruncation.Raw | null; + connectors?: ChatConnector.Raw[] | null; search_queries_only?: boolean | null; - documents?: serializers.ChatDocument.Raw[] | null; + documents?: ChatDocument.Raw[] | null; temperature?: number | null; max_tokens?: number | null; max_input_tokens?: number | null; @@ -74,7 +64,7 @@ export declare namespace ChatRequest { frequency_penalty?: number | null; presence_penalty?: number | null; raw_prompting?: boolean | null; - tools?: serializers.Tool.Raw[] | null; - tool_results?: serializers.ChatRequestToolResultsItem.Raw[] | null; + tools?: Tool.Raw[] | null; + tool_results?: ChatRequestToolResultsItem.Raw[] | null; } } diff --git a/src/serialization/client/requests/ChatStreamRequest.ts b/src/serialization/client/requests/ChatStreamRequest.ts index 18adf0f..cbe53b7 100644 --- a/src/serialization/client/requests/ChatStreamRequest.ts +++ b/src/serialization/client/requests/ChatStreamRequest.ts @@ -5,30 +5,27 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; import * as core from "../../../core"; +import { ChatMessage } from "../../types/ChatMessage"; +import { ChatStreamRequestPromptTruncation } from "../../types/ChatStreamRequestPromptTruncation"; +import { ChatConnector } from "../../types/ChatConnector"; +import { ChatDocument } from "../../types/ChatDocument"; +import { Tool } from "../../types/Tool"; +import { ChatStreamRequestToolResultsItem } from "../../types/ChatStreamRequestToolResultsItem"; export const ChatStreamRequest: core.serialization.Schema = 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(core.serialization.lazyObject(async () => (await import("../..")).ChatMessage)) - .optional() - ), + chatHistory: core.serialization.property("chat_history", core.serialization.list(ChatMessage).optional()), conversationId: core.serialization.property("conversation_id", core.serialization.string().optional()), promptTruncation: core.serialization.property( "prompt_truncation", - core.serialization.lazy(async () => (await import("../..")).ChatStreamRequestPromptTruncation).optional() + ChatStreamRequestPromptTruncation.optional() ), - connectors: core.serialization - .list(core.serialization.lazyObject(async () => (await import("../..")).ChatConnector)) - .optional(), + connectors: core.serialization.list(ChatConnector).optional(), searchQueriesOnly: core.serialization.property("search_queries_only", core.serialization.boolean().optional()), - documents: core.serialization - .list(core.serialization.lazy(async () => (await import("../..")).ChatDocument)) - .optional(), + documents: core.serialization.list(ChatDocument).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()), @@ -42,16 +39,10 @@ export const ChatStreamRequest: core.serialization.Schema (await import("../..")).Tool)) - .optional(), + tools: core.serialization.list(Tool).optional(), toolResults: core.serialization.property( "tool_results", - core.serialization - .list( - core.serialization.lazyObject(async () => (await import("../..")).ChatStreamRequestToolResultsItem) - ) - .optional() + core.serialization.list(ChatStreamRequestToolResultsItem).optional() ), }); @@ -60,12 +51,12 @@ export declare namespace ChatStreamRequest { message: string; model?: string | null; preamble?: string | null; - chat_history?: serializers.ChatMessage.Raw[] | null; + chat_history?: ChatMessage.Raw[] | null; conversation_id?: string | null; - prompt_truncation?: serializers.ChatStreamRequestPromptTruncation.Raw | null; - connectors?: serializers.ChatConnector.Raw[] | null; + prompt_truncation?: ChatStreamRequestPromptTruncation.Raw | null; + connectors?: ChatConnector.Raw[] | null; search_queries_only?: boolean | null; - documents?: serializers.ChatDocument.Raw[] | null; + documents?: ChatDocument.Raw[] | null; temperature?: number | null; max_tokens?: number | null; max_input_tokens?: number | null; @@ -76,7 +67,7 @@ export declare namespace ChatStreamRequest { frequency_penalty?: number | null; presence_penalty?: number | null; raw_prompting?: boolean | null; - tools?: serializers.Tool.Raw[] | null; - tool_results?: serializers.ChatStreamRequestToolResultsItem.Raw[] | null; + tools?: Tool.Raw[] | null; + tool_results?: ChatStreamRequestToolResultsItem.Raw[] | null; } } diff --git a/src/serialization/client/requests/ClassifyRequest.ts b/src/serialization/client/requests/ClassifyRequest.ts index 3e9952a..166876c 100644 --- a/src/serialization/client/requests/ClassifyRequest.ts +++ b/src/serialization/client/requests/ClassifyRequest.ts @@ -5,24 +5,24 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; 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( - core.serialization.lazyObject(async () => (await import("../..")).ClassifyExample) - ), + examples: core.serialization.list(ClassifyExample), model: core.serialization.string().optional(), preset: core.serialization.string().optional(), - truncate: core.serialization.lazy(async () => (await import("../..")).ClassifyRequestTruncate).optional(), + truncate: ClassifyRequestTruncate.optional(), }); export declare namespace ClassifyRequest { interface Raw { inputs: string[]; - examples: serializers.ClassifyExample.Raw[]; + examples: ClassifyExample.Raw[]; model?: string | null; preset?: string | null; - truncate?: serializers.ClassifyRequestTruncate.Raw | null; + truncate?: ClassifyRequestTruncate.Raw | null; } } diff --git a/src/serialization/client/requests/EmbedRequest.ts b/src/serialization/client/requests/EmbedRequest.ts index 448a22d..5bd1a94 100644 --- a/src/serialization/client/requests/EmbedRequest.ts +++ b/src/serialization/client/requests/EmbedRequest.ts @@ -5,30 +5,28 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; 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()), model: core.serialization.string().optional(), - inputType: core.serialization.property( - "input_type", - core.serialization.lazy(async () => (await import("../..")).EmbedInputType).optional() - ), + inputType: core.serialization.property("input_type", EmbedInputType.optional()), embeddingTypes: core.serialization.property( "embedding_types", - core.serialization - .list(core.serialization.lazy(async () => (await import("../..")).EmbeddingType)) - .optional() + core.serialization.list(EmbeddingType).optional() ), - truncate: core.serialization.lazy(async () => (await import("../..")).EmbedRequestTruncate).optional(), + truncate: EmbedRequestTruncate.optional(), }); export declare namespace EmbedRequest { interface Raw { texts: string[]; model?: string | null; - input_type?: serializers.EmbedInputType.Raw | null; - embedding_types?: serializers.EmbeddingType.Raw[] | null; - truncate?: serializers.EmbedRequestTruncate.Raw | 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 index 7d921cd..6e01ec6 100644 --- a/src/serialization/client/requests/GenerateRequest.ts +++ b/src/serialization/client/requests/GenerateRequest.ts @@ -5,6 +5,8 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; import * as core from "../../../core"; +import { GenerateRequestTruncate } from "../../types/GenerateRequestTruncate"; +import { GenerateRequestReturnLikelihoods } from "../../types/GenerateRequestReturnLikelihoods"; export const GenerateRequest: core.serialization.Schema = core.serialization.object({ @@ -12,7 +14,7 @@ export const GenerateRequest: core.serialization.Schema (await import("../..")).GenerateRequestTruncate).optional(), + truncate: GenerateRequestTruncate.optional(), temperature: core.serialization.number().optional(), seed: core.serialization.number().optional(), preset: core.serialization.string().optional(), @@ -30,7 +32,7 @@ export const GenerateRequest: core.serialization.Schema (await import("../..")).GenerateRequestReturnLikelihoods).optional() + GenerateRequestReturnLikelihoods.optional() ), rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), }); @@ -41,7 +43,7 @@ export declare namespace GenerateRequest { model?: string | null; num_generations?: number | null; max_tokens?: number | null; - truncate?: serializers.GenerateRequestTruncate.Raw | null; + truncate?: GenerateRequestTruncate.Raw | null; temperature?: number | null; seed?: number | null; preset?: string | null; @@ -51,7 +53,7 @@ export declare namespace GenerateRequest { p?: number | null; frequency_penalty?: number | null; presence_penalty?: number | null; - return_likelihoods?: serializers.GenerateRequestReturnLikelihoods.Raw | 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 index ba9c676..950ac14 100644 --- a/src/serialization/client/requests/GenerateStreamRequest.ts +++ b/src/serialization/client/requests/GenerateStreamRequest.ts @@ -5,6 +5,8 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; import * as core from "../../../core"; +import { GenerateStreamRequestTruncate } from "../../types/GenerateStreamRequestTruncate"; +import { GenerateStreamRequestReturnLikelihoods } from "../../types/GenerateStreamRequestReturnLikelihoods"; export const GenerateStreamRequest: core.serialization.Schema< serializers.GenerateStreamRequest.Raw, @@ -14,7 +16,7 @@ export const GenerateStreamRequest: core.serialization.Schema< 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: core.serialization.lazy(async () => (await import("../..")).GenerateStreamRequestTruncate).optional(), + truncate: GenerateStreamRequestTruncate.optional(), temperature: core.serialization.number().optional(), seed: core.serialization.number().optional(), preset: core.serialization.string().optional(), @@ -32,7 +34,7 @@ export const GenerateStreamRequest: core.serialization.Schema< presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), returnLikelihoods: core.serialization.property( "return_likelihoods", - core.serialization.lazy(async () => (await import("../..")).GenerateStreamRequestReturnLikelihoods).optional() + GenerateStreamRequestReturnLikelihoods.optional() ), rawPrompting: core.serialization.property("raw_prompting", core.serialization.boolean().optional()), }); @@ -43,7 +45,7 @@ export declare namespace GenerateStreamRequest { model?: string | null; num_generations?: number | null; max_tokens?: number | null; - truncate?: serializers.GenerateStreamRequestTruncate.Raw | null; + truncate?: GenerateStreamRequestTruncate.Raw | null; temperature?: number | null; seed?: number | null; preset?: string | null; @@ -53,7 +55,7 @@ export declare namespace GenerateStreamRequest { p?: number | null; frequency_penalty?: number | null; presence_penalty?: number | null; - return_likelihoods?: serializers.GenerateStreamRequestReturnLikelihoods.Raw | 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 index c475155..869639e 100644 --- a/src/serialization/client/requests/RerankRequest.ts +++ b/src/serialization/client/requests/RerankRequest.ts @@ -5,14 +5,13 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; 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( - core.serialization.lazy(async () => (await import("../..")).RerankRequestDocumentsItem) - ), + documents: core.serialization.list(RerankRequestDocumentsItem), topN: core.serialization.property("top_n", core.serialization.number().optional()), rankFields: core.serialization.property( "rank_fields", @@ -26,7 +25,7 @@ export declare namespace RerankRequest { interface Raw { model?: string | null; query: string; - documents: serializers.RerankRequestDocumentsItem.Raw[]; + documents: RerankRequestDocumentsItem.Raw[]; top_n?: number | null; rank_fields?: string[] | null; return_documents?: boolean | null; diff --git a/src/serialization/client/requests/SummarizeRequest.ts b/src/serialization/client/requests/SummarizeRequest.ts index 0f28798..6c0f0f2 100644 --- a/src/serialization/client/requests/SummarizeRequest.ts +++ b/src/serialization/client/requests/SummarizeRequest.ts @@ -5,16 +5,17 @@ import * as serializers from "../.."; import * as Cohere from "../../../api"; 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: core.serialization.lazy(async () => (await import("../..")).SummarizeRequestLength).optional(), - format: core.serialization.lazy(async () => (await import("../..")).SummarizeRequestFormat).optional(), + length: SummarizeRequestLength.optional(), + format: SummarizeRequestFormat.optional(), model: core.serialization.string().optional(), - extractiveness: core.serialization - .lazy(async () => (await import("../..")).SummarizeRequestExtractiveness) - .optional(), + extractiveness: SummarizeRequestExtractiveness.optional(), temperature: core.serialization.number().optional(), additionalCommand: core.serialization.property("additional_command", core.serialization.string().optional()), }); @@ -22,10 +23,10 @@ export const SummarizeRequest: core.serialization.Schema (await import("../../../..")).CreateConnectorOAuth).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", - core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth).optional() - ), + serviceAuth: core.serialization.property("service_auth", CreateConnectorServiceAuth.optional()), }); export declare namespace CreateConnectorRequest { @@ -29,9 +28,9 @@ export declare namespace CreateConnectorRequest { description?: string | null; url: string; excludes?: string[] | null; - oauth?: serializers.CreateConnectorOAuth.Raw | null; + oauth?: CreateConnectorOAuth.Raw | null; active?: boolean | null; continue_on_failure?: boolean | null; - service_auth?: serializers.CreateConnectorServiceAuth.Raw | 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 index 5962d62..6ee21d9 100644 --- a/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts +++ b/src/serialization/resources/connectors/client/requests/UpdateConnectorRequest.ts @@ -5,6 +5,8 @@ import * as serializers from "../../../.."; import * as Cohere from "../../../../../api"; import * as core from "../../../../../core"; +import { CreateConnectorOAuth } from "../../../../types/CreateConnectorOAuth"; +import { CreateConnectorServiceAuth } from "../../../../types/CreateConnectorServiceAuth"; export const UpdateConnectorRequest: core.serialization.Schema< serializers.UpdateConnectorRequest.Raw, @@ -13,13 +15,10 @@ export const UpdateConnectorRequest: core.serialization.Schema< name: core.serialization.string().optional(), url: core.serialization.string().optional(), excludes: core.serialization.list(core.serialization.string()).optional(), - oauth: core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorOAuth).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", - core.serialization.lazyObject(async () => (await import("../../../..")).CreateConnectorServiceAuth).optional() - ), + serviceAuth: core.serialization.property("service_auth", CreateConnectorServiceAuth.optional()), }); export declare namespace UpdateConnectorRequest { @@ -27,9 +26,9 @@ export declare namespace UpdateConnectorRequest { name?: string | null; url?: string | null; excludes?: string[] | null; - oauth?: serializers.CreateConnectorOAuth.Raw | null; + oauth?: CreateConnectorOAuth.Raw | null; active?: boolean | null; continue_on_failure?: boolean | null; - service_auth?: serializers.CreateConnectorServiceAuth.Raw | null; + service_auth?: CreateConnectorServiceAuth.Raw | null; } } diff --git a/src/serialization/resources/datasets/types/DatasetsGetResponse.ts b/src/serialization/resources/datasets/types/DatasetsGetResponse.ts index fca7b42..28d7280 100644 --- a/src/serialization/resources/datasets/types/DatasetsGetResponse.ts +++ b/src/serialization/resources/datasets/types/DatasetsGetResponse.ts @@ -5,16 +5,17 @@ import * as serializers from "../../.."; import * as Cohere from "../../../../api"; 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: core.serialization.lazyObject(async () => (await import("../../..")).Dataset), + dataset: Dataset, }); export declare namespace DatasetsGetResponse { interface Raw { - dataset: serializers.Dataset.Raw; + dataset: Dataset.Raw; } } diff --git a/src/serialization/resources/datasets/types/DatasetsListResponse.ts b/src/serialization/resources/datasets/types/DatasetsListResponse.ts index ea1e255..18f2408 100644 --- a/src/serialization/resources/datasets/types/DatasetsListResponse.ts +++ b/src/serialization/resources/datasets/types/DatasetsListResponse.ts @@ -5,18 +5,17 @@ import * as serializers from "../../.."; import * as Cohere from "../../../../api"; 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(core.serialization.lazyObject(async () => (await import("../../..")).Dataset)) - .optional(), + datasets: core.serialization.list(Dataset).optional(), }); export declare namespace DatasetsListResponse { interface Raw { - datasets?: serializers.Dataset.Raw[] | null; + datasets?: Dataset.Raw[] | null; } } diff --git a/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts b/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts index 2f9f178..798d1ab 100644 --- a/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts +++ b/src/serialization/resources/embedJobs/client/requests/CreateEmbedJobRequest.ts @@ -5,6 +5,9 @@ import * as serializers from "../../../.."; import * as Cohere from "../../../../../api"; 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, @@ -12,29 +15,19 @@ export const CreateEmbedJobRequest: core.serialization.Schema< > = core.serialization.object({ model: core.serialization.string(), datasetId: core.serialization.property("dataset_id", core.serialization.string()), - inputType: core.serialization.property( - "input_type", - core.serialization.lazy(async () => (await import("../../../..")).EmbedInputType) - ), + inputType: core.serialization.property("input_type", EmbedInputType), name: core.serialization.string().optional(), - embeddingTypes: core.serialization.property( - "embedding_types", - core.serialization - .list(core.serialization.lazy(async () => (await import("../../../..")).EmbeddingType)) - .optional() - ), - truncate: core.serialization - .lazy(async () => (await import("../../../..")).CreateEmbedJobRequestTruncate) - .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: serializers.EmbedInputType.Raw; + input_type: EmbedInputType.Raw; name?: string | null; - embedding_types?: serializers.EmbeddingType.Raw[] | null; - truncate?: serializers.CreateEmbedJobRequestTruncate.Raw | null; + embedding_types?: EmbeddingType.Raw[] | null; + truncate?: CreateEmbedJobRequestTruncate.Raw | null; } } diff --git a/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts b/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts index 2865c16..4d3c09b 100644 --- a/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts +++ b/src/serialization/resources/finetuning/client/requests/FinetuningUpdateFinetunedModelRequest.ts @@ -5,6 +5,8 @@ import * as serializers from "../../../.."; import * as Cohere from "../../../../../api"; 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, @@ -13,8 +15,8 @@ export const FinetuningUpdateFinetunedModelRequest: core.serialization.Schema< 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: core.serialization.lazyObject(async () => (await import("../../../..")).finetuning.Settings), - status: core.serialization.lazy(async () => (await import("../../../..")).finetuning.Status).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()), @@ -26,8 +28,8 @@ export declare namespace FinetuningUpdateFinetunedModelRequest { name: string; creator_id?: string | null; organization_id?: string | null; - settings: serializers.finetuning.Settings.Raw; - status?: serializers.finetuning.Status.Raw | null; + settings: Settings.Raw; + status?: Status.Raw | null; created_at?: string | null; updated_at?: string | null; completed_at?: string | null; diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts b/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts index 4fa526b..dce4ccc 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/BaseModel.ts @@ -5,6 +5,8 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; import * as core from "../../../../../../core"; +import { BaseType } from "./BaseType"; +import { Strategy } from "./Strategy"; export const BaseModel: core.serialization.ObjectSchema< serializers.finetuning.BaseModel.Raw, @@ -12,18 +14,15 @@ export const BaseModel: core.serialization.ObjectSchema< > = core.serialization.object({ name: core.serialization.string().optional(), version: core.serialization.string().optional(), - baseType: core.serialization.property( - "base_type", - core.serialization.lazy(async () => (await import("../../../../..")).finetuning.BaseType) - ), - strategy: core.serialization.lazy(async () => (await import("../../../../..")).finetuning.Strategy).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: serializers.finetuning.BaseType.Raw; - strategy?: serializers.finetuning.Strategy.Raw | null; + base_type: BaseType.Raw; + strategy?: Strategy.Raw | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts index 52f3ba3..6b30cf0 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts @@ -5,19 +5,17 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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", - core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.FinetunedModel).optional() - ), + finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), }); export declare namespace CreateFinetunedModelResponse { interface Raw { - finetuned_model?: serializers.finetuning.FinetunedModel.Raw | null; + finetuned_model?: FinetunedModel.Raw | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts index d8b28b0..b55431b 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/Event.ts @@ -5,18 +5,19 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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: core.serialization.lazy(async () => (await import("../../../../..")).finetuning.Status).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?: serializers.finetuning.Status.Raw | 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 index aba0476..a247fe1 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/FinetunedModel.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/FinetunedModel.ts @@ -5,6 +5,8 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; import * as core from "../../../../../../core"; +import { Settings } from "./Settings"; +import { Status } from "./Status"; export const FinetunedModel: core.serialization.ObjectSchema< serializers.finetuning.FinetunedModel.Raw, @@ -14,8 +16,8 @@ export const FinetunedModel: core.serialization.ObjectSchema< 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: core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.Settings), - status: core.serialization.lazy(async () => (await import("../../../../..")).finetuning.Status).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()), @@ -28,8 +30,8 @@ export declare namespace FinetunedModel { name: string; creator_id?: string | null; organization_id?: string | null; - settings: serializers.finetuning.Settings.Raw; - status?: serializers.finetuning.Status.Raw | null; + settings: Settings.Raw; + status?: Status.Raw | null; created_at?: string | null; updated_at?: string | null; completed_at?: string | null; diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts index d28f496..040afb5 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts @@ -5,19 +5,17 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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", - core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.FinetunedModel).optional() - ), + finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), }); export declare namespace GetFinetunedModelResponse { interface Raw { - finetuned_model?: serializers.finetuning.FinetunedModel.Raw | null; + finetuned_model?: FinetunedModel.Raw | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts index d0255f6..fbf5239 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts @@ -5,21 +5,20 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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(core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.Event)) - .optional(), + 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?: serializers.finetuning.Event.Raw[] | null; + 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 index 200bff0..9c01ec9 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/ListFinetunedModelsResponse.ts @@ -5,6 +5,7 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; import * as core from "../../../../../../core"; +import { FinetunedModel } from "./FinetunedModel"; export const ListFinetunedModelsResponse: core.serialization.ObjectSchema< serializers.finetuning.ListFinetunedModelsResponse.Raw, @@ -12,9 +13,7 @@ export const ListFinetunedModelsResponse: core.serialization.ObjectSchema< > = core.serialization.object({ finetunedModels: core.serialization.property( "finetuned_models", - core.serialization - .list(core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.FinetunedModel)) - .optional() + 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()), @@ -22,7 +21,7 @@ export const ListFinetunedModelsResponse: core.serialization.ObjectSchema< export declare namespace ListFinetunedModelsResponse { interface Raw { - finetuned_models?: serializers.finetuning.FinetunedModel.Raw[] | null; + 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 index f83a8f9..481e688 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts @@ -5,27 +5,19 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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( - core.serialization.lazyObject( - async () => (await import("../../../../..")).finetuning.TrainingStepMetrics - ) - ) - .optional() - ), + 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?: serializers.finetuning.TrainingStepMetrics.Raw[] | null; + step_metrics?: TrainingStepMetrics.Raw[] | null; next_page_token?: string | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts b/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts index c69c18f..bc32404 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/Settings.ts @@ -5,27 +5,24 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; import * as core from "../../../../../../core"; +import { BaseModel } from "./BaseModel"; +import { Hyperparameters } from "./Hyperparameters"; export const Settings: core.serialization.ObjectSchema< serializers.finetuning.Settings.Raw, Cohere.finetuning.Settings > = core.serialization.object({ - baseModel: core.serialization.property( - "base_model", - core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.BaseModel) - ), + baseModel: core.serialization.property("base_model", BaseModel), datasetId: core.serialization.property("dataset_id", core.serialization.string()), - hyperparameters: core.serialization - .lazyObject(async () => (await import("../../../../..")).finetuning.Hyperparameters) - .optional(), + hyperparameters: Hyperparameters.optional(), multiLabel: core.serialization.property("multi_label", core.serialization.boolean().optional()), }); export declare namespace Settings { interface Raw { - base_model: serializers.finetuning.BaseModel.Raw; + base_model: BaseModel.Raw; dataset_id: string; - hyperparameters?: serializers.finetuning.Hyperparameters.Raw | null; + hyperparameters?: Hyperparameters.Raw | null; multi_label?: boolean | null; } } diff --git a/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts b/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts index da0aa66..e5b4289 100644 --- a/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts +++ b/src/serialization/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts @@ -5,19 +5,17 @@ import * as serializers from "../../../../.."; import * as Cohere from "../../../../../../api"; 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", - core.serialization.lazyObject(async () => (await import("../../../../..")).finetuning.FinetunedModel).optional() - ), + finetunedModel: core.serialization.property("finetuned_model", FinetunedModel.optional()), }); export declare namespace UpdateFinetunedModelResponse { interface Raw { - finetuned_model?: serializers.finetuning.FinetunedModel.Raw | null; + finetuned_model?: FinetunedModel.Raw | null; } } diff --git a/src/serialization/types/ApiMeta.ts b/src/serialization/types/ApiMeta.ts index eabcd01..3f808de 100644 --- a/src/serialization/types/ApiMeta.ts +++ b/src/serialization/types/ApiMeta.ts @@ -5,26 +5,23 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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", - core.serialization.lazyObject(async () => (await import("..")).ApiMetaApiVersion).optional() - ), - billedUnits: core.serialization.property( - "billed_units", - core.serialization.lazyObject(async () => (await import("..")).ApiMetaBilledUnits).optional() - ), - tokens: core.serialization.lazyObject(async () => (await import("..")).ApiMetaTokens).optional(), + 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?: serializers.ApiMetaApiVersion.Raw | null; - billed_units?: serializers.ApiMetaBilledUnits.Raw | null; - tokens?: serializers.ApiMetaTokens.Raw | null; + api_version?: ApiMetaApiVersion.Raw | null; + billed_units?: ApiMetaBilledUnits.Raw | null; + tokens?: ApiMetaTokens.Raw | null; warnings?: string[] | null; } } diff --git a/src/serialization/types/ChatCitationGenerationEvent.ts b/src/serialization/types/ChatCitationGenerationEvent.ts index 5a83e7c..b8e5331 100644 --- a/src/serialization/types/ChatCitationGenerationEvent.ts +++ b/src/serialization/types/ChatCitationGenerationEvent.ts @@ -5,20 +5,20 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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( - core.serialization.lazyObject(async () => (await import("..")).ChatCitation) - ), + citations: core.serialization.list(ChatCitation), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatCitationGenerationEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { - citations: serializers.ChatCitation.Raw[]; + interface Raw extends ChatStreamEvent.Raw { + citations: ChatCitation.Raw[]; } } diff --git a/src/serialization/types/ChatMessage.ts b/src/serialization/types/ChatMessage.ts index 517f135..4578337 100644 --- a/src/serialization/types/ChatMessage.ts +++ b/src/serialization/types/ChatMessage.ts @@ -5,16 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ChatMessageRole } from "./ChatMessageRole"; export const ChatMessage: core.serialization.ObjectSchema = core.serialization.object({ - role: core.serialization.lazy(async () => (await import("..")).ChatMessageRole), + role: ChatMessageRole, message: core.serialization.string(), }); export declare namespace ChatMessage { interface Raw { - role: serializers.ChatMessageRole.Raw; + role: ChatMessageRole.Raw; message: string; } } diff --git a/src/serialization/types/ChatRequestToolResultsItem.ts b/src/serialization/types/ChatRequestToolResultsItem.ts index 984ca99..57a2197 100644 --- a/src/serialization/types/ChatRequestToolResultsItem.ts +++ b/src/serialization/types/ChatRequestToolResultsItem.ts @@ -5,12 +5,13 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ToolCall } from "./ToolCall"; export const ChatRequestToolResultsItem: core.serialization.ObjectSchema< serializers.ChatRequestToolResultsItem.Raw, Cohere.ChatRequestToolResultsItem > = core.serialization.object({ - call: core.serialization.lazyObject(async () => (await import("..")).ToolCall), + call: ToolCall, outputs: core.serialization.list( core.serialization.record(core.serialization.string(), core.serialization.unknown()) ), @@ -18,7 +19,7 @@ export const ChatRequestToolResultsItem: core.serialization.ObjectSchema< export declare namespace ChatRequestToolResultsItem { interface Raw { - call: serializers.ToolCall.Raw; + call: ToolCall.Raw; outputs: Record[]; } } diff --git a/src/serialization/types/ChatSearchQueriesGenerationEvent.ts b/src/serialization/types/ChatSearchQueriesGenerationEvent.ts index 7eac14f..ac721dd 100644 --- a/src/serialization/types/ChatSearchQueriesGenerationEvent.ts +++ b/src/serialization/types/ChatSearchQueriesGenerationEvent.ts @@ -5,21 +5,20 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery)) - ), + searchQueries: core.serialization.property("search_queries", core.serialization.list(ChatSearchQuery)), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatSearchQueriesGenerationEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { - search_queries: serializers.ChatSearchQuery.Raw[]; + interface Raw extends ChatStreamEvent.Raw { + search_queries: ChatSearchQuery.Raw[]; } } diff --git a/src/serialization/types/ChatSearchResult.ts b/src/serialization/types/ChatSearchResult.ts index 8198b07..72947ca 100644 --- a/src/serialization/types/ChatSearchResult.ts +++ b/src/serialization/types/ChatSearchResult.ts @@ -5,16 +5,15 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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", - core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery).optional() - ), - connector: core.serialization.lazyObject(async () => (await import("..")).ChatSearchResultConnector), + 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()), @@ -22,8 +21,8 @@ export const ChatSearchResult: core.serialization.ObjectSchema< export declare namespace ChatSearchResult { interface Raw { - search_query?: serializers.ChatSearchQuery.Raw | null; - connector: serializers.ChatSearchResultConnector.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/ChatSearchResultsEvent.ts b/src/serialization/types/ChatSearchResultsEvent.ts index 4dedcf7..a74ab55 100644 --- a/src/serialization/types/ChatSearchResultsEvent.ts +++ b/src/serialization/types/ChatSearchResultsEvent.ts @@ -5,6 +5,9 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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, @@ -13,19 +16,15 @@ export const ChatSearchResultsEvent: core.serialization.ObjectSchema< .object({ searchResults: core.serialization.property( "search_results", - core.serialization - .list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchResult)) - .optional() + core.serialization.list(ChatSearchResult).optional() ), - documents: core.serialization - .list(core.serialization.lazy(async () => (await import("..")).ChatDocument)) - .optional(), + documents: core.serialization.list(ChatDocument).optional(), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatSearchResultsEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { - search_results?: serializers.ChatSearchResult.Raw[] | null; - documents?: serializers.ChatDocument.Raw[] | null; + 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 index 928970b..be6058d 100644 --- a/src/serialization/types/ChatStreamEndEvent.ts +++ b/src/serialization/types/ChatStreamEndEvent.ts @@ -5,23 +5,23 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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", - core.serialization.lazy(async () => (await import("..")).ChatStreamEndEventFinishReason) - ), - response: core.serialization.lazyObject(async () => (await import("..")).NonStreamedChatResponse), + finishReason: core.serialization.property("finish_reason", ChatStreamEndEventFinishReason), + response: NonStreamedChatResponse, }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatStreamEndEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { - finish_reason: serializers.ChatStreamEndEventFinishReason.Raw; - response: serializers.NonStreamedChatResponse.Raw; + interface Raw extends ChatStreamEvent.Raw { + finish_reason: ChatStreamEndEventFinishReason.Raw; + response: NonStreamedChatResponse.Raw; } } diff --git a/src/serialization/types/ChatStreamRequestToolResultsItem.ts b/src/serialization/types/ChatStreamRequestToolResultsItem.ts index 30daec6..821153c 100644 --- a/src/serialization/types/ChatStreamRequestToolResultsItem.ts +++ b/src/serialization/types/ChatStreamRequestToolResultsItem.ts @@ -5,12 +5,13 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ToolCall } from "./ToolCall"; export const ChatStreamRequestToolResultsItem: core.serialization.ObjectSchema< serializers.ChatStreamRequestToolResultsItem.Raw, Cohere.ChatStreamRequestToolResultsItem > = core.serialization.object({ - call: core.serialization.lazyObject(async () => (await import("..")).ToolCall), + call: ToolCall, outputs: core.serialization.list( core.serialization.record(core.serialization.string(), core.serialization.unknown()) ), @@ -18,7 +19,7 @@ export const ChatStreamRequestToolResultsItem: core.serialization.ObjectSchema< export declare namespace ChatStreamRequestToolResultsItem { interface Raw { - call: serializers.ToolCall.Raw; + call: ToolCall.Raw; outputs: Record[]; } } diff --git a/src/serialization/types/ChatStreamStartEvent.ts b/src/serialization/types/ChatStreamStartEvent.ts index 8aa1d70..c6f644c 100644 --- a/src/serialization/types/ChatStreamStartEvent.ts +++ b/src/serialization/types/ChatStreamStartEvent.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ChatStreamEvent } from "./ChatStreamEvent"; export const ChatStreamStartEvent: core.serialization.ObjectSchema< serializers.ChatStreamStartEvent.Raw, @@ -13,10 +14,10 @@ export const ChatStreamStartEvent: core.serialization.ObjectSchema< .object({ generationId: core.serialization.property("generation_id", core.serialization.string()), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatStreamStartEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { + interface Raw extends ChatStreamEvent.Raw { generation_id: string; } } diff --git a/src/serialization/types/ChatTextGenerationEvent.ts b/src/serialization/types/ChatTextGenerationEvent.ts index 2ec854a..f736063 100644 --- a/src/serialization/types/ChatTextGenerationEvent.ts +++ b/src/serialization/types/ChatTextGenerationEvent.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ChatStreamEvent } from "./ChatStreamEvent"; export const ChatTextGenerationEvent: core.serialization.ObjectSchema< serializers.ChatTextGenerationEvent.Raw, @@ -13,10 +14,10 @@ export const ChatTextGenerationEvent: core.serialization.ObjectSchema< .object({ text: core.serialization.string(), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatTextGenerationEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { + interface Raw extends ChatStreamEvent.Raw { text: string; } } diff --git a/src/serialization/types/ChatToolCallsGenerationEvent.ts b/src/serialization/types/ChatToolCallsGenerationEvent.ts index adfa53e..98b86de 100644 --- a/src/serialization/types/ChatToolCallsGenerationEvent.ts +++ b/src/serialization/types/ChatToolCallsGenerationEvent.ts @@ -5,21 +5,20 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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({ - toolCalls: core.serialization.property( - "tool_calls", - core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ToolCall)) - ), + toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall)), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + .extend(ChatStreamEvent); export declare namespace ChatToolCallsGenerationEvent { - interface Raw extends serializers.ChatStreamEvent.Raw { - tool_calls: serializers.ToolCall.Raw[]; + interface Raw extends ChatStreamEvent.Raw { + tool_calls: ToolCall.Raw[]; } } diff --git a/src/serialization/types/ClassifyDataMetrics.ts b/src/serialization/types/ClassifyDataMetrics.ts index 335849f..667bd66 100644 --- a/src/serialization/types/ClassifyDataMetrics.ts +++ b/src/serialization/types/ClassifyDataMetrics.ts @@ -5,19 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazyObject(async () => (await import("..")).LabelMetric)).optional() - ), + labelMetrics: core.serialization.property("label_metrics", core.serialization.list(LabelMetric).optional()), }); export declare namespace ClassifyDataMetrics { interface Raw { - label_metrics?: serializers.LabelMetric.Raw[] | null; + label_metrics?: LabelMetric.Raw[] | null; } } diff --git a/src/serialization/types/ClassifyResponse.ts b/src/serialization/types/ClassifyResponse.ts index cd752a9..04701ee 100644 --- a/src/serialization/types/ClassifyResponse.ts +++ b/src/serialization/types/ClassifyResponse.ts @@ -5,22 +5,22 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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( - core.serialization.lazyObject(async () => (await import("..")).ClassifyResponseClassificationsItem) - ), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + classifications: core.serialization.list(ClassifyResponseClassificationsItem), + meta: ApiMeta.optional(), }); export declare namespace ClassifyResponse { interface Raw { id: string; - classifications: serializers.ClassifyResponseClassificationsItem.Raw[]; - meta?: serializers.ApiMeta.Raw | null; + classifications: ClassifyResponseClassificationsItem.Raw[]; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/ClassifyResponseClassificationsItem.ts b/src/serialization/types/ClassifyResponseClassificationsItem.ts index b78fd25..a0af433 100644 --- a/src/serialization/types/ClassifyResponseClassificationsItem.ts +++ b/src/serialization/types/ClassifyResponseClassificationsItem.ts @@ -5,6 +5,8 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ClassifyResponseClassificationsItemLabelsValue } from "./ClassifyResponseClassificationsItemLabelsValue"; +import { ClassifyResponseClassificationsItemClassificationType } from "./ClassifyResponseClassificationsItemClassificationType"; export const ClassifyResponseClassificationsItem: core.serialization.ObjectSchema< serializers.ClassifyResponseClassificationsItem.Raw, @@ -16,13 +18,10 @@ export const ClassifyResponseClassificationsItem: core.serialization.ObjectSchem 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(), - core.serialization.lazyObject(async () => (await import("..")).ClassifyResponseClassificationsItemLabelsValue) - ), + labels: core.serialization.record(core.serialization.string(), ClassifyResponseClassificationsItemLabelsValue), classificationType: core.serialization.property( "classification_type", - core.serialization.lazy(async () => (await import("..")).ClassifyResponseClassificationsItemClassificationType) + ClassifyResponseClassificationsItemClassificationType ), }); @@ -34,7 +33,7 @@ export declare namespace ClassifyResponseClassificationsItem { predictions: string[]; confidence?: number | null; confidences: number[]; - labels: Record; - classification_type: serializers.ClassifyResponseClassificationsItemClassificationType.Raw; + labels: Record; + classification_type: ClassifyResponseClassificationsItemClassificationType.Raw; } } diff --git a/src/serialization/types/Connector.ts b/src/serialization/types/Connector.ts index 14c2478..4ea5fa1 100644 --- a/src/serialization/types/Connector.ts +++ b/src/serialization/types/Connector.ts @@ -5,6 +5,8 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ConnectorOAuth } from "./ConnectorOAuth"; +import { ConnectorAuthStatus } from "./ConnectorAuthStatus"; export const Connector: core.serialization.ObjectSchema = core.serialization.object({ @@ -17,11 +19,8 @@ export const Connector: core.serialization.ObjectSchema (await import("..")).ConnectorOAuth).optional(), - authStatus: core.serialization.property( - "auth_status", - core.serialization.lazy(async () => (await import("..")).ConnectorAuthStatus).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()), }); @@ -37,8 +36,8 @@ export declare namespace Connector { updated_at: string; excludes?: string[] | null; auth_type?: string | null; - oauth?: serializers.ConnectorOAuth.Raw | null; - auth_status?: serializers.ConnectorAuthStatus.Raw | null; + oauth?: ConnectorOAuth.Raw | null; + auth_status?: ConnectorAuthStatus.Raw | null; active?: boolean | null; continue_on_failure?: boolean | null; } diff --git a/src/serialization/types/CreateConnectorResponse.ts b/src/serialization/types/CreateConnectorResponse.ts index fddc464..c874bf1 100644 --- a/src/serialization/types/CreateConnectorResponse.ts +++ b/src/serialization/types/CreateConnectorResponse.ts @@ -5,16 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { Connector } from "./Connector"; export const CreateConnectorResponse: core.serialization.ObjectSchema< serializers.CreateConnectorResponse.Raw, Cohere.CreateConnectorResponse > = core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), + connector: Connector, }); export declare namespace CreateConnectorResponse { interface Raw { - connector: serializers.Connector.Raw; + connector: Connector.Raw; } } diff --git a/src/serialization/types/CreateConnectorServiceAuth.ts b/src/serialization/types/CreateConnectorServiceAuth.ts index 43da623..e9b9cf3 100644 --- a/src/serialization/types/CreateConnectorServiceAuth.ts +++ b/src/serialization/types/CreateConnectorServiceAuth.ts @@ -5,18 +5,19 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { AuthTokenType } from "./AuthTokenType"; export const CreateConnectorServiceAuth: core.serialization.ObjectSchema< serializers.CreateConnectorServiceAuth.Raw, Cohere.CreateConnectorServiceAuth > = core.serialization.object({ - type: core.serialization.lazy(async () => (await import("..")).AuthTokenType), + type: AuthTokenType, token: core.serialization.string(), }); export declare namespace CreateConnectorServiceAuth { interface Raw { - type: serializers.AuthTokenType.Raw; + type: AuthTokenType.Raw; token: string; } } diff --git a/src/serialization/types/CreateEmbedJobResponse.ts b/src/serialization/types/CreateEmbedJobResponse.ts index 0096281..3d5ded8 100644 --- a/src/serialization/types/CreateEmbedJobResponse.ts +++ b/src/serialization/types/CreateEmbedJobResponse.ts @@ -5,18 +5,19 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace CreateEmbedJobResponse { interface Raw { job_id: string; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/Dataset.ts b/src/serialization/types/Dataset.ts index 1e64824..f5bfe7a 100644 --- a/src/serialization/types/Dataset.ts +++ b/src/serialization/types/Dataset.ts @@ -5,6 +5,9 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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({ @@ -12,14 +15,8 @@ export const Dataset: core.serialization.ObjectSchema (await import("..")).DatasetType) - ), - validationStatus: core.serialization.property( - "validation_status", - core.serialization.lazy(async () => (await import("..")).DatasetValidationStatus) - ), + 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( @@ -30,12 +27,7 @@ export const Dataset: core.serialization.ObjectSchema (await import("..")).DatasetPart)) - .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() @@ -48,13 +40,13 @@ export declare namespace Dataset { name: string; created_at: string; updated_at: string; - dataset_type: serializers.DatasetType.Raw; - validation_status: serializers.DatasetValidationStatus.Raw; + 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?: serializers.DatasetPart.Raw[] | null; + dataset_parts?: DatasetPart.Raw[] | null; validation_warnings?: string[] | null; } } diff --git a/src/serialization/types/DetokenizeResponse.ts b/src/serialization/types/DetokenizeResponse.ts index 0aaebc4..1211162 100644 --- a/src/serialization/types/DetokenizeResponse.ts +++ b/src/serialization/types/DetokenizeResponse.ts @@ -5,18 +5,19 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace DetokenizeResponse { interface Raw { text: string; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/EmbedByTypeResponse.ts b/src/serialization/types/EmbedByTypeResponse.ts index f2c119d..6676103 100644 --- a/src/serialization/types/EmbedByTypeResponse.ts +++ b/src/serialization/types/EmbedByTypeResponse.ts @@ -5,22 +5,24 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { EmbedByTypeResponseEmbeddings } from "./EmbedByTypeResponseEmbeddings"; +import { ApiMeta } from "./ApiMeta"; export const EmbedByTypeResponse: core.serialization.ObjectSchema< serializers.EmbedByTypeResponse.Raw, Cohere.EmbedByTypeResponse > = core.serialization.object({ id: core.serialization.string(), - embeddings: core.serialization.lazyObject(async () => (await import("..")).EmbedByTypeResponseEmbeddings), + embeddings: EmbedByTypeResponseEmbeddings, texts: core.serialization.list(core.serialization.string()), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace EmbedByTypeResponse { interface Raw { id: string; - embeddings: serializers.EmbedByTypeResponseEmbeddings.Raw; + embeddings: EmbedByTypeResponseEmbeddings.Raw; texts: string[]; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/EmbedFloatsResponse.ts b/src/serialization/types/EmbedFloatsResponse.ts index 19603e3..d33c7d6 100644 --- a/src/serialization/types/EmbedFloatsResponse.ts +++ b/src/serialization/types/EmbedFloatsResponse.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ApiMeta } from "./ApiMeta"; export const EmbedFloatsResponse: core.serialization.ObjectSchema< serializers.EmbedFloatsResponse.Raw, @@ -13,7 +14,7 @@ export const EmbedFloatsResponse: core.serialization.ObjectSchema< id: core.serialization.string(), embeddings: core.serialization.list(core.serialization.list(core.serialization.number())), texts: core.serialization.list(core.serialization.string()), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace EmbedFloatsResponse { @@ -21,6 +22,6 @@ export declare namespace EmbedFloatsResponse { id: string; embeddings: number[][]; texts: string[]; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/EmbedJob.ts b/src/serialization/types/EmbedJob.ts index 6ec569f..73f8df6 100644 --- a/src/serialization/types/EmbedJob.ts +++ b/src/serialization/types/EmbedJob.ts @@ -5,30 +5,33 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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: core.serialization.lazy(async () => (await import("..")).EmbedJobStatus), + 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: core.serialization.lazy(async () => (await import("..")).EmbedJobTruncate), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + truncate: EmbedJobTruncate, + meta: ApiMeta.optional(), }); export declare namespace EmbedJob { interface Raw { job_id: string; name?: string | null; - status: serializers.EmbedJobStatus.Raw; + status: EmbedJobStatus.Raw; created_at: string; input_dataset_id: string; output_dataset_id?: string | null; model: string; - truncate: serializers.EmbedJobTruncate.Raw; - meta?: serializers.ApiMeta.Raw | null; + truncate: EmbedJobTruncate.Raw; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/EmbedResponse.ts b/src/serialization/types/EmbedResponse.ts index ad932b9..cc9d522 100644 --- a/src/serialization/types/EmbedResponse.ts +++ b/src/serialization/types/EmbedResponse.ts @@ -5,12 +5,14 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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: core.serialization.lazyObject(async () => (await import("..")).EmbedFloatsResponse), - embeddings_by_type: core.serialization.lazyObject(async () => (await import("..")).EmbedByTypeResponse), + embeddings_floats: EmbedFloatsResponse, + embeddings_by_type: EmbedByTypeResponse, }) .transform({ transform: (value) => value, @@ -20,11 +22,11 @@ export const EmbedResponse: core.serialization.Schema = core.serialization .object({ isFinished: core.serialization.property("is_finished", core.serialization.boolean()), - finishReason: core.serialization.property( - "finish_reason", - core.serialization.lazy(async () => (await import("..")).FinishReason).optional() - ), - response: core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEndResponse), + finishReason: core.serialization.property("finish_reason", FinishReason.optional()), + response: GenerateStreamEndResponse, }) - .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + .extend(GenerateStreamEvent); export declare namespace GenerateStreamEnd { - interface Raw extends serializers.GenerateStreamEvent.Raw { + interface Raw extends GenerateStreamEvent.Raw { is_finished: boolean; - finish_reason?: serializers.FinishReason.Raw | null; - response: serializers.GenerateStreamEndResponse.Raw; + finish_reason?: FinishReason.Raw | null; + response: GenerateStreamEndResponse.Raw; } } diff --git a/src/serialization/types/GenerateStreamEndResponse.ts b/src/serialization/types/GenerateStreamEndResponse.ts index 0cf2149..847eed3 100644 --- a/src/serialization/types/GenerateStreamEndResponse.ts +++ b/src/serialization/types/GenerateStreamEndResponse.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { SingleGenerationInStream } from "./SingleGenerationInStream"; export const GenerateStreamEndResponse: core.serialization.ObjectSchema< serializers.GenerateStreamEndResponse.Raw, @@ -12,15 +13,13 @@ export const GenerateStreamEndResponse: core.serialization.ObjectSchema< > = core.serialization.object({ id: core.serialization.string(), prompt: core.serialization.string().optional(), - generations: core.serialization - .list(core.serialization.lazyObject(async () => (await import("..")).SingleGenerationInStream)) - .optional(), + generations: core.serialization.list(SingleGenerationInStream).optional(), }); export declare namespace GenerateStreamEndResponse { interface Raw { id: string; prompt?: string | null; - generations?: serializers.SingleGenerationInStream.Raw[] | null; + generations?: SingleGenerationInStream.Raw[] | null; } } diff --git a/src/serialization/types/GenerateStreamError.ts b/src/serialization/types/GenerateStreamError.ts index bd01a65..00c2ea4 100644 --- a/src/serialization/types/GenerateStreamError.ts +++ b/src/serialization/types/GenerateStreamError.ts @@ -5,6 +5,8 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { FinishReason } from "./FinishReason"; +import { GenerateStreamEvent } from "./GenerateStreamEvent"; export const GenerateStreamError: core.serialization.ObjectSchema< serializers.GenerateStreamError.Raw, @@ -13,19 +15,16 @@ export const GenerateStreamError: core.serialization.ObjectSchema< .object({ index: core.serialization.number().optional(), isFinished: core.serialization.property("is_finished", core.serialization.boolean()), - finishReason: core.serialization.property( - "finish_reason", - core.serialization.lazy(async () => (await import("..")).FinishReason) - ), + finishReason: core.serialization.property("finish_reason", FinishReason), err: core.serialization.string(), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + .extend(GenerateStreamEvent); export declare namespace GenerateStreamError { - interface Raw extends serializers.GenerateStreamEvent.Raw { + interface Raw extends GenerateStreamEvent.Raw { index?: number | null; is_finished: boolean; - finish_reason: serializers.FinishReason.Raw; + finish_reason: FinishReason.Raw; err: string; } } diff --git a/src/serialization/types/GenerateStreamText.ts b/src/serialization/types/GenerateStreamText.ts index 52b47ea..a99e55e 100644 --- a/src/serialization/types/GenerateStreamText.ts +++ b/src/serialization/types/GenerateStreamText.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { GenerateStreamEvent } from "./GenerateStreamEvent"; export const GenerateStreamText: core.serialization.ObjectSchema< serializers.GenerateStreamText.Raw, @@ -15,10 +16,10 @@ export const GenerateStreamText: core.serialization.ObjectSchema< index: core.serialization.number().optional(), isFinished: core.serialization.property("is_finished", core.serialization.boolean()), }) - .extend(core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEvent)); + .extend(GenerateStreamEvent); export declare namespace GenerateStreamText { - interface Raw extends serializers.GenerateStreamEvent.Raw { + 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 index 67b9e96..6742d6c 100644 --- a/src/serialization/types/GenerateStreamedResponse.ts +++ b/src/serialization/types/GenerateStreamedResponse.ts @@ -5,15 +5,18 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamText), - "stream-end": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamEnd), - "stream-error": core.serialization.lazyObject(async () => (await import("..")).GenerateStreamError), + "text-generation": GenerateStreamText, + "stream-end": GenerateStreamEnd, + "stream-error": GenerateStreamError, }) .transform({ transform: (value) => value, @@ -26,15 +29,15 @@ export declare namespace GenerateStreamedResponse { | GenerateStreamedResponse.StreamEnd | GenerateStreamedResponse.StreamError; - interface TextGeneration extends serializers.GenerateStreamText.Raw { + interface TextGeneration extends GenerateStreamText.Raw { event_type: "text-generation"; } - interface StreamEnd extends serializers.GenerateStreamEnd.Raw { + interface StreamEnd extends GenerateStreamEnd.Raw { event_type: "stream-end"; } - interface StreamError extends serializers.GenerateStreamError.Raw { + interface StreamError extends GenerateStreamError.Raw { event_type: "stream-error"; } } diff --git a/src/serialization/types/Generation.ts b/src/serialization/types/Generation.ts index 37ca7bf..1ad1832 100644 --- a/src/serialization/types/Generation.ts +++ b/src/serialization/types/Generation.ts @@ -5,22 +5,22 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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( - core.serialization.lazyObject(async () => (await import("..")).SingleGeneration) - ), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + generations: core.serialization.list(SingleGeneration), + meta: ApiMeta.optional(), }); export declare namespace Generation { interface Raw { id: string; prompt?: string | null; - generations: serializers.SingleGeneration.Raw[]; - meta?: serializers.ApiMeta.Raw | null; + generations: SingleGeneration.Raw[]; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/GetConnectorResponse.ts b/src/serialization/types/GetConnectorResponse.ts index d098e9f..d9e52d8 100644 --- a/src/serialization/types/GetConnectorResponse.ts +++ b/src/serialization/types/GetConnectorResponse.ts @@ -5,16 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { Connector } from "./Connector"; export const GetConnectorResponse: core.serialization.ObjectSchema< serializers.GetConnectorResponse.Raw, Cohere.GetConnectorResponse > = core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), + connector: Connector, }); export declare namespace GetConnectorResponse { interface Raw { - connector: serializers.Connector.Raw; + connector: Connector.Raw; } } diff --git a/src/serialization/types/GetModelResponse.ts b/src/serialization/types/GetModelResponse.ts index 1ceae18..c63bd6d 100644 --- a/src/serialization/types/GetModelResponse.ts +++ b/src/serialization/types/GetModelResponse.ts @@ -5,26 +5,30 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazy(async () => (await import("..")).CompatibleEndpoint)) - .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()), + defaultEndpoints: core.serialization.property( + "default_endpoints", + core.serialization.list(CompatibleEndpoint).optional() + ), }); export declare namespace GetModelResponse { interface Raw { name?: string | null; - endpoints?: serializers.CompatibleEndpoint.Raw[] | null; + endpoints?: CompatibleEndpoint.Raw[] | null; finetuned?: boolean | null; context_length?: number | null; tokenizer_url?: string | null; + default_endpoints?: CompatibleEndpoint.Raw[] | null; } } diff --git a/src/serialization/types/ListConnectorsResponse.ts b/src/serialization/types/ListConnectorsResponse.ts index 007fa39..d4ca327 100644 --- a/src/serialization/types/ListConnectorsResponse.ts +++ b/src/serialization/types/ListConnectorsResponse.ts @@ -5,18 +5,19 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazyObject(async () => (await import("..")).Connector)), + connectors: core.serialization.list(Connector), totalCount: core.serialization.property("total_count", core.serialization.number().optional()), }); export declare namespace ListConnectorsResponse { interface Raw { - connectors: serializers.Connector.Raw[]; + connectors: Connector.Raw[]; total_count?: number | null; } } diff --git a/src/serialization/types/ListEmbedJobResponse.ts b/src/serialization/types/ListEmbedJobResponse.ts index 915fe8c..bb4a57e 100644 --- a/src/serialization/types/ListEmbedJobResponse.ts +++ b/src/serialization/types/ListEmbedJobResponse.ts @@ -5,19 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazyObject(async () => (await import("..")).EmbedJob)).optional() - ), + embedJobs: core.serialization.property("embed_jobs", core.serialization.list(EmbedJob).optional()), }); export declare namespace ListEmbedJobResponse { interface Raw { - embed_jobs?: serializers.EmbedJob.Raw[] | null; + embed_jobs?: EmbedJob.Raw[] | null; } } diff --git a/src/serialization/types/ListModelsResponse.ts b/src/serialization/types/ListModelsResponse.ts index 2473ade..2455d0f 100644 --- a/src/serialization/types/ListModelsResponse.ts +++ b/src/serialization/types/ListModelsResponse.ts @@ -5,18 +5,19 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(core.serialization.lazyObject(async () => (await import("..")).GetModelResponse)), + models: core.serialization.list(GetModelResponse), nextPageToken: core.serialization.property("next_page_token", core.serialization.string().optional()), }); export declare namespace ListModelsResponse { interface Raw { - models: serializers.GetModelResponse.Raw[]; + models: GetModelResponse.Raw[]; next_page_token?: string | null; } } diff --git a/src/serialization/types/Metrics.ts b/src/serialization/types/Metrics.ts index a849715..30bb737 100644 --- a/src/serialization/types/Metrics.ts +++ b/src/serialization/types/Metrics.ts @@ -5,17 +5,18 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { FinetuneDatasetMetrics } from "./FinetuneDatasetMetrics"; export const Metrics: core.serialization.ObjectSchema = core.serialization.object({ finetuneDatasetMetrics: core.serialization.property( "finetune_dataset_metrics", - core.serialization.lazyObject(async () => (await import("..")).FinetuneDatasetMetrics).optional() + FinetuneDatasetMetrics.optional() ), }); export declare namespace Metrics { interface Raw { - finetune_dataset_metrics?: serializers.FinetuneDatasetMetrics.Raw | null; + finetune_dataset_metrics?: FinetuneDatasetMetrics.Raw | null; } } diff --git a/src/serialization/types/NonStreamedChatResponse.ts b/src/serialization/types/NonStreamedChatResponse.ts index ae72faa..ddfecc8 100644 --- a/src/serialization/types/NonStreamedChatResponse.ts +++ b/src/serialization/types/NonStreamedChatResponse.ts @@ -5,6 +5,14 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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 { ChatMessage } from "./ChatMessage"; +import { ApiMeta } from "./ApiMeta"; export const NonStreamedChatResponse: core.serialization.ObjectSchema< serializers.NonStreamedChatResponse.Raw, @@ -12,52 +20,29 @@ export const NonStreamedChatResponse: core.serialization.ObjectSchema< > = core.serialization.object({ text: core.serialization.string(), generationId: core.serialization.property("generation_id", core.serialization.string().optional()), - citations: core.serialization - .list(core.serialization.lazyObject(async () => (await import("..")).ChatCitation)) - .optional(), - documents: core.serialization - .list(core.serialization.lazy(async () => (await import("..")).ChatDocument)) - .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(core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery)) - .optional() - ), - searchResults: core.serialization.property( - "search_results", - core.serialization - .list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchResult)) - .optional() - ), - finishReason: core.serialization.property( - "finish_reason", - core.serialization.lazy(async () => (await import("..")).FinishReason).optional() - ), - toolCalls: core.serialization.property( - "tool_calls", - core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ToolCall)).optional() - ), - chatHistory: core.serialization.property( - "chat_history", - core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ChatMessage)).optional() - ), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).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(ChatMessage).optional()), + meta: ApiMeta.optional(), }); export declare namespace NonStreamedChatResponse { interface Raw { text: string; generation_id?: string | null; - citations?: serializers.ChatCitation.Raw[] | null; - documents?: serializers.ChatDocument.Raw[] | null; + citations?: ChatCitation.Raw[] | null; + documents?: ChatDocument.Raw[] | null; is_search_required?: boolean | null; - search_queries?: serializers.ChatSearchQuery.Raw[] | null; - search_results?: serializers.ChatSearchResult.Raw[] | null; - finish_reason?: serializers.FinishReason.Raw | null; - tool_calls?: serializers.ToolCall.Raw[] | null; - chat_history?: serializers.ChatMessage.Raw[] | null; - meta?: serializers.ApiMeta.Raw | null; + search_queries?: ChatSearchQuery.Raw[] | null; + search_results?: ChatSearchResult.Raw[] | null; + finish_reason?: FinishReason.Raw | null; + tool_calls?: ToolCall.Raw[] | null; + chat_history?: ChatMessage.Raw[] | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/RerankRequestDocumentsItem.ts b/src/serialization/types/RerankRequestDocumentsItem.ts index 8b10bc3..0f40936 100644 --- a/src/serialization/types/RerankRequestDocumentsItem.ts +++ b/src/serialization/types/RerankRequestDocumentsItem.ts @@ -5,15 +5,13 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { RerankRequestDocumentsItemText } from "./RerankRequestDocumentsItemText"; export const RerankRequestDocumentsItem: core.serialization.Schema< serializers.RerankRequestDocumentsItem.Raw, Cohere.RerankRequestDocumentsItem -> = core.serialization.undiscriminatedUnion([ - core.serialization.string(), - core.serialization.lazyObject(async () => (await import("..")).RerankRequestDocumentsItemText), -]); +> = core.serialization.undiscriminatedUnion([core.serialization.string(), RerankRequestDocumentsItemText]); export declare namespace RerankRequestDocumentsItem { - type Raw = string | serializers.RerankRequestDocumentsItemText.Raw; + type Raw = string | RerankRequestDocumentsItemText.Raw; } diff --git a/src/serialization/types/RerankResponse.ts b/src/serialization/types/RerankResponse.ts index b07c30e..105c46a 100644 --- a/src/serialization/types/RerankResponse.ts +++ b/src/serialization/types/RerankResponse.ts @@ -5,20 +5,20 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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( - core.serialization.lazyObject(async () => (await import("..")).RerankResponseResultsItem) - ), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + results: core.serialization.list(RerankResponseResultsItem), + meta: ApiMeta.optional(), }); export declare namespace RerankResponse { interface Raw { id?: string | null; - results: serializers.RerankResponseResultsItem.Raw[]; - meta?: serializers.ApiMeta.Raw | null; + results: RerankResponseResultsItem.Raw[]; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/RerankResponseResultsItem.ts b/src/serialization/types/RerankResponseResultsItem.ts index 9a3a25c..95a099c 100644 --- a/src/serialization/types/RerankResponseResultsItem.ts +++ b/src/serialization/types/RerankResponseResultsItem.ts @@ -5,21 +5,20 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { RerankResponseResultsItemDocument } from "./RerankResponseResultsItemDocument"; export const RerankResponseResultsItem: core.serialization.ObjectSchema< serializers.RerankResponseResultsItem.Raw, Cohere.RerankResponseResultsItem > = core.serialization.object({ - document: core.serialization - .lazyObject(async () => (await import("..")).RerankResponseResultsItemDocument) - .optional(), + document: RerankResponseResultsItemDocument.optional(), index: core.serialization.number(), relevanceScore: core.serialization.property("relevance_score", core.serialization.number()), }); export declare namespace RerankResponseResultsItem { interface Raw { - document?: serializers.RerankResponseResultsItemDocument.Raw | null; + document?: RerankResponseResultsItemDocument.Raw | null; index: number; relevance_score: number; } diff --git a/src/serialization/types/SingleGeneration.ts b/src/serialization/types/SingleGeneration.ts index 5d56e62..4d38ff5 100644 --- a/src/serialization/types/SingleGeneration.ts +++ b/src/serialization/types/SingleGeneration.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { SingleGenerationTokenLikelihoodsItem } from "./SingleGenerationTokenLikelihoodsItem"; export const SingleGeneration: core.serialization.ObjectSchema< serializers.SingleGeneration.Raw, @@ -16,9 +17,7 @@ export const SingleGeneration: core.serialization.ObjectSchema< likelihood: core.serialization.number().optional(), tokenLikelihoods: core.serialization.property( "token_likelihoods", - core.serialization - .list(core.serialization.lazyObject(async () => (await import("..")).SingleGenerationTokenLikelihoodsItem)) - .optional() + core.serialization.list(SingleGenerationTokenLikelihoodsItem).optional() ), }); @@ -28,6 +27,6 @@ export declare namespace SingleGeneration { text: string; index?: number | null; likelihood?: number | null; - token_likelihoods?: serializers.SingleGenerationTokenLikelihoodsItem.Raw[] | null; + token_likelihoods?: SingleGenerationTokenLikelihoodsItem.Raw[] | null; } } diff --git a/src/serialization/types/SingleGenerationInStream.ts b/src/serialization/types/SingleGenerationInStream.ts index 409c965..174da60 100644 --- a/src/serialization/types/SingleGenerationInStream.ts +++ b/src/serialization/types/SingleGenerationInStream.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { FinishReason } from "./FinishReason"; export const SingleGenerationInStream: core.serialization.ObjectSchema< serializers.SingleGenerationInStream.Raw, @@ -13,10 +14,7 @@ export const SingleGenerationInStream: core.serialization.ObjectSchema< id: core.serialization.string(), text: core.serialization.string(), index: core.serialization.number().optional(), - finishReason: core.serialization.property( - "finish_reason", - core.serialization.lazy(async () => (await import("..")).FinishReason) - ), + finishReason: core.serialization.property("finish_reason", FinishReason), }); export declare namespace SingleGenerationInStream { @@ -24,6 +22,6 @@ export declare namespace SingleGenerationInStream { id: string; text: string; index?: number | null; - finish_reason: serializers.FinishReason.Raw; + finish_reason: FinishReason.Raw; } } diff --git a/src/serialization/types/StreamedChatResponse.ts b/src/serialization/types/StreamedChatResponse.ts index 9ca843b..3c549ba 100644 --- a/src/serialization/types/StreamedChatResponse.ts +++ b/src/serialization/types/StreamedChatResponse.ts @@ -5,25 +5,26 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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"; export const StreamedChatResponse: core.serialization.Schema< serializers.StreamedChatResponse.Raw, Cohere.StreamedChatResponse > = core.serialization .union(core.serialization.discriminant("eventType", "event_type"), { - "stream-start": core.serialization.lazyObject(async () => (await import("..")).ChatStreamStartEvent), - "search-queries-generation": core.serialization.lazyObject( - async () => (await import("..")).ChatSearchQueriesGenerationEvent - ), - "search-results": core.serialization.lazyObject(async () => (await import("..")).ChatSearchResultsEvent), - "text-generation": core.serialization.lazyObject(async () => (await import("..")).ChatTextGenerationEvent), - "citation-generation": core.serialization.lazyObject( - async () => (await import("..")).ChatCitationGenerationEvent - ), - "tool-calls-generation": core.serialization.lazyObject( - async () => (await import("..")).ChatToolCallsGenerationEvent - ), - "stream-end": core.serialization.lazyObject(async () => (await import("..")).ChatStreamEndEvent), + "stream-start": ChatStreamStartEvent, + "search-queries-generation": ChatSearchQueriesGenerationEvent, + "search-results": ChatSearchResultsEvent, + "text-generation": ChatTextGenerationEvent, + "citation-generation": ChatCitationGenerationEvent, + "tool-calls-generation": ChatToolCallsGenerationEvent, + "stream-end": ChatStreamEndEvent, }) .transform({ transform: (value) => value, @@ -40,31 +41,31 @@ export declare namespace StreamedChatResponse { | StreamedChatResponse.ToolCallsGeneration | StreamedChatResponse.StreamEnd; - interface StreamStart extends serializers.ChatStreamStartEvent.Raw { + interface StreamStart extends ChatStreamStartEvent.Raw { event_type: "stream-start"; } - interface SearchQueriesGeneration extends serializers.ChatSearchQueriesGenerationEvent.Raw { + interface SearchQueriesGeneration extends ChatSearchQueriesGenerationEvent.Raw { event_type: "search-queries-generation"; } - interface SearchResults extends serializers.ChatSearchResultsEvent.Raw { + interface SearchResults extends ChatSearchResultsEvent.Raw { event_type: "search-results"; } - interface TextGeneration extends serializers.ChatTextGenerationEvent.Raw { + interface TextGeneration extends ChatTextGenerationEvent.Raw { event_type: "text-generation"; } - interface CitationGeneration extends serializers.ChatCitationGenerationEvent.Raw { + interface CitationGeneration extends ChatCitationGenerationEvent.Raw { event_type: "citation-generation"; } - interface ToolCallsGeneration extends serializers.ChatToolCallsGenerationEvent.Raw { + interface ToolCallsGeneration extends ChatToolCallsGenerationEvent.Raw { event_type: "tool-calls-generation"; } - interface StreamEnd extends serializers.ChatStreamEndEvent.Raw { + interface StreamEnd extends ChatStreamEndEvent.Raw { event_type: "stream-end"; } } diff --git a/src/serialization/types/SummarizeResponse.ts b/src/serialization/types/SummarizeResponse.ts index f1882cf..ba4a27a 100644 --- a/src/serialization/types/SummarizeResponse.ts +++ b/src/serialization/types/SummarizeResponse.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ApiMeta } from "./ApiMeta"; export const SummarizeResponse: core.serialization.ObjectSchema< serializers.SummarizeResponse.Raw, @@ -12,13 +13,13 @@ export const SummarizeResponse: core.serialization.ObjectSchema< > = core.serialization.object({ id: core.serialization.string().optional(), summary: core.serialization.string().optional(), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace SummarizeResponse { interface Raw { id?: string | null; summary?: string | null; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/TokenizeResponse.ts b/src/serialization/types/TokenizeResponse.ts index b9b8486..a4b03d3 100644 --- a/src/serialization/types/TokenizeResponse.ts +++ b/src/serialization/types/TokenizeResponse.ts @@ -5,6 +5,7 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { ApiMeta } from "./ApiMeta"; export const TokenizeResponse: core.serialization.ObjectSchema< serializers.TokenizeResponse.Raw, @@ -12,13 +13,13 @@ export const TokenizeResponse: core.serialization.ObjectSchema< > = core.serialization.object({ tokens: core.serialization.list(core.serialization.number()), tokenStrings: core.serialization.property("token_strings", core.serialization.list(core.serialization.string())), - meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + meta: ApiMeta.optional(), }); export declare namespace TokenizeResponse { interface Raw { tokens: number[]; token_strings: string[]; - meta?: serializers.ApiMeta.Raw | null; + meta?: ApiMeta.Raw | null; } } diff --git a/src/serialization/types/Tool.ts b/src/serialization/types/Tool.ts index b140efb..35ed88b 100644 --- a/src/serialization/types/Tool.ts +++ b/src/serialization/types/Tool.ts @@ -5,18 +5,14 @@ import * as serializers from ".."; import * as Cohere from "../../api"; 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(), - core.serialization.lazyObject(async () => (await import("..")).ToolParameterDefinitionsValue) - ) - .optional() + core.serialization.record(core.serialization.string(), ToolParameterDefinitionsValue).optional() ), }); @@ -24,6 +20,6 @@ export declare namespace Tool { interface Raw { name: string; description: string; - parameter_definitions?: Record | null; + parameter_definitions?: Record | null; } } diff --git a/src/serialization/types/UpdateConnectorResponse.ts b/src/serialization/types/UpdateConnectorResponse.ts index c436baf..6a87d51 100644 --- a/src/serialization/types/UpdateConnectorResponse.ts +++ b/src/serialization/types/UpdateConnectorResponse.ts @@ -5,16 +5,17 @@ import * as serializers from ".."; import * as Cohere from "../../api"; import * as core from "../../core"; +import { Connector } from "./Connector"; export const UpdateConnectorResponse: core.serialization.ObjectSchema< serializers.UpdateConnectorResponse.Raw, Cohere.UpdateConnectorResponse > = core.serialization.object({ - connector: core.serialization.lazyObject(async () => (await import("..")).Connector), + connector: Connector, }); export declare namespace UpdateConnectorResponse { interface Raw { - connector: serializers.Connector.Raw; + connector: Connector.Raw; } } diff --git a/tests/client.test.ts b/tests/client.test.ts deleted file mode 100644 index 62b373b..0000000 --- a/tests/client.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** -* This is a test file for the SDK. -* -* Add any tests here and make sure to mark this file -* in `.fernignore`. -*/ -describe("test", () => { - it("default", () => { - expect(true).toBe(true); - }); -}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 5a306b2..538c94f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,8 +12,6 @@ "rootDir": "src", "baseUrl": "src" }, - "include": [ - "src" - ], + "include": ["src"], "exclude": [] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 4769260..731fab4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -616,14 +616,6 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.5": - version "29.5.12" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.12.tgz#7f7dc6eb4cf246d2474ed78744b05d06ce025544" - integrity sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - "@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" @@ -858,9 +850,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001587: - version "1.0.30001608" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001608.tgz#7ae6e92ffb300e4b4ec2f795e0abab456ec06cc0" - integrity sha512-cjUJTQkk9fQlJR2s4HMuPMvTiRggl0rAVMtthQuyOlDWuqHXqN8azLq+pi8B2TjwKJ32diHjUqRIKeFX4z1FoA== + version "1.0.30001610" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz#2f44ed6e21d359e914271ae35b68903632628ccf" + integrity sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA== chalk@^2.4.2: version "2.4.2" @@ -984,9 +976,9 @@ debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: ms "2.1.2" dedent@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" - integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== + version "1.5.3" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" + integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== deepmerge@^4.2.2: version "4.3.1" @@ -1018,9 +1010,9 @@ diff-sequences@^29.6.3: integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== electron-to-chromium@^1.4.668: - version "1.4.731" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.731.tgz#d3dc19f359045b750a1fb0bc42315a502d950187" - integrity sha512-+TqVfZjpRz2V/5SPpmJxq9qK620SC5SqCnxQIOi7i/U08ZDcTpKbT7Xjj9FU5CbXTMUb4fywbIr8C7cGv4hcjw== + version "1.4.737" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.737.tgz#3a774a58e04980741f65d440f5fdf57af18b6dde" + integrity sha512-QvLTxaLHKdy5YxvixAw/FfHq2eWLUL9KvsPjp0aHK1gI5d3EDuDgITkvj0nFO2c6zUY3ZqVAJQiBYyQP9tQpfw== emittery@^0.13.1: version "0.13.1" @@ -1091,7 +1083,7 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^29.0.0, expect@^29.7.0: +expect@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== @@ -2002,7 +1994,7 @@ prettier@2.7.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== -pretty-format@^29.0.0, pretty-format@^29.7.0: +pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==