@cartesia/cartesia-js 2.1.2 → 2.1.4

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.
Files changed (111) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +11 -6
  3. package/README.md +1 -2
  4. package/api/resources/apiStatus/client/Client.js +1 -1
  5. package/api/resources/datasets/client/Client.js +4 -4
  6. package/api/resources/index.d.ts +2 -0
  7. package/api/resources/index.js +3 -1
  8. package/api/resources/infill/client/Client.d.ts +44 -0
  9. package/api/resources/infill/client/Client.js +127 -0
  10. package/api/resources/infill/client/index.d.ts +1 -0
  11. package/api/resources/infill/client/index.js +17 -0
  12. package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +67 -0
  13. package/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
  14. package/api/resources/infill/client/requests/index.d.ts +1 -0
  15. package/api/resources/infill/client/requests/index.js +2 -0
  16. package/api/resources/infill/index.d.ts +1 -0
  17. package/api/resources/infill/index.js +17 -0
  18. package/api/resources/tts/types/Emotion.d.ts +5 -1
  19. package/api/resources/tts/types/Emotion.js +4 -0
  20. package/api/resources/tts/types/GenerationRequest.d.ts +2 -0
  21. package/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
  22. package/api/resources/tts/types/PhonemeTimestamps.js +5 -0
  23. package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
  24. package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
  25. package/api/resources/tts/types/WebSocketResponse.d.ts +4 -1
  26. package/api/resources/tts/types/WebSocketTtsOutput.d.ts +1 -0
  27. package/api/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
  28. package/api/resources/tts/types/index.d.ts +2 -0
  29. package/api/resources/tts/types/index.js +2 -0
  30. package/api/resources/voices/client/Client.d.ts +1 -2
  31. package/api/resources/voices/client/Client.js +9 -10
  32. package/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
  33. package/api/resources/voices/types/Voice.d.ts +0 -1
  34. package/dist/Client.d.ts +3 -0
  35. package/dist/Client.js +11 -6
  36. package/dist/api/resources/apiStatus/client/Client.js +1 -1
  37. package/dist/api/resources/datasets/client/Client.js +4 -4
  38. package/dist/api/resources/index.d.ts +2 -0
  39. package/dist/api/resources/index.js +3 -1
  40. package/dist/api/resources/infill/client/Client.d.ts +44 -0
  41. package/dist/api/resources/infill/client/Client.js +127 -0
  42. package/dist/api/resources/infill/client/index.d.ts +1 -0
  43. package/dist/api/resources/infill/client/index.js +17 -0
  44. package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +67 -0
  45. package/dist/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
  46. package/dist/api/resources/infill/client/requests/index.d.ts +1 -0
  47. package/dist/api/resources/infill/client/requests/index.js +2 -0
  48. package/dist/api/resources/infill/index.d.ts +1 -0
  49. package/dist/api/resources/infill/index.js +17 -0
  50. package/dist/api/resources/tts/types/Emotion.d.ts +5 -1
  51. package/dist/api/resources/tts/types/Emotion.js +4 -0
  52. package/dist/api/resources/tts/types/GenerationRequest.d.ts +2 -0
  53. package/dist/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
  54. package/dist/api/resources/tts/types/PhonemeTimestamps.js +5 -0
  55. package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
  56. package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
  57. package/dist/api/resources/tts/types/WebSocketResponse.d.ts +4 -1
  58. package/dist/api/resources/tts/types/WebSocketTtsOutput.d.ts +1 -0
  59. package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
  60. package/dist/api/resources/tts/types/index.d.ts +2 -0
  61. package/dist/api/resources/tts/types/index.js +2 -0
  62. package/dist/api/resources/voices/client/Client.d.ts +1 -2
  63. package/dist/api/resources/voices/client/Client.js +9 -10
  64. package/dist/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
  65. package/dist/api/resources/voices/types/Voice.d.ts +0 -1
  66. package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
  67. package/dist/serialization/resources/tts/types/Emotion.js +4 -0
  68. package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +1 -0
  69. package/dist/serialization/resources/tts/types/GenerationRequest.js +1 -0
  70. package/dist/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
  71. package/dist/serialization/resources/tts/types/PhonemeTimestamps.js +35 -0
  72. package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
  73. package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +37 -0
  74. package/dist/serialization/resources/tts/types/WebSocketResponse.d.ts +5 -1
  75. package/dist/serialization/resources/tts/types/WebSocketResponse.js +2 -0
  76. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +2 -0
  77. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +2 -0
  78. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
  79. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +2 -0
  80. package/dist/serialization/resources/tts/types/index.d.ts +2 -0
  81. package/dist/serialization/resources/tts/types/index.js +2 -0
  82. package/dist/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
  83. package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +0 -2
  84. package/dist/serialization/resources/voices/types/Voice.d.ts +0 -2
  85. package/dist/serialization/resources/voices/types/Voice.js +0 -2
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +1 -1
  89. package/reference.md +93 -1
  90. package/serialization/resources/tts/types/Emotion.d.ts +1 -1
  91. package/serialization/resources/tts/types/Emotion.js +4 -0
  92. package/serialization/resources/tts/types/GenerationRequest.d.ts +1 -0
  93. package/serialization/resources/tts/types/GenerationRequest.js +1 -0
  94. package/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
  95. package/serialization/resources/tts/types/PhonemeTimestamps.js +35 -0
  96. package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
  97. package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +37 -0
  98. package/serialization/resources/tts/types/WebSocketResponse.d.ts +5 -1
  99. package/serialization/resources/tts/types/WebSocketResponse.js +2 -0
  100. package/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +2 -0
  101. package/serialization/resources/tts/types/WebSocketTtsOutput.js +2 -0
  102. package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
  103. package/serialization/resources/tts/types/WebSocketTtsRequest.js +2 -0
  104. package/serialization/resources/tts/types/index.d.ts +2 -0
  105. package/serialization/resources/tts/types/index.js +2 -0
  106. package/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
  107. package/serialization/resources/voices/types/CreateVoiceRequest.js +0 -2
  108. package/serialization/resources/voices/types/Voice.d.ts +0 -2
  109. package/serialization/resources/voices/types/Voice.js +0 -2
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
@@ -60,7 +60,7 @@ class Voices {
60
60
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
61
61
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
62
62
  method: "GET",
63
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
63
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
64
64
  contentType: "application/json",
65
65
  requestType: "json",
66
66
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -106,8 +106,7 @@ class Voices {
106
106
  * name: "string",
107
107
  * description: "string",
108
108
  * embedding: [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],
109
- * language: "en",
110
- * baseVoiceId: "string"
109
+ * language: "en"
111
110
  * })
112
111
  */
113
112
  create(request, requestOptions) {
@@ -116,7 +115,7 @@ class Voices {
116
115
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
117
116
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
118
117
  method: "POST",
119
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
118
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
120
119
  contentType: "application/json",
121
120
  requestType: "json",
122
121
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -167,7 +166,7 @@ class Voices {
167
166
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
168
167
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
169
168
  method: "DELETE",
170
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
169
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
171
170
  contentType: "application/json",
172
171
  requestType: "json",
173
172
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -215,7 +214,7 @@ class Voices {
215
214
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
216
215
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
217
216
  method: "PATCH",
218
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
217
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
219
218
  contentType: "application/json",
220
219
  requestType: "json",
221
220
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -266,7 +265,7 @@ class Voices {
266
265
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
267
266
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
268
267
  method: "GET",
269
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
268
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
270
269
  contentType: "application/json",
271
270
  requestType: "json",
272
271
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -321,7 +320,7 @@ class Voices {
321
320
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
322
321
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/localize"),
323
322
  method: "POST",
324
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
323
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
325
324
  contentType: "application/json",
326
325
  requestType: "json",
327
326
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -377,7 +376,7 @@ class Voices {
377
376
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
378
377
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/mix"),
379
378
  method: "POST",
380
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
379
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
381
380
  contentType: "application/json",
382
381
  requestType: "json",
383
382
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -464,7 +463,7 @@ class Voices {
464
463
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
465
464
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/clone"),
466
465
  method: "POST",
467
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
466
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
468
467
  requestType: "file",
469
468
  duplex: _maybeEncodedRequest.duplex,
470
469
  body: _maybeEncodedRequest.body,
@@ -9,5 +9,4 @@ export interface CreateVoiceRequest {
9
9
  description: string;
10
10
  embedding: Cartesia.Embedding;
11
11
  language?: Cartesia.SupportedLanguage;
12
- baseVoiceId?: Cartesia.BaseVoiceId;
13
12
  }
@@ -16,5 +16,4 @@ export interface Voice {
16
16
  createdAt: Date;
17
17
  embedding: Cartesia.Embedding;
18
18
  language: Cartesia.SupportedLanguage;
19
- baseVoiceId?: Cartesia.BaseVoiceId;
20
19
  }
package/dist/Client.d.ts CHANGED
@@ -5,6 +5,7 @@ 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";
@@ -34,6 +35,8 @@ export declare class CartesiaClient {
34
35
  get apiStatus(): ApiStatus;
35
36
  protected _datasets: Datasets | undefined;
36
37
  get datasets(): Datasets;
38
+ protected _infill: Infill | undefined;
39
+ get infill(): Infill;
37
40
  protected _tts: Tts | undefined;
38
41
  get tts(): Tts;
39
42
  protected _voiceChanger: VoiceChanger | undefined;
package/dist/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/tts/client/Client");
10
- const Client_4 = require("./api/resources/voiceChanger/client/Client");
11
- const Client_5 = require("./api/resources/voices/client/Client");
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 Client_3.Tts(this._options)));
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 Client_4.VoiceChanger(this._options)));
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 Client_5.Voices(this._options)));
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;
@@ -56,7 +56,7 @@ class ApiStatus {
56
56
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
57
57
  url: (_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production,
58
58
  method: "GET",
59
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
59
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
60
60
  contentType: "application/json",
61
61
  requestType: "json",
62
62
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -60,7 +60,7 @@ class Datasets {
60
60
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
61
61
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/datasets/"),
62
62
  method: "GET",
63
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
63
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
64
64
  contentType: "application/json",
65
65
  requestType: "json",
66
66
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -112,7 +112,7 @@ class Datasets {
112
112
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
113
113
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/datasets/"),
114
114
  method: "POST",
115
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
115
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
116
116
  contentType: "application/json",
117
117
  requestType: "json",
118
118
  body: serializers.CreateDatasetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -163,7 +163,7 @@ class Datasets {
163
163
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
164
164
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
165
165
  method: "GET",
166
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
166
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
167
167
  contentType: "application/json",
168
168
  requestType: "json",
169
169
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -219,7 +219,7 @@ class Datasets {
219
219
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
220
220
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
221
221
  method: "POST",
222
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.2", "User-Agent": "@cartesia/cartesia-js/2.1.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
222
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
223
223
  requestType: "file",
224
224
  duplex: _maybeEncodedRequest.duplex,
225
225
  body: _maybeEncodedRequest.body,
@@ -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";
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.datasets = exports.apiStatus = void 0;
29
+ exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.datasets = exports.apiStatus = void 0;
30
30
  exports.apiStatus = __importStar(require("./apiStatus"));
31
31
  __exportStar(require("./apiStatus/types"), exports);
32
32
  exports.datasets = __importStar(require("./datasets"));
@@ -39,6 +39,8 @@ exports.voiceChanger = __importStar(require("./voiceChanger"));
39
39
  __exportStar(require("./voiceChanger/types"), exports);
40
40
  exports.voices = __importStar(require("./voices"));
41
41
  __exportStar(require("./voices/types"), exports);
42
+ exports.infill = __importStar(require("./infill"));
42
43
  __exportStar(require("./datasets/client/requests"), exports);
44
+ __exportStar(require("./infill/client/requests"), exports);
43
45
  __exportStar(require("./voiceChanger/client/requests"), exports);
44
46
  __exportStar(require("./voices/client/requests"), exports);
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /// <reference types="node" />
5
+ import * as environments from "../../../../environments";
6
+ import * as core from "../../../../core";
7
+ import * as fs from "fs";
8
+ import { Blob } from "buffer";
9
+ import * as Cartesia from "../../../index";
10
+ import * as stream from "stream";
11
+ export declare namespace Infill {
12
+ interface Options {
13
+ environment?: core.Supplier<environments.CartesiaEnvironment | string>;
14
+ apiKey?: core.Supplier<string | undefined>;
15
+ /** Override the Cartesia-Version header */
16
+ cartesiaVersion?: "2024-06-10";
17
+ fetcher?: core.FetchFunction;
18
+ }
19
+ interface RequestOptions {
20
+ /** The maximum time to wait for a response in seconds. */
21
+ timeoutInSeconds?: number;
22
+ /** The number of times to retry the request. Defaults to 2. */
23
+ maxRetries?: number;
24
+ /** A hook to abort the request. */
25
+ abortSignal?: AbortSignal;
26
+ /** Override the Cartesia-Version header */
27
+ cartesiaVersion?: "2024-06-10";
28
+ }
29
+ }
30
+ export declare class Infill {
31
+ protected readonly _options: Infill.Options;
32
+ constructor(_options?: Infill.Options);
33
+ /**
34
+ * Generate audio that smoothly connects two existing audio segments. This is useful for inserting new speech between existing speech segments while maintaining natural transitions.
35
+ *
36
+ * Only the `sonic-preview` model is supported for infill at this time.
37
+ *
38
+ * At least one of `left_audio` or `right_audio` must be provided.
39
+ */
40
+ bytes(leftAudio: File | fs.ReadStream | Blob, rightAudio: File | fs.ReadStream | Blob, request: Cartesia.InfillBytesRequest, requestOptions?: Infill.RequestOptions): Promise<stream.Readable>;
41
+ protected _getCustomAuthorizationHeaders(): Promise<{
42
+ "X-API-Key": string | undefined;
43
+ }>;
44
+ }
@@ -0,0 +1,127 @@
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 (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.Infill = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const url_join_1 = __importDefault(require("url-join"));
45
+ const errors = __importStar(require("../../../../errors/index"));
46
+ class Infill {
47
+ constructor(_options = {}) {
48
+ this._options = _options;
49
+ }
50
+ /**
51
+ * Generate audio that smoothly connects two existing audio segments. This is useful for inserting new speech between existing speech segments while maintaining natural transitions.
52
+ *
53
+ * Only the `sonic-preview` model is supported for infill at this time.
54
+ *
55
+ * At least one of `left_audio` or `right_audio` must be provided.
56
+ */
57
+ bytes(leftAudio, rightAudio, request, requestOptions) {
58
+ var _a, _b, _c, _d, _e;
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const _request = yield core.newFormData();
61
+ yield _request.appendFile("left_audio", leftAudio);
62
+ yield _request.appendFile("right_audio", rightAudio);
63
+ yield _request.append("model_id[]", request.modelId);
64
+ yield _request.append("language[]", request.language);
65
+ yield _request.append("transcript[]", request.transcript);
66
+ yield _request.append("voice[id]", request.voiceId);
67
+ yield _request.append("output_format[container]", request.outputFormatContainer);
68
+ yield _request.append("output_format[sample_rate]", request.outputFormatSampleRate.toString());
69
+ if (request.outputFormatEncoding != null) {
70
+ yield _request.append("output_format[encoding]", request.outputFormatEncoding);
71
+ }
72
+ if (request.outputFormatBitRate != null) {
73
+ yield _request.append("output_format[bit_rate]", request.outputFormatBitRate.toString());
74
+ }
75
+ if (request.voiceExperimentalControlsSpeed != null) {
76
+ yield _request.append("voice[__experimental_controls][speed]", typeof request.voiceExperimentalControlsSpeed === "string"
77
+ ? request.voiceExperimentalControlsSpeed
78
+ : JSON.stringify(request.voiceExperimentalControlsSpeed));
79
+ }
80
+ if (request.voiceExperimentalControlsEmotion != null) {
81
+ yield _request.append("voice[__experimental_controls][emotion][]", request.voiceExperimentalControlsEmotion);
82
+ }
83
+ const _maybeEncodedRequest = yield _request.getRequest();
84
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
85
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/infill/bytes"),
86
+ method: "POST",
87
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
88
+ requestType: "file",
89
+ duplex: _maybeEncodedRequest.duplex,
90
+ body: _maybeEncodedRequest.body,
91
+ responseType: "streaming",
92
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
93
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
94
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
95
+ });
96
+ if (_response.ok) {
97
+ return _response.body;
98
+ }
99
+ if (_response.error.reason === "status-code") {
100
+ throw new errors.CartesiaError({
101
+ statusCode: _response.error.statusCode,
102
+ body: _response.error.body,
103
+ });
104
+ }
105
+ switch (_response.error.reason) {
106
+ case "non-json":
107
+ throw new errors.CartesiaError({
108
+ statusCode: _response.error.statusCode,
109
+ body: _response.error.rawBody,
110
+ });
111
+ case "timeout":
112
+ throw new errors.CartesiaTimeoutError();
113
+ case "unknown":
114
+ throw new errors.CartesiaError({
115
+ message: _response.error.errorMessage,
116
+ });
117
+ }
118
+ });
119
+ }
120
+ _getCustomAuthorizationHeaders() {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
123
+ return { "X-API-Key": apiKeyValue };
124
+ });
125
+ }
126
+ }
127
+ 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);
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Cartesia from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * modelId: "sonic-preview",
9
+ * language: "en",
10
+ * transcript: "middle segment",
11
+ * voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
12
+ * outputFormatContainer: "mp3",
13
+ * outputFormatSampleRate: 44100,
14
+ * outputFormatBitRate: 128000
15
+ * }
16
+ *
17
+ * @example
18
+ * {
19
+ * modelId: "sonic-preview",
20
+ * language: "en",
21
+ * transcript: "middle segment",
22
+ * voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
23
+ * outputFormatContainer: "wav",
24
+ * outputFormatSampleRate: 44100,
25
+ * outputFormatEncoding: "pcm_f32le"
26
+ * }
27
+ */
28
+ export interface InfillBytesRequest {
29
+ /** The ID of the model to use for generating audio */
30
+ modelId: string;
31
+ /** The language of the transcript */
32
+ language: string;
33
+ /** The infill text to generate */
34
+ transcript: string;
35
+ /** The ID of the voice to use for generating audio */
36
+ voiceId: string;
37
+ /** The format of the output audio */
38
+ outputFormatContainer: Cartesia.OutputFormatContainer;
39
+ /** The sample rate of the output audio */
40
+ outputFormatSampleRate: number;
41
+ /**
42
+ * Required for `raw` and `wav` containers.
43
+ *
44
+ */
45
+ outputFormatEncoding?: Cartesia.RawEncoding;
46
+ /**
47
+ * Required for `mp3` containers.
48
+ *
49
+ */
50
+ outputFormatBitRate?: number;
51
+ /**
52
+ * Either a number between -1.0 and 1.0 or a natural language description of speed.
53
+ *
54
+ * If you specify a number, 0.0 is the default speed, -1.0 is the slowest speed, and 1.0 is the fastest speed.
55
+ *
56
+ */
57
+ voiceExperimentalControlsSpeed?: Cartesia.Speed;
58
+ /**
59
+ * An array of emotion:level tags.
60
+ *
61
+ * Supported emotions are: anger, positivity, surprise, sadness, and curiosity.
62
+ *
63
+ * Supported levels are: lowest, low, (omit), high, highest.
64
+ *
65
+ */
66
+ voiceExperimentalControlsEmotion?: Cartesia.Emotion;
67
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { type InfillBytesRequest } from "./InfillBytesRequest";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client";
@@ -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("./client"), exports);
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Supported levels are: lowest, low, (omit), high, highest.
10
10
  */
11
- export declare type Emotion = "anger:lowest" | "anger:low" | "anger:high" | "anger:highest" | "positivity:lowest" | "positivity:low" | "positivity:high" | "positivity:highest" | "surprise:lowest" | "surprise:high" | "surprise:highest" | "sadness:lowest" | "sadness:low" | "curiosity:low" | "curiosity:high" | "curiosity:highest";
11
+ export declare type Emotion = "anger:lowest" | "anger:low" | "anger:high" | "anger:highest" | "positivity:lowest" | "positivity:low" | "positivity:high" | "positivity:highest" | "surprise:lowest" | "surprise:low" | "surprise:high" | "surprise:highest" | "sadness:lowest" | "sadness:low" | "sadness:high" | "sadness:highest" | "curiosity:lowest" | "curiosity:low" | "curiosity:high" | "curiosity:highest";
12
12
  export declare const Emotion: {
13
13
  readonly AngerLowest: "anger:lowest";
14
14
  readonly AngerLow: "anger:low";
@@ -19,10 +19,14 @@ export declare const Emotion: {
19
19
  readonly PositivityHigh: "positivity:high";
20
20
  readonly PositivityHighest: "positivity:highest";
21
21
  readonly SurpriseLowest: "surprise:lowest";
22
+ readonly SurpriseLow: "surprise:low";
22
23
  readonly SurpriseHigh: "surprise:high";
23
24
  readonly SurpriseHighest: "surprise:highest";
24
25
  readonly SadnessLowest: "sadness:lowest";
25
26
  readonly SadnessLow: "sadness:low";
27
+ readonly SadnessHigh: "sadness:high";
28
+ readonly SadnessHighest: "sadness:highest";
29
+ readonly CuriosityLowest: "curiosity:lowest";
26
30
  readonly CuriosityLow: "curiosity:low";
27
31
  readonly CuriosityHigh: "curiosity:high";
28
32
  readonly CuriosityHighest: "curiosity:highest";
@@ -14,10 +14,14 @@ exports.Emotion = {
14
14
  PositivityHigh: "positivity:high",
15
15
  PositivityHighest: "positivity:highest",
16
16
  SurpriseLowest: "surprise:lowest",
17
+ SurpriseLow: "surprise:low",
17
18
  SurpriseHigh: "surprise:high",
18
19
  SurpriseHighest: "surprise:highest",
19
20
  SadnessLowest: "sadness:lowest",
20
21
  SadnessLow: "sadness:low",
22
+ SadnessHigh: "sadness:high",
23
+ SadnessHighest: "sadness:highest",
24
+ CuriosityLowest: "curiosity:lowest",
21
25
  CuriosityLow: "curiosity:low",
22
26
  CuriosityHigh: "curiosity:high",
23
27
  CuriosityHighest: "curiosity:highest",
@@ -22,4 +22,6 @@ export interface GenerationRequest {
22
22
  continue?: boolean;
23
23
  /** Whether to return word-level timestamps. */
24
24
  addTimestamps?: boolean;
25
+ /** Whether to return phoneme-level timestamps. */
26
+ addPhonemeTimestamps?: boolean;
25
27
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface PhonemeTimestamps {
5
+ phonemes: string[];
6
+ start: number[];
7
+ end: number[];
8
+ }