telnyx 7.22.0 → 7.23.0

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 (326) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/client.d.mts +34 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +34 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +30 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +30 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/ai.d.mts +6 -2
  12. package/resources/ai/ai.d.mts.map +1 -1
  13. package/resources/ai/ai.d.ts +6 -2
  14. package/resources/ai/ai.d.ts.map +1 -1
  15. package/resources/ai/ai.js +4 -0
  16. package/resources/ai/ai.js.map +1 -1
  17. package/resources/ai/ai.mjs +5 -1
  18. package/resources/ai/ai.mjs.map +1 -1
  19. package/resources/ai/assistants/assistants.d.mts +256 -46
  20. package/resources/ai/assistants/assistants.d.mts.map +1 -1
  21. package/resources/ai/assistants/assistants.d.ts +256 -46
  22. package/resources/ai/assistants/assistants.d.ts.map +1 -1
  23. package/resources/ai/assistants/assistants.js.map +1 -1
  24. package/resources/ai/assistants/assistants.mjs.map +1 -1
  25. package/resources/ai/assistants/versions.d.mts +34 -12
  26. package/resources/ai/assistants/versions.d.mts.map +1 -1
  27. package/resources/ai/assistants/versions.d.ts +34 -12
  28. package/resources/ai/assistants/versions.d.ts.map +1 -1
  29. package/resources/ai/audio.d.mts +78 -43
  30. package/resources/ai/audio.d.mts.map +1 -1
  31. package/resources/ai/audio.d.ts +78 -43
  32. package/resources/ai/audio.d.ts.map +1 -1
  33. package/resources/ai/audio.js.map +1 -1
  34. package/resources/ai/audio.mjs.map +1 -1
  35. package/resources/ai/chat.d.mts +2 -10
  36. package/resources/ai/chat.d.mts.map +1 -1
  37. package/resources/ai/chat.d.ts +2 -10
  38. package/resources/ai/chat.d.ts.map +1 -1
  39. package/resources/ai/chat.js.map +1 -1
  40. package/resources/ai/chat.mjs.map +1 -1
  41. package/resources/ai/index.d.mts +2 -1
  42. package/resources/ai/index.d.mts.map +1 -1
  43. package/resources/ai/index.d.ts +2 -1
  44. package/resources/ai/index.d.ts.map +1 -1
  45. package/resources/ai/index.js +3 -1
  46. package/resources/ai/index.js.map +1 -1
  47. package/resources/ai/index.mjs +2 -1
  48. package/resources/ai/index.mjs.map +1 -1
  49. package/resources/ai/openai/chat.d.mts +10 -11
  50. package/resources/ai/openai/chat.d.mts.map +1 -1
  51. package/resources/ai/openai/chat.d.ts +10 -11
  52. package/resources/ai/openai/chat.d.ts.map +1 -1
  53. package/resources/ai/openai/chat.js.map +1 -1
  54. package/resources/ai/openai/chat.mjs.map +1 -1
  55. package/resources/ai/openai/index.d.mts +1 -1
  56. package/resources/ai/openai/index.d.mts.map +1 -1
  57. package/resources/ai/openai/index.d.ts +1 -1
  58. package/resources/ai/openai/index.d.ts.map +1 -1
  59. package/resources/ai/openai/index.js.map +1 -1
  60. package/resources/ai/openai/index.mjs +1 -1
  61. package/resources/ai/openai/index.mjs.map +1 -1
  62. package/resources/ai/openai/openai.d.mts +2 -2
  63. package/resources/ai/openai/openai.d.mts.map +1 -1
  64. package/resources/ai/openai/openai.d.ts +2 -2
  65. package/resources/ai/openai/openai.d.ts.map +1 -1
  66. package/resources/ai/openai/openai.js.map +1 -1
  67. package/resources/ai/openai/openai.mjs.map +1 -1
  68. package/resources/ai/typesafe/index.d.mts +3 -0
  69. package/resources/ai/typesafe/index.d.mts.map +1 -0
  70. package/resources/ai/typesafe/index.d.ts +3 -0
  71. package/resources/ai/typesafe/index.d.ts.map +1 -0
  72. package/resources/ai/typesafe/index.js +9 -0
  73. package/resources/ai/typesafe/index.js.map +1 -0
  74. package/resources/ai/typesafe/index.mjs +4 -0
  75. package/resources/ai/typesafe/index.mjs.map +1 -0
  76. package/resources/ai/typesafe/typesafe.d.mts +10 -0
  77. package/resources/ai/typesafe/typesafe.d.mts.map +1 -0
  78. package/resources/ai/typesafe/typesafe.d.ts +10 -0
  79. package/resources/ai/typesafe/typesafe.d.ts.map +1 -0
  80. package/resources/ai/typesafe/typesafe.js +17 -0
  81. package/resources/ai/typesafe/typesafe.js.map +1 -0
  82. package/resources/ai/typesafe/typesafe.mjs +12 -0
  83. package/resources/ai/typesafe/typesafe.mjs.map +1 -0
  84. package/resources/ai/typesafe/v1.d.mts +274 -0
  85. package/resources/ai/typesafe/v1.d.mts.map +1 -0
  86. package/resources/ai/typesafe/v1.d.ts +274 -0
  87. package/resources/ai/typesafe/v1.d.ts.map +1 -0
  88. package/resources/ai/typesafe/v1.js +67 -0
  89. package/resources/ai/typesafe/v1.js.map +1 -0
  90. package/resources/ai/typesafe/v1.mjs +63 -0
  91. package/resources/ai/typesafe/v1.mjs.map +1 -0
  92. package/resources/ai/typesafe.d.mts +2 -0
  93. package/resources/ai/typesafe.d.mts.map +1 -0
  94. package/resources/ai/typesafe.d.ts +2 -0
  95. package/resources/ai/typesafe.d.ts.map +1 -0
  96. package/resources/ai/typesafe.js +6 -0
  97. package/resources/ai/typesafe.js.map +1 -0
  98. package/resources/ai/typesafe.mjs +3 -0
  99. package/resources/ai/typesafe.mjs.map +1 -0
  100. package/resources/bot-challenge.d.mts +80 -0
  101. package/resources/bot-challenge.d.mts.map +1 -0
  102. package/resources/bot-challenge.d.ts +80 -0
  103. package/resources/bot-challenge.d.ts.map +1 -0
  104. package/resources/bot-challenge.js +35 -0
  105. package/resources/bot-challenge.js.map +1 -0
  106. package/resources/bot-challenge.mjs +31 -0
  107. package/resources/bot-challenge.mjs.map +1 -0
  108. package/resources/bot-sessions.d.mts +49 -0
  109. package/resources/bot-sessions.d.mts.map +1 -0
  110. package/resources/bot-sessions.d.ts +49 -0
  111. package/resources/bot-sessions.d.ts.map +1 -0
  112. package/resources/bot-sessions.js +28 -0
  113. package/resources/bot-sessions.js.map +1 -0
  114. package/resources/bot-sessions.mjs +24 -0
  115. package/resources/bot-sessions.mjs.map +1 -0
  116. package/resources/bot-signup.d.mts +114 -0
  117. package/resources/bot-signup.d.mts.map +1 -0
  118. package/resources/bot-signup.d.ts +114 -0
  119. package/resources/bot-signup.d.ts.map +1 -0
  120. package/resources/bot-signup.js +63 -0
  121. package/resources/bot-signup.js.map +1 -0
  122. package/resources/bot-signup.mjs +59 -0
  123. package/resources/bot-signup.mjs.map +1 -0
  124. package/resources/calls/actions.d.mts +57 -11
  125. package/resources/calls/actions.d.mts.map +1 -1
  126. package/resources/calls/actions.d.ts +57 -11
  127. package/resources/calls/actions.d.ts.map +1 -1
  128. package/resources/calls/calls.d.mts +45 -5
  129. package/resources/calls/calls.d.mts.map +1 -1
  130. package/resources/calls/calls.d.ts +45 -5
  131. package/resources/calls/calls.d.ts.map +1 -1
  132. package/resources/calls/calls.js.map +1 -1
  133. package/resources/calls/calls.mjs.map +1 -1
  134. package/resources/compute/compute.d.mts +2 -2
  135. package/resources/compute/compute.d.mts.map +1 -1
  136. package/resources/compute/compute.d.ts +2 -2
  137. package/resources/compute/compute.d.ts.map +1 -1
  138. package/resources/compute/compute.js +2 -2
  139. package/resources/compute/compute.js.map +1 -1
  140. package/resources/compute/compute.mjs +2 -2
  141. package/resources/compute/compute.mjs.map +1 -1
  142. package/resources/compute/funcs/export.d.mts +121 -0
  143. package/resources/compute/funcs/export.d.mts.map +1 -0
  144. package/resources/compute/funcs/export.d.ts +121 -0
  145. package/resources/compute/funcs/export.d.ts.map +1 -0
  146. package/resources/compute/funcs/export.js +68 -0
  147. package/resources/compute/funcs/export.js.map +1 -0
  148. package/resources/compute/funcs/export.mjs +64 -0
  149. package/resources/compute/funcs/export.mjs.map +1 -0
  150. package/resources/compute/funcs/funcs.d.mts +214 -0
  151. package/resources/compute/funcs/funcs.d.mts.map +1 -0
  152. package/resources/compute/funcs/funcs.d.ts +214 -0
  153. package/resources/compute/funcs/funcs.d.ts.map +1 -0
  154. package/resources/compute/funcs/funcs.js +80 -0
  155. package/resources/compute/funcs/funcs.js.map +1 -0
  156. package/resources/compute/funcs/funcs.mjs +75 -0
  157. package/resources/compute/funcs/funcs.mjs.map +1 -0
  158. package/resources/compute/funcs/index.d.mts +3 -0
  159. package/resources/compute/funcs/index.d.mts.map +1 -0
  160. package/resources/compute/funcs/index.d.ts +3 -0
  161. package/resources/compute/funcs/index.d.ts.map +1 -0
  162. package/resources/compute/funcs/index.js +9 -0
  163. package/resources/compute/funcs/index.js.map +1 -0
  164. package/resources/compute/funcs/index.mjs +4 -0
  165. package/resources/compute/funcs/index.mjs.map +1 -0
  166. package/resources/compute/funcs.d.mts +1 -178
  167. package/resources/compute/funcs.d.mts.map +1 -1
  168. package/resources/compute/funcs.d.ts +1 -178
  169. package/resources/compute/funcs.d.ts.map +1 -1
  170. package/resources/compute/funcs.js +2 -37
  171. package/resources/compute/funcs.js.map +1 -1
  172. package/resources/compute/funcs.mjs +1 -35
  173. package/resources/compute/funcs.mjs.map +1 -1
  174. package/resources/compute/index.d.mts +1 -1
  175. package/resources/compute/index.d.mts.map +1 -1
  176. package/resources/compute/index.d.ts +1 -1
  177. package/resources/compute/index.d.ts.map +1 -1
  178. package/resources/compute/index.js +2 -2
  179. package/resources/compute/index.js.map +1 -1
  180. package/resources/compute/index.mjs +1 -1
  181. package/resources/compute/index.mjs.map +1 -1
  182. package/resources/connections.d.mts +109 -1
  183. package/resources/connections.d.mts.map +1 -1
  184. package/resources/connections.d.ts +109 -1
  185. package/resources/connections.d.ts.map +1 -1
  186. package/resources/connections.js +8 -0
  187. package/resources/connections.js.map +1 -1
  188. package/resources/connections.mjs +8 -0
  189. package/resources/connections.mjs.map +1 -1
  190. package/resources/detail-records.d.mts +18 -1
  191. package/resources/detail-records.d.mts.map +1 -1
  192. package/resources/detail-records.d.ts +18 -1
  193. package/resources/detail-records.d.ts.map +1 -1
  194. package/resources/email-messages/email-messages.d.mts +5 -3
  195. package/resources/email-messages/email-messages.d.mts.map +1 -1
  196. package/resources/email-messages/email-messages.d.ts +5 -3
  197. package/resources/email-messages/email-messages.d.ts.map +1 -1
  198. package/resources/email-messages/email-messages.js +5 -3
  199. package/resources/email-messages/email-messages.js.map +1 -1
  200. package/resources/email-messages/email-messages.mjs +5 -3
  201. package/resources/email-messages/email-messages.mjs.map +1 -1
  202. package/resources/index.d.mts +7 -2
  203. package/resources/index.d.mts.map +1 -1
  204. package/resources/index.d.ts +7 -2
  205. package/resources/index.d.ts.map +1 -1
  206. package/resources/index.js +14 -4
  207. package/resources/index.js.map +1 -1
  208. package/resources/index.mjs +5 -0
  209. package/resources/index.mjs.map +1 -1
  210. package/resources/machine-payments.d.mts +142 -0
  211. package/resources/machine-payments.d.mts.map +1 -0
  212. package/resources/machine-payments.d.ts +142 -0
  213. package/resources/machine-payments.d.ts.map +1 -0
  214. package/resources/machine-payments.js +56 -0
  215. package/resources/machine-payments.js.map +1 -0
  216. package/resources/machine-payments.mjs +52 -0
  217. package/resources/machine-payments.mjs.map +1 -0
  218. package/resources/messages/messages.d.mts +135 -23
  219. package/resources/messages/messages.d.mts.map +1 -1
  220. package/resources/messages/messages.d.ts +135 -23
  221. package/resources/messages/messages.d.ts.map +1 -1
  222. package/resources/messages/messages.js.map +1 -1
  223. package/resources/messages/messages.mjs.map +1 -1
  224. package/resources/noise-suppression-engines.d.mts +42 -0
  225. package/resources/noise-suppression-engines.d.mts.map +1 -0
  226. package/resources/noise-suppression-engines.d.ts +42 -0
  227. package/resources/noise-suppression-engines.d.ts.map +1 -0
  228. package/resources/noise-suppression-engines.js +21 -0
  229. package/resources/noise-suppression-engines.js.map +1 -0
  230. package/resources/noise-suppression-engines.mjs +17 -0
  231. package/resources/noise-suppression-engines.mjs.map +1 -0
  232. package/resources/speech-to-text/speech-to-text.d.mts +1 -1
  233. package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
  234. package/resources/speech-to-text/speech-to-text.d.ts +1 -1
  235. package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
  236. package/resources/texml/accounts/calls/calls.d.mts +117 -0
  237. package/resources/texml/accounts/calls/calls.d.mts.map +1 -1
  238. package/resources/texml/accounts/calls/calls.d.ts +117 -0
  239. package/resources/texml/accounts/calls/calls.d.ts.map +1 -1
  240. package/resources/texml/accounts/calls/calls.js.map +1 -1
  241. package/resources/texml/accounts/calls/calls.mjs.map +1 -1
  242. package/resources/texml/accounts/conferences/participants.d.mts +39 -0
  243. package/resources/texml/accounts/conferences/participants.d.mts.map +1 -1
  244. package/resources/texml/accounts/conferences/participants.d.ts +39 -0
  245. package/resources/texml/accounts/conferences/participants.d.ts.map +1 -1
  246. package/resources/texml/calls.d.mts +71 -0
  247. package/resources/texml/calls.d.mts.map +1 -0
  248. package/resources/texml/calls.d.ts +71 -0
  249. package/resources/texml/calls.d.ts.map +1 -0
  250. package/resources/texml/calls.js +33 -0
  251. package/resources/texml/calls.js.map +1 -0
  252. package/resources/texml/calls.mjs +29 -0
  253. package/resources/texml/calls.mjs.map +1 -0
  254. package/resources/texml/index.d.mts +1 -0
  255. package/resources/texml/index.d.mts.map +1 -1
  256. package/resources/texml/index.d.ts +1 -0
  257. package/resources/texml/index.d.ts.map +1 -1
  258. package/resources/texml/index.js +3 -1
  259. package/resources/texml/index.js.map +1 -1
  260. package/resources/texml/index.mjs +1 -0
  261. package/resources/texml/index.mjs.map +1 -1
  262. package/resources/texml/texml.d.mts +43 -0
  263. package/resources/texml/texml.d.mts.map +1 -1
  264. package/resources/texml/texml.d.ts +43 -0
  265. package/resources/texml/texml.d.ts.map +1 -1
  266. package/resources/texml/texml.js +4 -0
  267. package/resources/texml/texml.js.map +1 -1
  268. package/resources/texml/texml.mjs +4 -0
  269. package/resources/texml/texml.mjs.map +1 -1
  270. package/resources/voice-clones.d.mts +6 -4
  271. package/resources/voice-clones.d.mts.map +1 -1
  272. package/resources/voice-clones.d.ts +6 -4
  273. package/resources/voice-clones.d.ts.map +1 -1
  274. package/resources/voice-clones.js +4 -2
  275. package/resources/voice-clones.js.map +1 -1
  276. package/resources/voice-clones.mjs +4 -2
  277. package/resources/voice-clones.mjs.map +1 -1
  278. package/resources/webhooks.d.mts +26 -49
  279. package/resources/webhooks.d.mts.map +1 -1
  280. package/resources/webhooks.d.ts +26 -49
  281. package/resources/webhooks.d.ts.map +1 -1
  282. package/src/client.ts +80 -0
  283. package/src/resources/ai/ai.ts +13 -1
  284. package/src/resources/ai/assistants/assistants.ts +281 -45
  285. package/src/resources/ai/assistants/versions.ts +34 -12
  286. package/src/resources/ai/audio.ts +93 -45
  287. package/src/resources/ai/chat.ts +2 -11
  288. package/src/resources/ai/index.ts +7 -1
  289. package/src/resources/ai/openai/chat.ts +11 -11
  290. package/src/resources/ai/openai/index.ts +6 -1
  291. package/src/resources/ai/openai/openai.ts +2 -1
  292. package/src/resources/ai/typesafe/index.ts +4 -0
  293. package/src/resources/ai/typesafe/typesafe.ts +19 -0
  294. package/src/resources/ai/typesafe/v1.ts +298 -0
  295. package/src/resources/ai/typesafe.ts +3 -0
  296. package/src/resources/bot-challenge.ts +101 -0
  297. package/src/resources/bot-sessions.ts +61 -0
  298. package/src/resources/bot-signup.ts +140 -0
  299. package/src/resources/calls/actions.ts +65 -10
  300. package/src/resources/calls/calls.ts +52 -5
  301. package/src/resources/compute/compute.ts +2 -2
  302. package/src/resources/compute/funcs/export.ts +156 -0
  303. package/src/resources/compute/funcs/funcs.ts +341 -0
  304. package/src/resources/compute/funcs/index.ts +15 -0
  305. package/src/resources/compute/funcs.ts +1 -296
  306. package/src/resources/compute/index.ts +1 -1
  307. package/src/resources/connections.ts +133 -0
  308. package/src/resources/detail-records.ts +18 -1
  309. package/src/resources/email-messages/email-messages.ts +5 -3
  310. package/src/resources/index.ts +23 -0
  311. package/src/resources/machine-payments.ts +169 -0
  312. package/src/resources/messages/messages.ts +168 -23
  313. package/src/resources/noise-suppression-engines.ts +51 -0
  314. package/src/resources/speech-to-text/speech-to-text.ts +1 -0
  315. package/src/resources/texml/accounts/calls/calls.ts +138 -0
  316. package/src/resources/texml/accounts/conferences/participants.ts +46 -0
  317. package/src/resources/texml/calls.ts +90 -0
  318. package/src/resources/texml/index.ts +1 -0
  319. package/src/resources/texml/texml.ts +56 -0
  320. package/src/resources/voice-clones.ts +6 -4
  321. package/src/resources/webhooks.ts +31 -58
  322. package/src/version.ts +1 -1
  323. package/version.d.mts +1 -1
  324. package/version.d.ts +1 -1
  325. package/version.js +1 -1
  326. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as AudioAPI from './audio';
4
5
  import { APIPromise } from '../../core/api-promise';
5
6
  import { type Uploadable } from '../../core/uploads';
6
7
  import { RequestOptions } from '../../internal/request-options';
@@ -27,12 +28,56 @@ export class Audio extends APIResource {
27
28
  }
28
29
  }
29
30
 
31
+ /**
32
+ * Word-level timing detail. Only present when using a `deepgram/*` model with
33
+ * `model_config` options that enable word timestamps.
34
+ */
35
+ export interface AudioTranscriptionResponseWord {
36
+ /**
37
+ * End time of the word in seconds.
38
+ */
39
+ end: number;
40
+
41
+ /**
42
+ * Start time of the word in seconds.
43
+ */
44
+ start: number;
45
+
46
+ /**
47
+ * The transcribed word.
48
+ */
49
+ word: string;
50
+
51
+ /**
52
+ * Confidence score for the word (0.0 to 1.0).
53
+ */
54
+ confidence?: number;
55
+
56
+ /**
57
+ * The transcribed word with punctuation and capitalisation applied. Only present
58
+ * when `punctuate` or `smart_format` is enabled via `model_config`.
59
+ */
60
+ punctuated_word?: string;
61
+
62
+ /**
63
+ * Speaker index. Only present when diarization is enabled via `model_config`.
64
+ */
65
+ speaker?: number;
66
+
67
+ /**
68
+ * Confidence score for the speaker assignment (0.0 to 1.0). Only present when
69
+ * diarization is enabled via `model_config`.
70
+ */
71
+ speaker_confidence?: number;
72
+ }
73
+
30
74
  /**
31
75
  * Response fields vary by model. `distil-whisper/distil-large-v2` returns `text`,
32
76
  * `duration`, and `segments` in `verbose_json` mode.
33
- * `openai/whisper-large-v3-turbo` returns `text` only. `deepgram/nova-3` returns
34
- * `text` and, depending on `model_config`, may include `words` with per-word
35
- * timestamps and speaker labels.
77
+ * `openai/whisper-large-v3-turbo` returns `text` only. The `deepgram/*` models
78
+ * return `text` and, depending on `model_config`, may include `words` with
79
+ * per-word timestamps and speaker labels. The Parakeet models
80
+ * (`nvidia/parakeet-v3`, `omi-health/omi-med-stt-v1`) return `text` only.
36
81
  */
37
82
  export interface AudioTranscribeResponse {
38
83
  /**
@@ -42,23 +87,25 @@ export interface AudioTranscribeResponse {
42
87
 
43
88
  /**
44
89
  * The duration of the audio file in seconds. Returned by
45
- * `distil-whisper/distil-large-v2` and `deepgram/nova-3` when `response_format` is
46
- * `verbose_json`. Not returned by `openai/whisper-large-v3-turbo`.
90
+ * `distil-whisper/distil-large-v2` and the `deepgram/*` models when
91
+ * `response_format` is `verbose_json`. Not returned by
92
+ * `openai/whisper-large-v3-turbo`.
47
93
  */
48
94
  duration?: number;
49
95
 
50
96
  /**
51
97
  * Segments of the transcribed text and their corresponding details. Returned by
52
- * `distil-whisper/distil-large-v2` when `response_format` is `verbose_json`. Not
53
- * returned by `openai/whisper-large-v3-turbo`.
98
+ * `distil-whisper/distil-large-v2` and the `deepgram/*` models when
99
+ * `response_format` is `verbose_json`; Deepgram segments also carry nested `words`
100
+ * and `speakers`. Not returned by `openai/whisper-large-v3-turbo`.
54
101
  */
55
102
  segments?: Array<AudioTranscribeResponse.Segment>;
56
103
 
57
104
  /**
58
- * Word-level timestamps and optional speaker labels. Only returned by
59
- * `deepgram/nova-3` when word-level output is enabled via `model_config`.
105
+ * Word-level timestamps and optional speaker labels. Only returned by the
106
+ * `deepgram/*` models when word-level output is enabled via `model_config`.
60
107
  */
61
- words?: Array<AudioTranscribeResponse.Word>;
108
+ words?: Array<AudioTranscriptionResponseWord>;
62
109
  }
63
110
 
64
111
  export namespace AudioTranscribeResponse {
@@ -82,37 +129,18 @@ export namespace AudioTranscribeResponse {
82
129
  * Text content of the segment.
83
130
  */
84
131
  text: string;
85
- }
86
-
87
- /**
88
- * Word-level timing detail. Only present when using `deepgram/nova-3` with
89
- * `model_config` options that enable word timestamps.
90
- */
91
- export interface Word {
92
- /**
93
- * End time of the word in seconds.
94
- */
95
- end: number;
96
-
97
- /**
98
- * Start time of the word in seconds.
99
- */
100
- start: number;
101
-
102
- /**
103
- * The transcribed word.
104
- */
105
- word: string;
106
132
 
107
133
  /**
108
- * Confidence score for the word (0.0 to 1.0).
134
+ * Speaker indices heard in this segment. Returned by the `deepgram/*` models when
135
+ * `diarize` is enabled via `model_config`.
109
136
  */
110
- confidence?: number;
137
+ speakers?: Array<number>;
111
138
 
112
139
  /**
113
- * Speaker index. Only present when diarization is enabled via `model_config`.
140
+ * Word-level timing detail for this segment. Returned by the `deepgram/*` models
141
+ * when word-level output is enabled via `model_config`.
114
142
  */
115
- speaker?: number;
143
+ words?: Array<AudioAPI.AudioTranscriptionResponseWord>;
116
144
  }
117
145
  }
118
146
 
@@ -120,37 +148,56 @@ export interface AudioTranscribeParams {
120
148
  /**
121
149
  * ID of the model to use. `distil-whisper/distil-large-v2` is lower latency but
122
150
  * English-only. `openai/whisper-large-v3-turbo` is multi-lingual but slightly
123
- * higher latency. `deepgram/nova-3` supports English variants (en, en-US, en-GB,
124
- * en-AU, en-NZ, en-IN) and only accepts mp3/wav files.
151
+ * higher latency. The `deepgram/*` models only accept mp3/wav files:
152
+ * `deepgram/nova-3` covers ~49 languages plus `multi` and `deepgram/nova-2` covers
153
+ * ~33, while the `-medical` variants are tuned for clinical vocabulary and accept
154
+ * English only (`en` and its regional variants, e.g. `en-US`, `en-GB`).
155
+ * `nvidia/parakeet-v3` is multilingual with automatic language detection;
156
+ * `omi-health/omi-med-stt-v1` is a medical model, English only.
125
157
  */
126
- model: 'distil-whisper/distil-large-v2' | 'openai/whisper-large-v3-turbo' | 'deepgram/nova-3';
158
+ model:
159
+ | 'distil-whisper/distil-large-v2'
160
+ | 'openai/whisper-large-v3-turbo'
161
+ | 'deepgram/nova-2'
162
+ | 'deepgram/nova-2-medical'
163
+ | 'deepgram/nova-3'
164
+ | 'deepgram/nova-3-medical'
165
+ | 'nvidia/parakeet-v3'
166
+ | 'omi-health/omi-med-stt-v1';
127
167
 
128
168
  /**
129
169
  * The audio file object to transcribe, in one of these formats: flac, mp3, mp4,
130
170
  * mpeg, mpga, m4a, ogg, wav, or webm. File uploads are limited to 100 MB. Cannot
131
- * be used together with `file_url`. Note: `deepgram/nova-3` only supports mp3 and
132
- * wav formats.
171
+ * be used together with `file_url`. Note: the `deepgram/*` models only support mp3
172
+ * and wav formats.
133
173
  */
134
174
  file?: Uploadable;
135
175
 
136
176
  /**
137
177
  * Link to audio file in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a,
138
178
  * ogg, wav, or webm. Support for hosted files is limited to 100MB. Cannot be used
139
- * together with `file`. Note: `deepgram/nova-3` only supports mp3 and wav formats.
179
+ * together with `file`. Note: the `deepgram/*` models only support mp3 and wav
180
+ * formats.
140
181
  */
141
182
  file_url?: string;
142
183
 
143
184
  /**
144
- * The language of the audio to be transcribed. For `deepgram/nova-3`, only English
145
- * variants are supported: `en`, `en-US`, `en-GB`, `en-AU`, `en-NZ`, `en-IN`. For
185
+ * The language of the audio to be transcribed. `deepgram/nova-3` supports ~49
186
+ * languages plus `multi`, and `deepgram/nova-2` supports ~33 plus `multi`; the
187
+ * `-medical` variants are English only (`en` and its regional variants, e.g.
188
+ * `en-US`, `en-GB`). Deepgram models validate on the base language and forward the
189
+ * full tag, so regional variants such as `de-CH` and `pt-BR` are accepted where
190
+ * the base language is supported; an unsupported language returns a 400. For
146
191
  * `openai/whisper-large-v3-turbo`, supports multiple languages.
147
192
  * `distil-whisper/distil-large-v2` does not support language parameter.
193
+ * `nvidia/parakeet-v3` detects the language automatically;
194
+ * `omi-health/omi-med-stt-v1` is English only.
148
195
  */
149
196
  language?: string;
150
197
 
151
198
  /**
152
- * Additional model-specific configuration parameters. Only allowed with
153
- * `deepgram/nova-3` model. Can include Deepgram-specific options such as
199
+ * Additional model-specific configuration parameters. Only allowed with the
200
+ * `deepgram/*` models. Can include Deepgram-specific options such as
154
201
  * `smart_format`, `punctuate`, `diarize`, `utterance`, `numerals`, and `language`.
155
202
  * If `language` is provided both as a top-level parameter and in `model_config`,
156
203
  * the top-level parameter takes precedence.
@@ -173,6 +220,7 @@ export interface AudioTranscribeParams {
173
220
 
174
221
  export declare namespace Audio {
175
222
  export {
223
+ type AudioTranscriptionResponseWord as AudioTranscriptionResponseWord,
176
224
  type AudioTranscribeResponse as AudioTranscribeResponse,
177
225
  type AudioTranscribeParams as AudioTranscribeParams,
178
226
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as ChatAPI from './chat';
5
+ import * as OpenAIChatAPI from './openai/chat';
5
6
 
6
7
  export class Chat extends APIResource {}
7
8
 
@@ -282,21 +283,11 @@ export namespace ChatCompletionRequest {
282
283
  }
283
284
 
284
285
  export interface Function {
285
- function: Function.Function;
286
+ function: OpenAIChatAPI.FunctionDefinition;
286
287
 
287
288
  type: 'function';
288
289
  }
289
290
 
290
- export namespace Function {
291
- export interface Function {
292
- name: string;
293
-
294
- description?: string;
295
-
296
- parameters?: { [key: string]: unknown };
297
- }
298
- }
299
-
300
291
  export interface Retrieval {
301
292
  retrieval: ChatAPI.BucketIDs;
302
293
 
@@ -77,7 +77,12 @@ export {
77
77
  type AssistantCloneParams,
78
78
  type AssistantSendSMSParams,
79
79
  } from './assistants/index';
80
- export { Audio, type AudioTranscribeResponse, type AudioTranscribeParams } from './audio';
80
+ export {
81
+ Audio,
82
+ type AudioTranscriptionResponseWord,
83
+ type AudioTranscribeResponse,
84
+ type AudioTranscribeParams,
85
+ } from './audio';
81
86
  export { Chat, type BucketIDs, type ChatCompletionRequest } from './chat';
82
87
  export {
83
88
  Clusters,
@@ -160,3 +165,4 @@ export {
160
165
  type ToolUpdateParams,
161
166
  type SharedToolResponsesDefaultFlatPagination,
162
167
  } from './tools';
168
+ export { Typesafe } from './typesafe/index';
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
+ import * as OpenAIChatAPI from './chat';
4
5
  import * as ChatAPI from '../chat';
5
6
  import { APIPromise } from '../../../core/api-promise';
6
7
  import { RequestOptions } from '../../../internal/request-options';
@@ -34,6 +35,14 @@ export class Chat extends APIResource {
34
35
  }
35
36
  }
36
37
 
38
+ export interface FunctionDefinition {
39
+ name: string;
40
+
41
+ description?: string;
42
+
43
+ parameters?: { [key: string]: unknown };
44
+ }
45
+
37
46
  export type ChatCreateCompletionResponse = { [key: string]: unknown };
38
47
 
39
48
  export interface ChatCreateCompletionParams {
@@ -299,21 +308,11 @@ export namespace ChatCreateCompletionParams {
299
308
  }
300
309
 
301
310
  export interface Function {
302
- function: Function.Function;
311
+ function: OpenAIChatAPI.FunctionDefinition;
303
312
 
304
313
  type: 'function';
305
314
  }
306
315
 
307
- export namespace Function {
308
- export interface Function {
309
- name: string;
310
-
311
- description?: string;
312
-
313
- parameters?: { [key: string]: unknown };
314
- }
315
- }
316
-
317
316
  export interface Retrieval {
318
317
  retrieval: ChatAPI.BucketIDs;
319
318
 
@@ -323,6 +322,7 @@ export namespace ChatCreateCompletionParams {
323
322
 
324
323
  export declare namespace Chat {
325
324
  export {
325
+ type FunctionDefinition as FunctionDefinition,
326
326
  type ChatCreateCompletionResponse as ChatCreateCompletionResponse,
327
327
  type ChatCreateCompletionParams as ChatCreateCompletionParams,
328
328
  };
@@ -1,6 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Chat, type ChatCreateCompletionResponse, type ChatCreateCompletionParams } from './chat';
3
+ export {
4
+ Chat,
5
+ type FunctionDefinition,
6
+ type ChatCreateCompletionResponse,
7
+ type ChatCreateCompletionParams,
8
+ } from './chat';
4
9
  export {
5
10
  Embeddings,
6
11
  type EmbeddingCreateEmbeddingsResponse,
@@ -3,7 +3,7 @@
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as AIAPI from '../ai';
5
5
  import * as ChatAPI from './chat';
6
- import { Chat, ChatCreateCompletionParams, ChatCreateCompletionResponse } from './chat';
6
+ import { Chat, ChatCreateCompletionParams, ChatCreateCompletionResponse, FunctionDefinition } from './chat';
7
7
  import * as EmbeddingsAPI from './embeddings';
8
8
  import {
9
9
  EmbeddingCreateEmbeddingsParams,
@@ -191,6 +191,7 @@ export declare namespace OpenAI {
191
191
 
192
192
  export {
193
193
  Chat as Chat,
194
+ type FunctionDefinition as FunctionDefinition,
194
195
  type ChatCreateCompletionResponse as ChatCreateCompletionResponse,
195
196
  type ChatCreateCompletionParams as ChatCreateCompletionParams,
196
197
  };
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Typesafe } from './typesafe';
4
+ export { V1, type V1SystemoneResponse, type V1SystemoneParams } from './v1';
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as V1API from './v1';
5
+ import { V1, V1SystemoneParams, V1SystemoneResponse } from './v1';
6
+
7
+ export class Typesafe extends APIResource {
8
+ v1: V1API.V1 = new V1API.V1(this._client);
9
+ }
10
+
11
+ Typesafe.V1 = V1;
12
+
13
+ export declare namespace Typesafe {
14
+ export {
15
+ V1 as V1,
16
+ type V1SystemoneResponse as V1SystemoneResponse,
17
+ type V1SystemoneParams as V1SystemoneParams,
18
+ };
19
+ }
@@ -0,0 +1,298 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+
7
+ /**
8
+ * Beta API for evaluating shared context with typed questions and structured answers. Telnyx manages model selection.
9
+ */
10
+ export class V1 extends APIResource {
11
+ /**
12
+ * **Beta API.** Telnyx controls model selection.
13
+ *
14
+ * Evaluate shared context using named choice, noul (yes/no), and score questions.
15
+ * Returns TypeSafe System One-compatible answer shapes, an opaque compatibility
16
+ * identifier, and token usage. See the
17
+ * [decision model guide](https://developers.telnyx.com/docs/inference/decision-models)
18
+ * for examples and compatibility limits.
19
+ *
20
+ * The supported request subset requires instructions for every question, string
21
+ * descriptions for criteria (or null for choice descriptions), 1–64 questions, and
22
+ * 2–64 options for choice and score questions. The SDK-supplied model value is
23
+ * ignored and cannot select a model. Other unknown fields are rejected. The
24
+ * endpoint is synchronous and does not stream.
25
+ *
26
+ * Use the TypeSafe Python SDK with base_url set to
27
+ * https://api.telnyx.com/v2/ai/typesafe and a Telnyx API key. The SDK appends
28
+ * /v1/systemone. Compatibility covers this operation and the documented request
29
+ * subset; it does not include TypeSafe model listing. Scores describe relative
30
+ * preference, not calibrated correctness.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const response = await client.ai.typesafe.v1.systemone({
35
+ * questions: {
36
+ * team: {
37
+ * type: 'choice',
38
+ * instructions:
39
+ * 'Choose the team that should handle this incident.',
40
+ * criteria: {
41
+ * billing: 'Payments and refunds',
42
+ * technical_support:
43
+ * 'Service faults and technical problems',
44
+ * sales: 'New purchases',
45
+ * },
46
+ * },
47
+ * production_incident: {
48
+ * type: 'noul',
49
+ * instructions:
50
+ * 'Does the message describe an active production incident?',
51
+ * },
52
+ * urgency: {
53
+ * type: 'score',
54
+ * instructions: 'Rate operational urgency.',
55
+ * criteria: ['Low', 'Normal', 'High', 'Critical'],
56
+ * },
57
+ * },
58
+ * state:
59
+ * 'Our production calls are failing. Every customer is affected.',
60
+ * });
61
+ * ```
62
+ */
63
+ systemone(body: V1SystemoneParams, options?: RequestOptions): APIPromise<V1SystemoneResponse> {
64
+ return this._client.post('/ai/typesafe/v1/systemone', { body, ...options });
65
+ }
66
+ }
67
+
68
+ /**
69
+ * A complete synchronous evaluation. Answers are returned directly without a data
70
+ * wrapper.
71
+ */
72
+ export interface V1SystemoneResponse {
73
+ /**
74
+ * Answers keyed by exactly the question IDs in the request. Each answer type
75
+ * matches its question.
76
+ */
77
+ answers: {
78
+ [key: string]:
79
+ | V1SystemoneResponse.DecisionModelChoiceAnswer
80
+ | V1SystemoneResponse.DecisionModelNoulAnswer
81
+ | V1SystemoneResponse.DecisionModelScoreAnswer;
82
+ };
83
+
84
+ /**
85
+ * Opaque Telnyx-controlled identifier retained for TypeSafe SDK response
86
+ * compatibility. It is not a selectable model name or a guarantee of a particular
87
+ * underlying model.
88
+ */
89
+ model: string;
90
+
91
+ /**
92
+ * Token usage for the completed evaluation.
93
+ */
94
+ usage: V1SystemoneResponse.Usage;
95
+ }
96
+
97
+ export namespace V1SystemoneResponse {
98
+ /**
99
+ * A selected option and the distribution across all supplied option keys.
100
+ */
101
+ export interface DecisionModelChoiceAnswer {
102
+ /**
103
+ * The option key with the highest relative score. Ties favor the first option in
104
+ * request order.
105
+ */
106
+ choice: string;
107
+
108
+ /**
109
+ * Normalized entropy confidence: 1 - H(p) / ln(N), where H(p) = -sum(p \* ln(p))
110
+ * and N is the number of options. Zero indicates a uniform distribution; one
111
+ * indicates concentration on one option. This is neither the winning probability
112
+ * nor calibrated correctness.
113
+ */
114
+ confidence: number;
115
+
116
+ /**
117
+ * Relative scores normalized across the supplied options, summing approximately
118
+ * to 1. These are not calibrated probabilities of correctness.
119
+ */
120
+ probabilities: { [key: string]: number };
121
+
122
+ /**
123
+ * Answer type.
124
+ */
125
+ type: 'choice';
126
+ }
127
+
128
+ /**
129
+ * A yes/no score with no separate confidence or probabilities fields.
130
+ */
131
+ export interface DecisionModelNoulAnswer {
132
+ /**
133
+ * Score of the positive outcome. Values near 1 favor yes; values near 0 favor no.
134
+ * This is a number, not a Boolean, and is not calibrated correctness.
135
+ */
136
+ noul: number;
137
+
138
+ /**
139
+ * Answer type.
140
+ */
141
+ type: 'noul';
142
+ }
143
+
144
+ /**
145
+ * An expected rating over the ordered criteria.
146
+ */
147
+ export interface DecisionModelScoreAnswer {
148
+ /**
149
+ * Normalized entropy confidence: 1 - H(p) / ln(N), where H(p) = -sum(p \* ln(p))
150
+ * and N is the number of options. Zero indicates a uniform distribution; one
151
+ * indicates concentration on one option. This is neither the winning probability
152
+ * nor calibrated correctness.
153
+ */
154
+ confidence: number;
155
+
156
+ /**
157
+ * Criterion descriptions keyed by stringified zero-based indices, such as "0",
158
+ * "1", and "2".
159
+ */
160
+ legend: { [key: string]: string };
161
+
162
+ /**
163
+ * Relative scores keyed by the same stringified indices as legend.
164
+ */
165
+ probabilities: { [key: string]: number };
166
+
167
+ /**
168
+ * Expected zero-based criterion index: sum(index \* probability). Ranges from 0 to
169
+ * N-1 for N criteria; fractional values are valid.
170
+ */
171
+ score: number;
172
+
173
+ /**
174
+ * Answer type.
175
+ */
176
+ type: 'score';
177
+ }
178
+
179
+ /**
180
+ * Token usage for the completed evaluation.
181
+ */
182
+ export interface Usage {
183
+ /**
184
+ * Input tokens processed, including shared-context preparation and question
185
+ * evaluation. This can exceed the token count of the unique input text.
186
+ */
187
+ input_tokens: number;
188
+
189
+ /**
190
+ * Output tokens used for the evaluation, including shared-context preparation.
191
+ */
192
+ output_tokens: number;
193
+ }
194
+ }
195
+
196
+ export interface V1SystemoneParams {
197
+ /**
198
+ * Between 1 and 64 named questions. Each key identifies the corresponding answer.
199
+ */
200
+ questions: {
201
+ [key: string]:
202
+ | V1SystemoneParams.DecisionModelChoiceQuestion
203
+ | V1SystemoneParams.DecisionModelNoulQuestion
204
+ | V1SystemoneParams.DecisionModelScoreQuestion;
205
+ };
206
+
207
+ /**
208
+ * Shared context evaluated by every question.
209
+ */
210
+ state: string | { [key: string]: unknown } | Array<unknown>;
211
+ }
212
+
213
+ export namespace V1SystemoneParams {
214
+ /**
215
+ * Select one of the supplied options.
216
+ */
217
+ export interface DecisionModelChoiceQuestion {
218
+ /**
219
+ * Between 2 and 64 option keys mapped to description strings or null. A null
220
+ * description uses the option key as its text.
221
+ */
222
+ criteria: { [key: string]: string | null };
223
+
224
+ /**
225
+ * Required instructions describing what to decide about the shared state.
226
+ */
227
+ instructions: string | { [key: string]: unknown } | Array<unknown>;
228
+
229
+ /**
230
+ * Question type.
231
+ */
232
+ type: 'choice';
233
+ }
234
+
235
+ /**
236
+ * Evaluate a yes/no question. Omit criteria to use Yes and No descriptions.
237
+ */
238
+ export interface DecisionModelNoulQuestion {
239
+ /**
240
+ * Required instructions describing what to decide about the shared state.
241
+ */
242
+ instructions: string | { [key: string]: unknown } | Array<unknown>;
243
+
244
+ /**
245
+ * Question type.
246
+ */
247
+ type: 'noul';
248
+
249
+ /**
250
+ * Optional descriptions for the positive and negative outcomes. Descriptions must
251
+ * be strings.
252
+ */
253
+ criteria?: DecisionModelNoulQuestion.Criteria;
254
+ }
255
+
256
+ export namespace DecisionModelNoulQuestion {
257
+ /**
258
+ * Optional descriptions for the positive and negative outcomes. Descriptions must
259
+ * be strings.
260
+ */
261
+ export interface Criteria {
262
+ /**
263
+ * Description of the negative outcome.
264
+ */
265
+ false?: string;
266
+
267
+ /**
268
+ * Description of the positive outcome.
269
+ */
270
+ true?: string;
271
+ }
272
+ }
273
+
274
+ /**
275
+ * Rate the state against an ordered rubric.
276
+ */
277
+ export interface DecisionModelScoreQuestion {
278
+ /**
279
+ * Between 2 and 64 description strings in ascending score order. Indices start at
280
+ * zero.
281
+ */
282
+ criteria: Array<string>;
283
+
284
+ /**
285
+ * Required instructions describing what to decide about the shared state.
286
+ */
287
+ instructions: string | { [key: string]: unknown } | Array<unknown>;
288
+
289
+ /**
290
+ * Question type.
291
+ */
292
+ type: 'score';
293
+ }
294
+ }
295
+
296
+ export declare namespace V1 {
297
+ export { type V1SystemoneResponse as V1SystemoneResponse, type V1SystemoneParams as V1SystemoneParams };
298
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './typesafe/index';