@cartesia/cartesia-js 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +12 -5
- package/Client.js +11 -6
- package/api/resources/apiStatus/client/Client.d.ts +4 -0
- package/api/resources/apiStatus/client/Client.js +21 -11
- package/api/resources/datasets/client/Client.d.ts +4 -1
- package/api/resources/datasets/client/Client.js +34 -24
- package/api/resources/datasets/types/FilePurpose.d.ts +1 -1
- package/api/resources/embedding/types/Embedding.d.ts +1 -1
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +20 -8
- package/api/resources/infill/client/Client.d.ts +49 -0
- package/api/resources/infill/client/Client.js +148 -0
- package/api/resources/infill/client/index.d.ts +1 -0
- package/api/resources/infill/client/index.js +17 -0
- package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +71 -0
- package/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
- package/api/resources/infill/client/requests/index.d.ts +1 -0
- package/api/resources/infill/client/requests/index.js +2 -0
- package/api/resources/infill/index.d.ts +1 -0
- package/api/resources/infill/index.js +17 -0
- package/api/resources/tts/client/Client.js +21 -11
- package/api/resources/tts/types/ContextId.d.ts +1 -1
- package/api/resources/tts/types/Emotion.d.ts +5 -1
- package/api/resources/tts/types/Emotion.js +4 -0
- package/api/resources/tts/types/FlushId.d.ts +9 -0
- package/api/resources/tts/types/FlushId.js +5 -0
- package/api/resources/tts/types/GenerationRequest.d.ts +7 -2
- package/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
- package/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
- package/api/resources/tts/types/OutputFormat.d.ts +1 -1
- package/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
- package/api/resources/tts/types/PhonemeTimestamps.js +5 -0
- package/api/resources/tts/types/RawEncoding.d.ts +1 -1
- package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/api/resources/tts/types/Speed.d.ts +1 -1
- package/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
- package/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
- package/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
- package/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
- package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
- package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
- package/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
- package/api/resources/tts/types/WebSocketResponse.d.ts +7 -1
- package/api/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
- package/api/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
- package/api/resources/tts/types/index.d.ts +4 -0
- package/api/resources/tts/types/index.js +4 -0
- package/api/resources/voiceChanger/client/Client.d.ts +3 -4
- package/api/resources/voiceChanger/client/Client.js +23 -13
- package/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
- package/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
- package/api/resources/voices/client/Client.d.ts +5 -3
- package/api/resources/voices/client/Client.js +56 -47
- package/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
- package/api/resources/voices/types/CloneMode.d.ts +1 -1
- package/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
- package/api/resources/voices/types/Gender.d.ts +1 -1
- package/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
- package/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
- package/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
- package/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
- package/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
- package/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
- package/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
- package/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
- package/api/resources/voices/types/Voice.d.ts +0 -1
- package/api/resources/voices/types/VoiceId.d.ts +1 -1
- package/api/resources/voices/types/Weight.d.ts +1 -1
- package/api/resources/voices/types/index.d.ts +2 -0
- package/api/resources/voices/types/index.js +2 -0
- package/core/fetcher/APIResponse.d.ts +1 -1
- package/core/fetcher/Fetcher.d.ts +1 -1
- package/core/fetcher/Fetcher.js +2 -2
- package/core/fetcher/Supplier.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/createRequestUrl.js +1 -2
- package/core/fetcher/getFetchFn.js +18 -9
- package/core/fetcher/getHeader.js +1 -2
- package/core/fetcher/getRequestBody.js +5 -5
- package/core/fetcher/getResponseBody.js +1 -2
- package/core/fetcher/makeRequest.d.ts +1 -1
- package/core/fetcher/requestWithRetries.js +4 -5
- package/core/fetcher/signals.d.ts +0 -1
- package/core/fetcher/signals.js +2 -3
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
- package/core/form-data-utils/FormDataWrapper.d.ts +4 -4
- package/core/form-data-utils/FormDataWrapper.js +22 -12
- package/core/index.js +17 -7
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/runtime.d.ts +1 -1
- package/core/runtime/runtime.js +51 -41
- package/core/schemas/Schema.d.ts +7 -5
- package/core/schemas/Schema.js +2 -0
- package/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/core/schemas/builders/bigint/bigint.js +22 -19
- package/core/schemas/builders/date/date.js +1 -2
- package/core/schemas/builders/enum/enum.js +1 -2
- package/core/schemas/builders/lazy/lazy.d.ts +1 -1
- package/core/schemas/builders/lazy/lazy.js +3 -4
- package/core/schemas/builders/lazy/lazyObject.js +1 -2
- package/core/schemas/builders/list/list.js +1 -2
- package/core/schemas/builders/literals/booleanLiteral.js +1 -2
- package/core/schemas/builders/literals/stringLiteral.js +1 -2
- package/core/schemas/builders/object/object.d.ts +1 -1
- package/core/schemas/builders/object/object.js +31 -3
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
- package/core/schemas/builders/object/property.js +2 -3
- package/core/schemas/builders/object/types.d.ts +16 -11
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
- package/core/schemas/builders/object-like/types.d.ts +1 -1
- package/core/schemas/builders/record/record.js +2 -4
- package/core/schemas/builders/record/types.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
- package/core/schemas/builders/set/set.js +1 -2
- package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
- package/core/schemas/builders/union/discriminant.js +1 -2
- package/core/schemas/builders/union/types.d.ts +6 -6
- package/core/schemas/builders/union/union.d.ts +1 -1
- package/core/schemas/builders/union/union.js +1 -2
- package/core/schemas/utils/MaybePromise.d.ts +1 -1
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
- package/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
- package/core/schemas/utils/entries.d.ts +1 -1
- package/core/schemas/utils/entries.js +1 -2
- package/core/schemas/utils/filterObject.d.ts +1 -1
- package/core/schemas/utils/filterObject.js +1 -2
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
- package/core/schemas/utils/isPlainObject.js +1 -2
- package/core/schemas/utils/keys.d.ts +1 -1
- package/core/schemas/utils/keys.js +1 -2
- package/core/schemas/utils/maybeSkipValidation.js +1 -2
- package/core/schemas/utils/partition.js +1 -2
- package/core/streaming-fetcher/Stream.d.ts +0 -1
- package/core/streaming-fetcher/Stream.js +20 -21
- package/core/websocket/ws.d.ts +7 -7
- package/core/websocket/ws.js +17 -7
- package/dist/Client.d.ts +12 -5
- package/dist/Client.js +11 -6
- package/dist/api/resources/apiStatus/client/Client.d.ts +4 -0
- package/dist/api/resources/apiStatus/client/Client.js +21 -11
- package/dist/api/resources/datasets/client/Client.d.ts +4 -1
- package/dist/api/resources/datasets/client/Client.js +34 -24
- package/dist/api/resources/datasets/types/FilePurpose.d.ts +1 -1
- package/dist/api/resources/embedding/types/Embedding.d.ts +1 -1
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +20 -8
- package/dist/api/resources/infill/client/Client.d.ts +49 -0
- package/dist/api/resources/infill/client/Client.js +148 -0
- package/dist/api/resources/infill/client/index.d.ts +1 -0
- package/dist/api/resources/infill/client/index.js +17 -0
- package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +71 -0
- package/dist/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
- package/dist/api/resources/infill/client/requests/index.d.ts +1 -0
- package/dist/api/resources/infill/client/requests/index.js +2 -0
- package/dist/api/resources/infill/index.d.ts +1 -0
- package/dist/api/resources/infill/index.js +17 -0
- package/dist/api/resources/tts/client/Client.js +21 -11
- package/dist/api/resources/tts/types/ContextId.d.ts +1 -1
- package/dist/api/resources/tts/types/Emotion.d.ts +5 -1
- package/dist/api/resources/tts/types/Emotion.js +4 -0
- package/dist/api/resources/tts/types/FlushId.d.ts +9 -0
- package/dist/api/resources/tts/types/FlushId.js +5 -0
- package/dist/api/resources/tts/types/GenerationRequest.d.ts +7 -2
- package/dist/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
- package/dist/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
- package/dist/api/resources/tts/types/OutputFormat.d.ts +1 -1
- package/dist/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
- package/dist/api/resources/tts/types/PhonemeTimestamps.js +5 -0
- package/dist/api/resources/tts/types/RawEncoding.d.ts +1 -1
- package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/Speed.d.ts +1 -1
- package/dist/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
- package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
- package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
- package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
- package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
- package/dist/api/resources/tts/types/WebSocketResponse.d.ts +7 -1
- package/dist/api/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
- package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
- package/dist/api/resources/tts/types/index.d.ts +4 -0
- package/dist/api/resources/tts/types/index.js +4 -0
- package/dist/api/resources/voiceChanger/client/Client.d.ts +3 -4
- package/dist/api/resources/voiceChanger/client/Client.js +23 -13
- package/dist/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
- package/dist/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
- package/dist/api/resources/voices/client/Client.d.ts +5 -3
- package/dist/api/resources/voices/client/Client.js +56 -47
- package/dist/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
- package/dist/api/resources/voices/types/CloneMode.d.ts +1 -1
- package/dist/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
- package/dist/api/resources/voices/types/Gender.d.ts +1 -1
- package/dist/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
- package/dist/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
- package/dist/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
- package/dist/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
- package/dist/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
- package/dist/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
- package/dist/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
- package/dist/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
- package/dist/api/resources/voices/types/Voice.d.ts +0 -1
- package/dist/api/resources/voices/types/VoiceId.d.ts +1 -1
- package/dist/api/resources/voices/types/Weight.d.ts +1 -1
- package/dist/api/resources/voices/types/index.d.ts +2 -0
- package/dist/api/resources/voices/types/index.js +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.js +2 -2
- package/dist/core/fetcher/Supplier.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.js +1 -2
- package/dist/core/fetcher/getFetchFn.js +18 -9
- package/dist/core/fetcher/getHeader.js +1 -2
- package/dist/core/fetcher/getRequestBody.js +5 -5
- package/dist/core/fetcher/getResponseBody.js +1 -2
- package/dist/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/core/fetcher/requestWithRetries.js +4 -5
- package/dist/core/fetcher/signals.d.ts +0 -1
- package/dist/core/fetcher/signals.js +2 -3
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +4 -4
- package/dist/core/form-data-utils/FormDataWrapper.js +22 -12
- package/dist/core/index.js +17 -7
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/runtime.d.ts +1 -1
- package/dist/core/runtime/runtime.js +51 -41
- package/dist/core/schemas/Schema.d.ts +7 -5
- package/dist/core/schemas/Schema.js +2 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/dist/core/schemas/builders/bigint/bigint.js +22 -19
- package/dist/core/schemas/builders/date/date.js +1 -2
- package/dist/core/schemas/builders/enum/enum.js +1 -2
- package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
- package/dist/core/schemas/builders/lazy/lazy.js +3 -4
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -2
- package/dist/core/schemas/builders/list/list.js +1 -2
- package/dist/core/schemas/builders/literals/booleanLiteral.js +1 -2
- package/dist/core/schemas/builders/literals/stringLiteral.js +1 -2
- package/dist/core/schemas/builders/object/object.d.ts +1 -1
- package/dist/core/schemas/builders/object/object.js +31 -3
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
- package/dist/core/schemas/builders/object/property.js +2 -3
- package/dist/core/schemas/builders/object/types.d.ts +16 -11
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
- package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
- package/dist/core/schemas/builders/record/record.js +2 -4
- package/dist/core/schemas/builders/record/types.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
- package/dist/core/schemas/builders/set/set.js +1 -2
- package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
- package/dist/core/schemas/builders/union/discriminant.js +1 -2
- package/dist/core/schemas/builders/union/types.d.ts +6 -6
- package/dist/core/schemas/builders/union/union.d.ts +1 -1
- package/dist/core/schemas/builders/union/union.js +1 -2
- package/dist/core/schemas/utils/MaybePromise.d.ts +1 -1
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
- package/dist/core/schemas/utils/entries.d.ts +1 -1
- package/dist/core/schemas/utils/entries.js +1 -2
- package/dist/core/schemas/utils/filterObject.d.ts +1 -1
- package/dist/core/schemas/utils/filterObject.js +1 -2
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
- package/dist/core/schemas/utils/isPlainObject.js +1 -2
- package/dist/core/schemas/utils/keys.d.ts +1 -1
- package/dist/core/schemas/utils/keys.js +1 -2
- package/dist/core/schemas/utils/maybeSkipValidation.js +1 -2
- package/dist/core/schemas/utils/partition.js +1 -2
- package/dist/core/streaming-fetcher/Stream.d.ts +0 -1
- package/dist/core/streaming-fetcher/Stream.js +20 -21
- package/dist/core/websocket/ws.d.ts +7 -7
- package/dist/core/websocket/ws.js +17 -7
- package/dist/environments.d.ts +1 -1
- package/dist/errors/CartesiaError.js +2 -1
- package/dist/errors/CartesiaTimeoutError.d.ts +1 -1
- package/dist/errors/CartesiaTimeoutError.js +2 -2
- package/dist/index.js +17 -7
- package/dist/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
- package/dist/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
- package/dist/serialization/resources/datasets/types/Dataset.js +17 -7
- package/dist/serialization/resources/datasets/types/DatasetFile.js +17 -7
- package/dist/serialization/resources/datasets/types/FilePurpose.js +17 -7
- package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
- package/dist/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
- package/dist/serialization/resources/embedding/types/Embedding.js +17 -7
- package/dist/serialization/resources/index.js +17 -7
- package/dist/serialization/resources/tts/types/CancelContextRequest.js +17 -7
- package/dist/serialization/resources/tts/types/ContextId.js +17 -7
- package/dist/serialization/resources/tts/types/Controls.js +17 -7
- package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/dist/serialization/resources/tts/types/Emotion.js +21 -7
- package/dist/serialization/resources/tts/types/FlushId.d.ts +10 -0
- package/dist/serialization/resources/tts/types/FlushId.js +41 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +4 -2
- package/dist/serialization/resources/tts/types/GenerationRequest.js +21 -9
- package/dist/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
- package/dist/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
- package/dist/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
- package/dist/serialization/resources/tts/types/OutputFormat.js +17 -7
- package/dist/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
- package/dist/serialization/resources/tts/types/PhonemeTimestamps.js +45 -0
- package/dist/serialization/resources/tts/types/RawEncoding.js +17 -7
- package/dist/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/dist/serialization/resources/tts/types/RawOutputFormat.js +18 -7
- package/dist/serialization/resources/tts/types/Speed.js +17 -7
- package/dist/serialization/resources/tts/types/SupportedLanguage.js +17 -7
- package/dist/serialization/resources/tts/types/TtsRequest.js +17 -7
- package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
- package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
- package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
- package/dist/serialization/resources/tts/types/WavOutputFormat.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
- package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
- package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
- package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +47 -0
- package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketRequest.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketResponse.d.ts +9 -1
- package/dist/serialization/resources/tts/types/WebSocketResponse.js +21 -7
- package/dist/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
- package/dist/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +5 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +22 -7
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +18 -7
- package/dist/serialization/resources/tts/types/WordTimestamps.js +17 -7
- package/dist/serialization/resources/tts/types/index.d.ts +4 -0
- package/dist/serialization/resources/tts/types/index.js +4 -0
- package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
- package/dist/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
- package/dist/serialization/resources/voices/client/index.js +17 -7
- package/dist/serialization/resources/voices/client/list.js +17 -7
- package/dist/serialization/resources/voices/types/CloneMode.js +17 -7
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +17 -9
- package/dist/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
- package/dist/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
- package/dist/serialization/resources/voices/types/Gender.js +17 -7
- package/dist/serialization/resources/voices/types/IdSpecifier.js +17 -7
- package/dist/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
- package/dist/serialization/resources/voices/types/LocalizeDialect.js +24 -8
- package/dist/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
- package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
- package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
- package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
- package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
- package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
- package/dist/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
- package/dist/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
- package/dist/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
- package/dist/serialization/resources/voices/types/Voice.d.ts +0 -2
- package/dist/serialization/resources/voices/types/Voice.js +17 -9
- package/dist/serialization/resources/voices/types/VoiceId.js +17 -7
- package/dist/serialization/resources/voices/types/VoiceMetadata.js +17 -7
- package/dist/serialization/resources/voices/types/Weight.js +17 -7
- package/dist/serialization/resources/voices/types/index.d.ts +2 -0
- package/dist/serialization/resources/voices/types/index.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/WebPlayer.js +1 -1
- package/dist/wrapper/Websocket.js +25 -15
- package/dist/wrapper/source.js +1 -1
- package/dist/wrapper/utils.d.ts +9 -9
- package/dist/wrapper/utils.js +10 -10
- package/environments.d.ts +1 -1
- package/errors/CartesiaError.js +2 -1
- package/errors/CartesiaTimeoutError.d.ts +1 -1
- package/errors/CartesiaTimeoutError.js +2 -2
- package/index.js +17 -7
- package/{jest.config.js → jest.config.mjs} +4 -1
- package/package.json +15 -16
- package/reference.md +97 -1
- package/scripts/rename-to-esm-files.js +115 -0
- package/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
- package/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
- package/serialization/resources/datasets/types/Dataset.js +17 -7
- package/serialization/resources/datasets/types/DatasetFile.js +17 -7
- package/serialization/resources/datasets/types/FilePurpose.js +17 -7
- package/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
- package/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
- package/serialization/resources/embedding/types/Embedding.js +17 -7
- package/serialization/resources/index.js +17 -7
- package/serialization/resources/tts/types/CancelContextRequest.js +17 -7
- package/serialization/resources/tts/types/ContextId.js +17 -7
- package/serialization/resources/tts/types/Controls.js +17 -7
- package/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/serialization/resources/tts/types/Emotion.js +21 -7
- package/serialization/resources/tts/types/FlushId.d.ts +10 -0
- package/serialization/resources/tts/types/FlushId.js +41 -0
- package/serialization/resources/tts/types/GenerationRequest.d.ts +4 -2
- package/serialization/resources/tts/types/GenerationRequest.js +21 -9
- package/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
- package/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
- package/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
- package/serialization/resources/tts/types/OutputFormat.js +17 -7
- package/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
- package/serialization/resources/tts/types/PhonemeTimestamps.js +45 -0
- package/serialization/resources/tts/types/RawEncoding.js +17 -7
- package/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/serialization/resources/tts/types/RawOutputFormat.js +18 -7
- package/serialization/resources/tts/types/Speed.js +17 -7
- package/serialization/resources/tts/types/SupportedLanguage.js +17 -7
- package/serialization/resources/tts/types/TtsRequest.js +17 -7
- package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
- package/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
- package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
- package/serialization/resources/tts/types/WavOutputFormat.js +17 -7
- package/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
- package/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
- package/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
- package/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
- package/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
- package/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
- package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
- package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +47 -0
- package/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
- package/serialization/resources/tts/types/WebSocketRequest.js +17 -7
- package/serialization/resources/tts/types/WebSocketResponse.d.ts +9 -1
- package/serialization/resources/tts/types/WebSocketResponse.js +21 -7
- package/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
- package/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
- package/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +5 -0
- package/serialization/resources/tts/types/WebSocketTtsOutput.js +22 -7
- package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +18 -7
- package/serialization/resources/tts/types/WordTimestamps.js +17 -7
- package/serialization/resources/tts/types/index.d.ts +4 -0
- package/serialization/resources/tts/types/index.js +4 -0
- package/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
- package/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
- package/serialization/resources/voices/client/index.js +17 -7
- package/serialization/resources/voices/client/list.js +17 -7
- package/serialization/resources/voices/types/CloneMode.js +17 -7
- package/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
- package/serialization/resources/voices/types/CreateVoiceRequest.js +17 -9
- package/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
- package/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
- package/serialization/resources/voices/types/Gender.js +17 -7
- package/serialization/resources/voices/types/IdSpecifier.js +17 -7
- package/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
- package/serialization/resources/voices/types/LocalizeDialect.js +24 -8
- package/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
- package/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
- package/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
- package/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
- package/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
- package/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
- package/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
- package/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
- package/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
- package/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
- package/serialization/resources/voices/types/Voice.d.ts +0 -2
- package/serialization/resources/voices/types/Voice.js +17 -9
- package/serialization/resources/voices/types/VoiceId.js +17 -7
- package/serialization/resources/voices/types/VoiceMetadata.js +17 -7
- package/serialization/resources/voices/types/Weight.js +17 -7
- package/serialization/resources/voices/types/index.d.ts +2 -0
- package/serialization/resources/voices/types/index.js +2 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/WebPlayer.js +1 -1
- package/wrapper/Websocket.js +25 -15
- package/wrapper/source.js +1 -1
- package/wrapper/utils.d.ts +9 -9
- package/wrapper/utils.js +10 -10
package/Client.d.ts
CHANGED
|
@@ -5,12 +5,15 @@ import * as environments from "./environments";
|
|
|
5
5
|
import * as core from "./core";
|
|
6
6
|
import { ApiStatus } from "./api/resources/apiStatus/client/Client";
|
|
7
7
|
import { Datasets } from "./api/resources/datasets/client/Client";
|
|
8
|
+
import { Infill } from "./api/resources/infill/client/Client";
|
|
8
9
|
import { Tts } from "./api/resources/tts/client/Client";
|
|
9
10
|
import { VoiceChanger } from "./api/resources/voiceChanger/client/Client";
|
|
10
11
|
import { Voices } from "./api/resources/voices/client/Client";
|
|
11
12
|
export declare namespace CartesiaClient {
|
|
12
13
|
interface Options {
|
|
13
14
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
15
|
+
/** Specify a custom URL to connect the client to. */
|
|
16
|
+
baseUrl?: core.Supplier<string>;
|
|
14
17
|
apiKey?: core.Supplier<string | undefined>;
|
|
15
18
|
/** Override the Cartesia-Version header */
|
|
16
19
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -25,19 +28,23 @@ export declare namespace CartesiaClient {
|
|
|
25
28
|
abortSignal?: AbortSignal;
|
|
26
29
|
/** Override the Cartesia-Version header */
|
|
27
30
|
cartesiaVersion?: "2024-06-10";
|
|
31
|
+
/** Additional headers to include in the request. */
|
|
32
|
+
headers?: Record<string, string>;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
export declare class CartesiaClient {
|
|
31
36
|
protected readonly _options: CartesiaClient.Options;
|
|
32
|
-
constructor(_options?: CartesiaClient.Options);
|
|
33
37
|
protected _apiStatus: ApiStatus | undefined;
|
|
34
|
-
get apiStatus(): ApiStatus;
|
|
35
38
|
protected _datasets: Datasets | undefined;
|
|
36
|
-
|
|
39
|
+
protected _infill: Infill | undefined;
|
|
37
40
|
protected _tts: Tts | undefined;
|
|
38
|
-
get tts(): Tts;
|
|
39
41
|
protected _voiceChanger: VoiceChanger | undefined;
|
|
40
|
-
get voiceChanger(): VoiceChanger;
|
|
41
42
|
protected _voices: Voices | undefined;
|
|
43
|
+
constructor(_options?: CartesiaClient.Options);
|
|
44
|
+
get apiStatus(): ApiStatus;
|
|
45
|
+
get datasets(): Datasets;
|
|
46
|
+
get infill(): Infill;
|
|
47
|
+
get tts(): Tts;
|
|
48
|
+
get voiceChanger(): VoiceChanger;
|
|
42
49
|
get voices(): Voices;
|
|
43
50
|
}
|
package/Client.js
CHANGED
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CartesiaClient = void 0;
|
|
7
7
|
const Client_1 = require("./api/resources/apiStatus/client/Client");
|
|
8
8
|
const Client_2 = require("./api/resources/datasets/client/Client");
|
|
9
|
-
const Client_3 = require("./api/resources/
|
|
10
|
-
const Client_4 = require("./api/resources/
|
|
11
|
-
const Client_5 = require("./api/resources/
|
|
9
|
+
const Client_3 = require("./api/resources/infill/client/Client");
|
|
10
|
+
const Client_4 = require("./api/resources/tts/client/Client");
|
|
11
|
+
const Client_5 = require("./api/resources/voiceChanger/client/Client");
|
|
12
|
+
const Client_6 = require("./api/resources/voices/client/Client");
|
|
12
13
|
class CartesiaClient {
|
|
13
14
|
constructor(_options = {}) {
|
|
14
15
|
this._options = _options;
|
|
@@ -21,17 +22,21 @@ class CartesiaClient {
|
|
|
21
22
|
var _a;
|
|
22
23
|
return ((_a = this._datasets) !== null && _a !== void 0 ? _a : (this._datasets = new Client_2.Datasets(this._options)));
|
|
23
24
|
}
|
|
25
|
+
get infill() {
|
|
26
|
+
var _a;
|
|
27
|
+
return ((_a = this._infill) !== null && _a !== void 0 ? _a : (this._infill = new Client_3.Infill(this._options)));
|
|
28
|
+
}
|
|
24
29
|
get tts() {
|
|
25
30
|
var _a;
|
|
26
|
-
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new
|
|
31
|
+
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_4.Tts(this._options)));
|
|
27
32
|
}
|
|
28
33
|
get voiceChanger() {
|
|
29
34
|
var _a;
|
|
30
|
-
return ((_a = this._voiceChanger) !== null && _a !== void 0 ? _a : (this._voiceChanger = new
|
|
35
|
+
return ((_a = this._voiceChanger) !== null && _a !== void 0 ? _a : (this._voiceChanger = new Client_5.VoiceChanger(this._options)));
|
|
31
36
|
}
|
|
32
37
|
get voices() {
|
|
33
38
|
var _a;
|
|
34
|
-
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new
|
|
39
|
+
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_6.Voices(this._options)));
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
exports.CartesiaClient = CartesiaClient;
|
|
@@ -7,6 +7,8 @@ import * as Cartesia from "../../../index";
|
|
|
7
7
|
export declare namespace ApiStatus {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
10
12
|
apiKey?: core.Supplier<string | undefined>;
|
|
11
13
|
/** Override the Cartesia-Version header */
|
|
12
14
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -21,6 +23,8 @@ export declare namespace ApiStatus {
|
|
|
21
23
|
abortSignal?: AbortSignal;
|
|
22
24
|
/** Override the Cartesia-Version header */
|
|
23
25
|
cartesiaVersion?: "2024-06-10";
|
|
26
|
+
/** Additional headers to include in the request. */
|
|
27
|
+
headers?: Record<string, string>;
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
export declare class ApiStatus {
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
39
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
40
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -51,12 +61,12 @@ class ApiStatus {
|
|
|
51
61
|
* await client.apiStatus.get()
|
|
52
62
|
*/
|
|
53
63
|
get(requestOptions) {
|
|
54
|
-
var _a, _b, _c, _d, _e;
|
|
55
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f;
|
|
56
66
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
57
|
-
url: (_b = (yield core.Supplier.get(this._options.
|
|
67
|
+
url: (_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production,
|
|
58
68
|
method: "GET",
|
|
59
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
69
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
60
70
|
contentType: "application/json",
|
|
61
71
|
requestType: "json",
|
|
62
72
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -85,7 +95,7 @@ class ApiStatus {
|
|
|
85
95
|
body: _response.error.rawBody,
|
|
86
96
|
});
|
|
87
97
|
case "timeout":
|
|
88
|
-
throw new errors.CartesiaTimeoutError();
|
|
98
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /.");
|
|
89
99
|
case "unknown":
|
|
90
100
|
throw new errors.CartesiaError({
|
|
91
101
|
message: _response.error.errorMessage,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
/// <reference types="node" />
|
|
5
4
|
import * as environments from "../../../../environments";
|
|
6
5
|
import * as core from "../../../../core";
|
|
7
6
|
import * as Cartesia from "../../../index";
|
|
@@ -10,6 +9,8 @@ import { Blob } from "buffer";
|
|
|
10
9
|
export declare namespace Datasets {
|
|
11
10
|
interface Options {
|
|
12
11
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
12
|
+
/** Specify a custom URL to connect the client to. */
|
|
13
|
+
baseUrl?: core.Supplier<string>;
|
|
13
14
|
apiKey?: core.Supplier<string | undefined>;
|
|
14
15
|
/** Override the Cartesia-Version header */
|
|
15
16
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -24,6 +25,8 @@ export declare namespace Datasets {
|
|
|
24
25
|
abortSignal?: AbortSignal;
|
|
25
26
|
/** Override the Cartesia-Version header */
|
|
26
27
|
cartesiaVersion?: "2024-06-10";
|
|
28
|
+
/** Additional headers to include in the request. */
|
|
29
|
+
headers?: Record<string, string>;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
export declare class Datasets {
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
39
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
40
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -55,12 +65,12 @@ class Datasets {
|
|
|
55
65
|
* await client.datasets.list()
|
|
56
66
|
*/
|
|
57
67
|
list(requestOptions) {
|
|
58
|
-
var _a, _b, _c, _d, _e;
|
|
59
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f;
|
|
60
70
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
61
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
71
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/datasets/"),
|
|
62
72
|
method: "GET",
|
|
63
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
73
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
64
74
|
contentType: "application/json",
|
|
65
75
|
requestType: "json",
|
|
66
76
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -89,7 +99,7 @@ class Datasets {
|
|
|
89
99
|
body: _response.error.rawBody,
|
|
90
100
|
});
|
|
91
101
|
case "timeout":
|
|
92
|
-
throw new errors.CartesiaTimeoutError();
|
|
102
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /datasets/.");
|
|
93
103
|
case "unknown":
|
|
94
104
|
throw new errors.CartesiaError({
|
|
95
105
|
message: _response.error.errorMessage,
|
|
@@ -107,12 +117,12 @@ class Datasets {
|
|
|
107
117
|
* })
|
|
108
118
|
*/
|
|
109
119
|
create(request, requestOptions) {
|
|
110
|
-
var _a, _b, _c, _d, _e;
|
|
111
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
var _a, _b, _c, _d, _e, _f;
|
|
112
122
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
113
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
123
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/datasets/"),
|
|
114
124
|
method: "POST",
|
|
115
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
125
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
116
126
|
contentType: "application/json",
|
|
117
127
|
requestType: "json",
|
|
118
128
|
body: serializers.CreateDatasetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -142,7 +152,7 @@ class Datasets {
|
|
|
142
152
|
body: _response.error.rawBody,
|
|
143
153
|
});
|
|
144
154
|
case "timeout":
|
|
145
|
-
throw new errors.CartesiaTimeoutError();
|
|
155
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /datasets/.");
|
|
146
156
|
case "unknown":
|
|
147
157
|
throw new errors.CartesiaError({
|
|
148
158
|
message: _response.error.errorMessage,
|
|
@@ -158,12 +168,12 @@ class Datasets {
|
|
|
158
168
|
* await client.datasets.listFiles("string")
|
|
159
169
|
*/
|
|
160
170
|
listFiles(id, requestOptions) {
|
|
161
|
-
var _a, _b, _c, _d, _e;
|
|
162
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f;
|
|
163
173
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
164
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
174
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
|
|
165
175
|
method: "GET",
|
|
166
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
176
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
167
177
|
contentType: "application/json",
|
|
168
178
|
requestType: "json",
|
|
169
179
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -192,7 +202,7 @@ class Datasets {
|
|
|
192
202
|
body: _response.error.rawBody,
|
|
193
203
|
});
|
|
194
204
|
case "timeout":
|
|
195
|
-
throw new errors.CartesiaTimeoutError();
|
|
205
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /datasets/{id}/files.");
|
|
196
206
|
case "unknown":
|
|
197
207
|
throw new errors.CartesiaError({
|
|
198
208
|
message: _response.error.errorMessage,
|
|
@@ -210,16 +220,16 @@ class Datasets {
|
|
|
210
220
|
* await client.datasets.uploadFile(fs.createReadStream("/path/to/your/file"), "string", {})
|
|
211
221
|
*/
|
|
212
222
|
uploadFile(file, id, request, requestOptions) {
|
|
213
|
-
var _a, _b, _c, _d, _e;
|
|
214
223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
var _a, _b, _c, _d, _e, _f;
|
|
215
225
|
const _request = yield core.newFormData();
|
|
216
226
|
yield _request.appendFile("file", file);
|
|
217
|
-
|
|
227
|
+
_request.append("purpose", serializers.FilePurpose.jsonOrThrow(request.purpose, { unrecognizedObjectKeys: "strip" }));
|
|
218
228
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
219
229
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
220
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
230
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
|
|
221
231
|
method: "POST",
|
|
222
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (
|
|
232
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
223
233
|
requestType: "file",
|
|
224
234
|
duplex: _maybeEncodedRequest.duplex,
|
|
225
235
|
body: _maybeEncodedRequest.body,
|
|
@@ -243,7 +253,7 @@ class Datasets {
|
|
|
243
253
|
body: _response.error.rawBody,
|
|
244
254
|
});
|
|
245
255
|
case "timeout":
|
|
246
|
-
throw new errors.CartesiaTimeoutError();
|
|
256
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /datasets/{id}/files.");
|
|
247
257
|
case "unknown":
|
|
248
258
|
throw new errors.CartesiaError({
|
|
249
259
|
message: _response.error.errorMessage,
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* @example
|
|
8
8
|
* [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type Embedding = number[];
|
package/api/resources/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export * as voiceChanger from "./voiceChanger";
|
|
|
10
10
|
export * from "./voiceChanger/types";
|
|
11
11
|
export * as voices from "./voices";
|
|
12
12
|
export * from "./voices/types";
|
|
13
|
+
export * as infill from "./infill";
|
|
13
14
|
export * from "./datasets/client/requests";
|
|
15
|
+
export * from "./infill/client/requests";
|
|
14
16
|
export * from "./voiceChanger/client/requests";
|
|
15
17
|
export * from "./voices/client/requests";
|
package/api/resources/index.js
CHANGED
|
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.datasets = exports.apiStatus = void 0;
|
|
39
|
+
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.datasets = exports.apiStatus = void 0;
|
|
30
40
|
exports.apiStatus = __importStar(require("./apiStatus"));
|
|
31
41
|
__exportStar(require("./apiStatus/types"), exports);
|
|
32
42
|
exports.datasets = __importStar(require("./datasets"));
|
|
@@ -39,6 +49,8 @@ exports.voiceChanger = __importStar(require("./voiceChanger"));
|
|
|
39
49
|
__exportStar(require("./voiceChanger/types"), exports);
|
|
40
50
|
exports.voices = __importStar(require("./voices"));
|
|
41
51
|
__exportStar(require("./voices/types"), exports);
|
|
52
|
+
exports.infill = __importStar(require("./infill"));
|
|
42
53
|
__exportStar(require("./datasets/client/requests"), exports);
|
|
54
|
+
__exportStar(require("./infill/client/requests"), exports);
|
|
43
55
|
__exportStar(require("./voiceChanger/client/requests"), exports);
|
|
44
56
|
__exportStar(require("./voices/client/requests"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
5
|
+
import * as core from "../../../../core";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import { Blob } from "buffer";
|
|
8
|
+
import * as Cartesia from "../../../index";
|
|
9
|
+
import * as stream from "stream";
|
|
10
|
+
export declare namespace Infill {
|
|
11
|
+
interface Options {
|
|
12
|
+
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
13
|
+
/** Specify a custom URL to connect the client to. */
|
|
14
|
+
baseUrl?: core.Supplier<string>;
|
|
15
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
16
|
+
/** Override the Cartesia-Version header */
|
|
17
|
+
cartesiaVersion?: "2024-06-10";
|
|
18
|
+
fetcher?: core.FetchFunction;
|
|
19
|
+
}
|
|
20
|
+
interface RequestOptions {
|
|
21
|
+
/** The maximum time to wait for a response in seconds. */
|
|
22
|
+
timeoutInSeconds?: number;
|
|
23
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
/** A hook to abort the request. */
|
|
26
|
+
abortSignal?: AbortSignal;
|
|
27
|
+
/** Override the Cartesia-Version header */
|
|
28
|
+
cartesiaVersion?: "2024-06-10";
|
|
29
|
+
/** Additional headers to include in the request. */
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export declare class Infill {
|
|
34
|
+
protected readonly _options: Infill.Options;
|
|
35
|
+
constructor(_options?: Infill.Options);
|
|
36
|
+
/**
|
|
37
|
+
* Generate audio that smoothly connects two existing audio segments. This is useful for inserting new speech between existing speech segments while maintaining natural transitions.
|
|
38
|
+
*
|
|
39
|
+
* The cost is 1 credit per character of the infill text plus a fixed cost of 300 credits.
|
|
40
|
+
*
|
|
41
|
+
* Only the `sonic-preview` model is supported for infill at this time.
|
|
42
|
+
*
|
|
43
|
+
* At least one of `left_audio` or `right_audio` must be provided.
|
|
44
|
+
*/
|
|
45
|
+
bytes(leftAudio: File | fs.ReadStream | Blob, rightAudio: File | fs.ReadStream | Blob, request: Cartesia.InfillBytesRequest, requestOptions?: Infill.RequestOptions): Promise<stream.Readable>;
|
|
46
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
47
|
+
"X-API-Key": string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.Infill = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const serializers = __importStar(require("../../../../serialization/index"));
|
|
55
|
+
const json_1 = require("../../../../core/json");
|
|
56
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
57
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
58
|
+
class Infill {
|
|
59
|
+
constructor(_options = {}) {
|
|
60
|
+
this._options = _options;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generate audio that smoothly connects two existing audio segments. This is useful for inserting new speech between existing speech segments while maintaining natural transitions.
|
|
64
|
+
*
|
|
65
|
+
* The cost is 1 credit per character of the infill text plus a fixed cost of 300 credits.
|
|
66
|
+
*
|
|
67
|
+
* Only the `sonic-preview` model is supported for infill at this time.
|
|
68
|
+
*
|
|
69
|
+
* At least one of `left_audio` or `right_audio` must be provided.
|
|
70
|
+
*/
|
|
71
|
+
bytes(leftAudio, rightAudio, request, requestOptions) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f;
|
|
74
|
+
const _request = yield core.newFormData();
|
|
75
|
+
yield _request.appendFile("left_audio", leftAudio);
|
|
76
|
+
yield _request.appendFile("right_audio", rightAudio);
|
|
77
|
+
_request.append("model_id", request.modelId);
|
|
78
|
+
_request.append("language", request.language);
|
|
79
|
+
_request.append("transcript", request.transcript);
|
|
80
|
+
_request.append("voice_id", request.voiceId);
|
|
81
|
+
_request.append("output_format[container]", serializers.OutputFormatContainer.jsonOrThrow(request.outputFormatContainer, {
|
|
82
|
+
unrecognizedObjectKeys: "strip",
|
|
83
|
+
}));
|
|
84
|
+
_request.append("output_format[sample_rate]", request.outputFormatSampleRate.toString());
|
|
85
|
+
if (request.outputFormatEncoding != null) {
|
|
86
|
+
_request.append("output_format[encoding]", serializers.RawEncoding.jsonOrThrow(request.outputFormatEncoding, { unrecognizedObjectKeys: "strip" }));
|
|
87
|
+
}
|
|
88
|
+
if (request.outputFormatBitRate != null) {
|
|
89
|
+
_request.append("output_format[bit_rate]", request.outputFormatBitRate.toString());
|
|
90
|
+
}
|
|
91
|
+
if (request.voiceExperimentalControlsSpeed != null) {
|
|
92
|
+
_request.append("voice[__experimental_controls][speed]", (() => {
|
|
93
|
+
const mapped = serializers.Speed.jsonOrThrow(request.voiceExperimentalControlsSpeed, {
|
|
94
|
+
unrecognizedObjectKeys: "strip",
|
|
95
|
+
});
|
|
96
|
+
return typeof mapped === "string" ? mapped : (0, json_1.toJson)(mapped);
|
|
97
|
+
})());
|
|
98
|
+
}
|
|
99
|
+
if (request.voiceExperimentalControlsEmotion != null) {
|
|
100
|
+
for (const _item of request.voiceExperimentalControlsEmotion) {
|
|
101
|
+
_request.append("voice[__experimental_controls][emotion][]", serializers.Emotion.jsonOrThrow(_item, { unrecognizedObjectKeys: "strip" }));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
105
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
106
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/infill/bytes"),
|
|
107
|
+
method: "POST",
|
|
108
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
109
|
+
requestType: "file",
|
|
110
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
111
|
+
body: _maybeEncodedRequest.body,
|
|
112
|
+
responseType: "streaming",
|
|
113
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
114
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
115
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
116
|
+
});
|
|
117
|
+
if (_response.ok) {
|
|
118
|
+
return _response.body;
|
|
119
|
+
}
|
|
120
|
+
if (_response.error.reason === "status-code") {
|
|
121
|
+
throw new errors.CartesiaError({
|
|
122
|
+
statusCode: _response.error.statusCode,
|
|
123
|
+
body: _response.error.body,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
switch (_response.error.reason) {
|
|
127
|
+
case "non-json":
|
|
128
|
+
throw new errors.CartesiaError({
|
|
129
|
+
statusCode: _response.error.statusCode,
|
|
130
|
+
body: _response.error.rawBody,
|
|
131
|
+
});
|
|
132
|
+
case "timeout":
|
|
133
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /infill/bytes.");
|
|
134
|
+
case "unknown":
|
|
135
|
+
throw new errors.CartesiaError({
|
|
136
|
+
message: _response.error.errorMessage,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
_getCustomAuthorizationHeaders() {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
144
|
+
return { "X-API-Key": apiKeyValue };
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.Infill = Infill;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|