@orq-ai/node 2.14.5 → 3.0.0-rc.19

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 (560) hide show
  1. package/FUNCTIONS.md +106 -0
  2. package/README.md +495 -172
  3. package/RUNTIMES.md +22 -0
  4. package/core.d.ts +10 -0
  5. package/core.d.ts.map +1 -0
  6. package/core.js +17 -0
  7. package/core.js.map +1 -0
  8. package/docs/sdks/contacts/README.md +84 -0
  9. package/docs/sdks/deployments/README.md +239 -0
  10. package/docs/sdks/feedback/README.md +92 -0
  11. package/docs/sdks/files/README.md +473 -0
  12. package/docs/sdks/metrics/README.md +86 -0
  13. package/docs/sdks/orq/README.md +10 -0
  14. package/docs/sdks/prompt/README.md +6 -0
  15. package/docs/sdks/prompts/README.md +533 -0
  16. package/docs/sdks/remoteconfig/README.md +80 -0
  17. package/docs/sdks/snippets/README.md +84 -0
  18. package/docs/sdks/templates/README.md +80 -0
  19. package/funcs/contactsCreate.d.ts +15 -0
  20. package/funcs/contactsCreate.d.ts.map +1 -0
  21. package/funcs/contactsCreate.js +106 -0
  22. package/funcs/contactsCreate.js.map +1 -0
  23. package/funcs/deploymentsAll.d.ts +16 -0
  24. package/funcs/deploymentsAll.d.ts.map +1 -0
  25. package/funcs/deploymentsAll.js +114 -0
  26. package/funcs/deploymentsAll.js.map +1 -0
  27. package/funcs/deploymentsGetConfig.d.ts +15 -0
  28. package/funcs/deploymentsGetConfig.d.ts.map +1 -0
  29. package/funcs/deploymentsGetConfig.js +106 -0
  30. package/funcs/deploymentsGetConfig.js.map +1 -0
  31. package/funcs/deploymentsInvoke.d.ts +22 -0
  32. package/funcs/deploymentsInvoke.d.ts.map +1 -0
  33. package/funcs/deploymentsInvoke.js +116 -0
  34. package/funcs/deploymentsInvoke.js.map +1 -0
  35. package/funcs/deploymentsMetricsCreate.d.ts +15 -0
  36. package/funcs/deploymentsMetricsCreate.d.ts.map +1 -0
  37. package/funcs/deploymentsMetricsCreate.js +112 -0
  38. package/funcs/deploymentsMetricsCreate.js.map +1 -0
  39. package/funcs/feedbackCreate.d.ts +15 -0
  40. package/funcs/feedbackCreate.d.ts.map +1 -0
  41. package/funcs/feedbackCreate.js +106 -0
  42. package/funcs/feedbackCreate.js.map +1 -0
  43. package/funcs/filesBulkUpload.d.ts +15 -0
  44. package/funcs/filesBulkUpload.d.ts.map +1 -0
  45. package/funcs/filesBulkUpload.js +107 -0
  46. package/funcs/filesBulkUpload.js.map +1 -0
  47. package/funcs/filesDelete.d.ts +12 -0
  48. package/funcs/filesDelete.d.ts.map +1 -0
  49. package/funcs/filesDelete.js +109 -0
  50. package/funcs/filesDelete.js.map +1 -0
  51. package/funcs/filesGet.d.ts +12 -0
  52. package/funcs/filesGet.d.ts.map +1 -0
  53. package/funcs/filesGet.js +108 -0
  54. package/funcs/filesGet.js.map +1 -0
  55. package/funcs/filesList.d.ts +12 -0
  56. package/funcs/filesList.d.ts.map +1 -0
  57. package/funcs/filesList.js +109 -0
  58. package/funcs/filesList.js.map +1 -0
  59. package/funcs/filesUpdate.d.ts +12 -0
  60. package/funcs/filesUpdate.d.ts.map +1 -0
  61. package/funcs/filesUpdate.js +109 -0
  62. package/funcs/filesUpdate.js.map +1 -0
  63. package/funcs/filesUpload.d.ts +15 -0
  64. package/funcs/filesUpload.d.ts.map +1 -0
  65. package/funcs/filesUpload.js +123 -0
  66. package/funcs/filesUpload.js.map +1 -0
  67. package/funcs/promptSnippetsFindOne.d.ts +12 -0
  68. package/funcs/promptSnippetsFindOne.d.ts.map +1 -0
  69. package/funcs/promptSnippetsFindOne.js +108 -0
  70. package/funcs/promptSnippetsFindOne.js.map +1 -0
  71. package/funcs/promptTemplatesGetAll.d.ts +12 -0
  72. package/funcs/promptTemplatesGetAll.d.ts.map +1 -0
  73. package/funcs/promptTemplatesGetAll.js +108 -0
  74. package/funcs/promptTemplatesGetAll.js.map +1 -0
  75. package/funcs/promptsCreate.d.ts +12 -0
  76. package/funcs/promptsCreate.d.ts.map +1 -0
  77. package/funcs/promptsCreate.js +105 -0
  78. package/funcs/promptsCreate.js.map +1 -0
  79. package/funcs/promptsCreateVersion.d.ts +12 -0
  80. package/funcs/promptsCreateVersion.d.ts.map +1 -0
  81. package/funcs/promptsCreateVersion.js +109 -0
  82. package/funcs/promptsCreateVersion.js.map +1 -0
  83. package/funcs/promptsDelete.d.ts +12 -0
  84. package/funcs/promptsDelete.d.ts.map +1 -0
  85. package/funcs/promptsDelete.js +109 -0
  86. package/funcs/promptsDelete.js.map +1 -0
  87. package/funcs/promptsDuplicate.d.ts +12 -0
  88. package/funcs/promptsDuplicate.d.ts.map +1 -0
  89. package/funcs/promptsDuplicate.js +109 -0
  90. package/funcs/promptsDuplicate.js.map +1 -0
  91. package/funcs/promptsGetAll.d.ts +12 -0
  92. package/funcs/promptsGetAll.d.ts.map +1 -0
  93. package/funcs/promptsGetAll.js +105 -0
  94. package/funcs/promptsGetAll.js.map +1 -0
  95. package/funcs/promptsGetOne.d.ts +12 -0
  96. package/funcs/promptsGetOne.d.ts.map +1 -0
  97. package/funcs/promptsGetOne.js +109 -0
  98. package/funcs/promptsGetOne.js.map +1 -0
  99. package/funcs/promptsUpdate.d.ts +13 -0
  100. package/funcs/promptsUpdate.d.ts.map +1 -0
  101. package/funcs/promptsUpdate.js +113 -0
  102. package/funcs/promptsUpdate.js.map +1 -0
  103. package/funcs/remoteconfigGetConfig.d.ts +12 -0
  104. package/funcs/remoteconfigGetConfig.d.ts.map +1 -0
  105. package/funcs/remoteconfigGetConfig.js +106 -0
  106. package/funcs/remoteconfigGetConfig.js.map +1 -0
  107. package/hooks/hooks.d.ts +24 -0
  108. package/hooks/hooks.d.ts.map +1 -0
  109. package/hooks/hooks.js +86 -0
  110. package/hooks/hooks.js.map +1 -0
  111. package/hooks/index.d.ts +3 -0
  112. package/hooks/index.d.ts.map +1 -0
  113. package/hooks/index.js +22 -0
  114. package/hooks/index.js.map +1 -0
  115. package/hooks/registration.d.ts +3 -0
  116. package/hooks/registration.d.ts.map +1 -0
  117. package/hooks/registration.js +15 -0
  118. package/hooks/registration.js.map +1 -0
  119. package/hooks/types.d.ts +77 -0
  120. package/hooks/types.d.ts.map +1 -0
  121. package/hooks/types.js +6 -0
  122. package/hooks/types.js.map +1 -0
  123. package/index.d.ts +4 -0
  124. package/index.d.ts.map +1 -0
  125. package/index.js +46 -0
  126. package/index.js.map +1 -0
  127. package/lib/base64.d.ts +10 -0
  128. package/lib/base64.d.ts.map +1 -0
  129. package/lib/base64.js +71 -0
  130. package/lib/base64.js.map +1 -0
  131. package/lib/config.d.ts +34 -0
  132. package/lib/config.d.ts.map +1 -0
  133. package/lib/config.js +36 -0
  134. package/lib/config.js.map +1 -0
  135. package/lib/dlv.d.ts +14 -0
  136. package/lib/dlv.d.ts.map +1 -0
  137. package/lib/dlv.js +49 -0
  138. package/lib/dlv.js.map +1 -0
  139. package/lib/encodings.d.ts +51 -0
  140. package/lib/encodings.d.ts.map +1 -0
  141. package/lib/encodings.js +343 -0
  142. package/lib/encodings.js.map +1 -0
  143. package/lib/env.d.ts +15 -0
  144. package/lib/env.d.ts.map +1 -0
  145. package/lib/env.js +66 -0
  146. package/lib/env.js.map +1 -0
  147. package/lib/event-streams.d.ts +17 -0
  148. package/lib/event-streams.d.ts.map +1 -0
  149. package/lib/event-streams.js +221 -0
  150. package/lib/event-streams.js.map +1 -0
  151. package/lib/files.d.ts +8 -0
  152. package/lib/files.d.ts.map +1 -0
  153. package/lib/files.js +36 -0
  154. package/lib/files.js.map +1 -0
  155. package/lib/http.d.ts +67 -0
  156. package/lib/http.d.ts.map +1 -0
  157. package/lib/http.js +218 -0
  158. package/lib/http.js.map +1 -0
  159. package/lib/is-plain-object.d.ts +2 -0
  160. package/lib/is-plain-object.d.ts.map +1 -0
  161. package/lib/is-plain-object.js +41 -0
  162. package/lib/is-plain-object.js.map +1 -0
  163. package/lib/logger.d.ts +6 -0
  164. package/lib/logger.d.ts.map +1 -0
  165. package/lib/logger.js +6 -0
  166. package/lib/logger.js.map +1 -0
  167. package/lib/matchers.d.ts +64 -0
  168. package/lib/matchers.d.ts.map +1 -0
  169. package/lib/matchers.js +208 -0
  170. package/lib/matchers.js.map +1 -0
  171. package/lib/primitives.d.ts +22 -0
  172. package/lib/primitives.d.ts.map +1 -0
  173. package/lib/primitives.js +94 -0
  174. package/lib/primitives.js.map +1 -0
  175. package/lib/retries.d.ts +38 -0
  176. package/lib/retries.d.ts.map +1 -0
  177. package/lib/retries.js +155 -0
  178. package/lib/retries.js.map +1 -0
  179. package/lib/schemas.d.ts +19 -0
  180. package/lib/schemas.d.ts.map +1 -0
  181. package/lib/schemas.js +59 -0
  182. package/lib/schemas.js.map +1 -0
  183. package/lib/sdks.d.ts +60 -0
  184. package/lib/sdks.d.ts.map +1 -0
  185. package/lib/sdks.js +278 -0
  186. package/lib/sdks.js.map +1 -0
  187. package/lib/security.d.ts +82 -0
  188. package/lib/security.d.ts.map +1 -0
  189. package/lib/security.js +140 -0
  190. package/lib/security.js.map +1 -0
  191. package/lib/url.d.ts +5 -0
  192. package/lib/url.d.ts.map +1 -0
  193. package/lib/url.js +25 -0
  194. package/lib/url.js.map +1 -0
  195. package/models/components/deployments.d.ts +920 -0
  196. package/models/components/deployments.d.ts.map +1 -0
  197. package/models/components/deployments.js +948 -0
  198. package/models/components/deployments.js.map +1 -0
  199. package/models/components/index.d.ts +3 -0
  200. package/models/components/index.d.ts.map +1 -0
  201. package/models/components/index.js +22 -0
  202. package/models/components/index.js.map +1 -0
  203. package/models/components/security.d.ts +29 -0
  204. package/models/components/security.d.ts.map +1 -0
  205. package/models/components/security.js +78 -0
  206. package/models/components/security.js.map +1 -0
  207. package/models/errors/apierror.d.ts +8 -0
  208. package/models/errors/apierror.d.ts.map +1 -0
  209. package/models/errors/apierror.js +21 -0
  210. package/models/errors/apierror.js.map +1 -0
  211. package/models/errors/honoapierror.d.ts +42 -0
  212. package/models/errors/honoapierror.d.ts.map +1 -0
  213. package/models/errors/honoapierror.js +80 -0
  214. package/models/errors/honoapierror.js.map +1 -0
  215. package/models/errors/httpclienterrors.d.ts +44 -0
  216. package/models/errors/httpclienterrors.d.ts.map +1 -0
  217. package/models/errors/httpclienterrors.js +78 -0
  218. package/models/errors/httpclienterrors.js.map +1 -0
  219. package/models/errors/index.d.ts +6 -0
  220. package/models/errors/index.d.ts.map +1 -0
  221. package/models/errors/index.js +25 -0
  222. package/models/errors/index.js.map +1 -0
  223. package/models/errors/sdkvalidationerror.d.ts +20 -0
  224. package/models/errors/sdkvalidationerror.d.ts.map +1 -0
  225. package/models/errors/sdkvalidationerror.js +115 -0
  226. package/models/errors/sdkvalidationerror.js.map +1 -0
  227. package/models/errors/updateprompt.d.ts +36 -0
  228. package/models/errors/updateprompt.d.ts.map +1 -0
  229. package/models/errors/updateprompt.js +79 -0
  230. package/models/errors/updateprompt.js.map +1 -0
  231. package/models/operations/bulkfileupload.d.ts +173 -0
  232. package/models/operations/bulkfileupload.d.ts.map +1 -0
  233. package/models/operations/bulkfileupload.js +210 -0
  234. package/models/operations/bulkfileupload.js.map +1 -0
  235. package/models/operations/createcontact.d.ts +139 -0
  236. package/models/operations/createcontact.d.ts.map +1 -0
  237. package/models/operations/createcontact.js +149 -0
  238. package/models/operations/createcontact.js.map +1 -0
  239. package/models/operations/createfeedback.d.ts +136 -0
  240. package/models/operations/createfeedback.d.ts.map +1 -0
  241. package/models/operations/createfeedback.js +172 -0
  242. package/models/operations/createfeedback.js.map +1 -0
  243. package/models/operations/createprompt.d.ts +2035 -0
  244. package/models/operations/createprompt.d.ts.map +1 -0
  245. package/models/operations/createprompt.js +1853 -0
  246. package/models/operations/createprompt.js.map +1 -0
  247. package/models/operations/createpromptversion.d.ts +2003 -0
  248. package/models/operations/createpromptversion.d.ts.map +1 -0
  249. package/models/operations/createpromptversion.js +1852 -0
  250. package/models/operations/createpromptversion.js.map +1 -0
  251. package/models/operations/deleteprompt.d.ts +32 -0
  252. package/models/operations/deleteprompt.d.ts.map +1 -0
  253. package/models/operations/deleteprompt.js +69 -0
  254. package/models/operations/deleteprompt.js.map +1 -0
  255. package/models/operations/deploymentcreatemetric.d.ts +957 -0
  256. package/models/operations/deploymentcreatemetric.d.ts.map +1 -0
  257. package/models/operations/deploymentcreatemetric.js +954 -0
  258. package/models/operations/deploymentcreatemetric.js.map +1 -0
  259. package/models/operations/deploymentgetconfig.d.ts +1885 -0
  260. package/models/operations/deploymentgetconfig.d.ts.map +1 -0
  261. package/models/operations/deploymentgetconfig.js +1782 -0
  262. package/models/operations/deploymentgetconfig.js.map +1 -0
  263. package/models/operations/deploymentinvoke.d.ts +1350 -0
  264. package/models/operations/deploymentinvoke.d.ts.map +1 -0
  265. package/models/operations/deploymentinvoke.js +1210 -0
  266. package/models/operations/deploymentinvoke.js.map +1 -0
  267. package/models/operations/deployments.d.ts +1233 -0
  268. package/models/operations/deployments.d.ts.map +1 -0
  269. package/models/operations/deployments.js +1111 -0
  270. package/models/operations/deployments.js.map +1 -0
  271. package/models/operations/duplicateprompt.d.ts +32 -0
  272. package/models/operations/duplicateprompt.d.ts.map +1 -0
  273. package/models/operations/duplicateprompt.js +69 -0
  274. package/models/operations/duplicateprompt.js.map +1 -0
  275. package/models/operations/filedelete.d.ts +32 -0
  276. package/models/operations/filedelete.d.ts.map +1 -0
  277. package/models/operations/filedelete.js +78 -0
  278. package/models/operations/filedelete.js.map +1 -0
  279. package/models/operations/fileget.d.ts +116 -0
  280. package/models/operations/fileget.d.ts.map +1 -0
  281. package/models/operations/fileget.js +154 -0
  282. package/models/operations/fileget.js.map +1 -0
  283. package/models/operations/filelist.d.ts +174 -0
  284. package/models/operations/filelist.d.ts.map +1 -0
  285. package/models/operations/filelist.js +217 -0
  286. package/models/operations/filelist.js.map +1 -0
  287. package/models/operations/fileupdate.d.ts +143 -0
  288. package/models/operations/fileupdate.d.ts.map +1 -0
  289. package/models/operations/fileupdate.js +193 -0
  290. package/models/operations/fileupdate.js.map +1 -0
  291. package/models/operations/fileupload.d.ts +179 -0
  292. package/models/operations/fileupload.d.ts.map +1 -0
  293. package/models/operations/fileupload.js +212 -0
  294. package/models/operations/fileupload.js.map +1 -0
  295. package/models/operations/findonepromptsnippet.d.ts +6278 -0
  296. package/models/operations/findonepromptsnippet.d.ts.map +1 -0
  297. package/models/operations/findonepromptsnippet.js +5891 -0
  298. package/models/operations/findonepromptsnippet.js.map +1 -0
  299. package/models/operations/getallprompts.d.ts +10675 -0
  300. package/models/operations/getallprompts.d.ts.map +1 -0
  301. package/models/operations/getallprompts.js +9398 -0
  302. package/models/operations/getallprompts.js.map +1 -0
  303. package/models/operations/getallprompttemplates.d.ts +6607 -0
  304. package/models/operations/getallprompttemplates.d.ts.map +1 -0
  305. package/models/operations/getallprompttemplates.js +6225 -0
  306. package/models/operations/getallprompttemplates.js.map +1 -0
  307. package/models/operations/getoneprompt.d.ts +32 -0
  308. package/models/operations/getoneprompt.d.ts.map +1 -0
  309. package/models/operations/getoneprompt.js +69 -0
  310. package/models/operations/getoneprompt.js.map +1 -0
  311. package/models/operations/index.d.ts +23 -0
  312. package/models/operations/index.d.ts.map +1 -0
  313. package/models/operations/index.js +42 -0
  314. package/models/operations/index.js.map +1 -0
  315. package/models/operations/remoteconfigsgetconfig.d.ts +121 -0
  316. package/models/operations/remoteconfigsgetconfig.d.ts.map +1 -0
  317. package/models/operations/remoteconfigsgetconfig.js +126 -0
  318. package/models/operations/remoteconfigsgetconfig.js.map +1 -0
  319. package/models/operations/updateprompt.d.ts +7251 -0
  320. package/models/operations/updateprompt.d.ts.map +1 -0
  321. package/models/operations/updateprompt.js +6678 -0
  322. package/models/operations/updateprompt.js.map +1 -0
  323. package/package.json +26 -24
  324. package/sdk/contacts.d.ts +12 -0
  325. package/sdk/contacts.d.ts.map +1 -0
  326. package/sdk/contacts.js +22 -0
  327. package/sdk/contacts.js.map +1 -0
  328. package/sdk/deployments.d.ts +34 -0
  329. package/sdk/deployments.d.ts.map +1 -0
  330. package/sdk/deployments.js +49 -0
  331. package/sdk/deployments.js.map +1 -0
  332. package/sdk/feedback.d.ts +12 -0
  333. package/sdk/feedback.d.ts.map +1 -0
  334. package/sdk/feedback.js +22 -0
  335. package/sdk/feedback.js.map +1 -0
  336. package/sdk/files.d.ts +35 -0
  337. package/sdk/files.d.ts.map +1 -0
  338. package/sdk/files.js +60 -0
  339. package/sdk/files.js.map +1 -0
  340. package/sdk/index.d.ts +2 -0
  341. package/sdk/index.d.ts.map +1 -0
  342. package/sdk/index.js +21 -0
  343. package/sdk/index.js.map +1 -0
  344. package/sdk/metrics.d.ts +12 -0
  345. package/sdk/metrics.d.ts.map +1 -0
  346. package/sdk/metrics.js +22 -0
  347. package/sdk/metrics.js.map +1 -0
  348. package/sdk/prompt.d.ts +10 -0
  349. package/sdk/prompt.d.ts.map +1 -0
  350. package/sdk/prompt.js +21 -0
  351. package/sdk/prompt.js.map +1 -0
  352. package/sdk/prompts.d.ts +33 -0
  353. package/sdk/prompts.d.ts.map +1 -0
  354. package/sdk/prompts.js +61 -0
  355. package/sdk/prompts.js.map +1 -0
  356. package/sdk/remoteconfig.d.ts +9 -0
  357. package/sdk/remoteconfig.d.ts.map +1 -0
  358. package/sdk/remoteconfig.js +19 -0
  359. package/sdk/remoteconfig.js.map +1 -0
  360. package/sdk/sdk.d.ts +25 -0
  361. package/sdk/sdk.d.ts.map +1 -0
  362. package/sdk/sdk.js +46 -0
  363. package/sdk/sdk.js.map +1 -0
  364. package/sdk/snippets.d.ts +9 -0
  365. package/sdk/snippets.d.ts.map +1 -0
  366. package/sdk/snippets.js +19 -0
  367. package/sdk/snippets.js.map +1 -0
  368. package/sdk/templates.d.ts +9 -0
  369. package/sdk/templates.d.ts.map +1 -0
  370. package/sdk/templates.js +19 -0
  371. package/sdk/templates.js.map +1 -0
  372. package/src/core.ts +13 -0
  373. package/src/funcs/contactsCreate.ts +124 -0
  374. package/src/funcs/deploymentsAll.ts +138 -0
  375. package/src/funcs/deploymentsGetConfig.ts +132 -0
  376. package/src/funcs/deploymentsInvoke.ts +135 -0
  377. package/src/funcs/deploymentsMetricsCreate.ts +132 -0
  378. package/src/funcs/feedbackCreate.ts +124 -0
  379. package/src/funcs/filesBulkUpload.ts +126 -0
  380. package/src/funcs/filesDelete.ts +128 -0
  381. package/src/funcs/filesGet.ts +127 -0
  382. package/src/funcs/filesList.ts +129 -0
  383. package/src/funcs/filesUpdate.ts +128 -0
  384. package/src/funcs/filesUpload.ts +145 -0
  385. package/src/funcs/promptSnippetsFindOne.ts +128 -0
  386. package/src/funcs/promptTemplatesGetAll.ts +130 -0
  387. package/src/funcs/promptsCreate.ts +124 -0
  388. package/src/funcs/promptsCreateVersion.ts +129 -0
  389. package/src/funcs/promptsDelete.ts +128 -0
  390. package/src/funcs/promptsDuplicate.ts +128 -0
  391. package/src/funcs/promptsGetAll.ts +126 -0
  392. package/src/funcs/promptsGetOne.ts +128 -0
  393. package/src/funcs/promptsUpdate.ts +136 -0
  394. package/src/funcs/remoteconfigGetConfig.ts +125 -0
  395. package/src/hooks/hooks.ts +132 -0
  396. package/src/hooks/index.ts +6 -0
  397. package/src/hooks/registration.ts +14 -0
  398. package/src/hooks/types.ts +109 -0
  399. package/src/index.ts +7 -0
  400. package/src/lib/base64.ts +37 -0
  401. package/src/lib/config.ts +60 -0
  402. package/src/lib/dlv.ts +53 -0
  403. package/src/lib/encodings.ts +449 -0
  404. package/src/lib/env.ts +41 -0
  405. package/src/lib/event-streams.ts +264 -0
  406. package/src/lib/files.ts +40 -0
  407. package/src/lib/http.ts +323 -0
  408. package/src/lib/is-plain-object.ts +43 -0
  409. package/src/lib/logger.ts +9 -0
  410. package/src/lib/matchers.ts +325 -0
  411. package/src/lib/primitives.ts +122 -0
  412. package/src/lib/retries.ts +219 -0
  413. package/src/lib/schemas.ts +86 -0
  414. package/src/lib/sdks.ts +397 -0
  415. package/src/lib/security.ts +254 -0
  416. package/src/lib/url.ts +33 -0
  417. package/src/models/components/deployments.ts +1673 -0
  418. package/src/models/components/index.ts +6 -0
  419. package/src/models/components/security.ts +71 -0
  420. package/src/models/errors/apierror.ts +27 -0
  421. package/src/models/errors/honoapierror.ts +82 -0
  422. package/src/models/errors/httpclienterrors.ts +62 -0
  423. package/src/models/errors/index.ts +9 -0
  424. package/src/models/errors/sdkvalidationerror.ts +97 -0
  425. package/src/models/errors/updateprompt.ts +71 -0
  426. package/src/models/operations/bulkfileupload.ts +315 -0
  427. package/src/models/operations/createcontact.ts +256 -0
  428. package/src/models/operations/createfeedback.ts +286 -0
  429. package/src/models/operations/createprompt.ts +3461 -0
  430. package/src/models/operations/createpromptversion.ts +3703 -0
  431. package/src/models/operations/deleteprompt.ts +69 -0
  432. package/src/models/operations/deploymentcreatemetric.ts +1790 -0
  433. package/src/models/operations/deploymentgetconfig.ts +3483 -0
  434. package/src/models/operations/deploymentinvoke.ts +2385 -0
  435. package/src/models/operations/deployments.ts +2098 -0
  436. package/src/models/operations/duplicateprompt.ts +69 -0
  437. package/src/models/operations/filedelete.ts +78 -0
  438. package/src/models/operations/fileget.ts +222 -0
  439. package/src/models/operations/filelist.ts +333 -0
  440. package/src/models/operations/fileupdate.ts +298 -0
  441. package/src/models/operations/fileupload.ts +322 -0
  442. package/src/models/operations/findonepromptsnippet.ts +13629 -0
  443. package/src/models/operations/getallprompts.ts +18640 -0
  444. package/src/models/operations/getallprompttemplates.ts +13690 -0
  445. package/src/models/operations/getoneprompt.ts +69 -0
  446. package/src/models/operations/index.ts +26 -0
  447. package/src/models/operations/remoteconfigsgetconfig.ts +190 -0
  448. package/src/models/operations/updateprompt.ts +14407 -0
  449. package/src/sdk/contacts.ts +27 -0
  450. package/src/sdk/deployments.ts +75 -0
  451. package/src/sdk/feedback.ts +27 -0
  452. package/src/sdk/files.ts +105 -0
  453. package/src/sdk/index.ts +5 -0
  454. package/src/sdk/metrics.ts +27 -0
  455. package/src/sdk/prompt.ts +19 -0
  456. package/src/sdk/prompts.ts +114 -0
  457. package/src/sdk/remoteconfig.ts +24 -0
  458. package/src/sdk/sdk.ts +49 -0
  459. package/src/sdk/snippets.ts +24 -0
  460. package/src/sdk/templates.ts +24 -0
  461. package/src/types/blobs.ts +31 -0
  462. package/src/types/constdatetime.ts +15 -0
  463. package/src/types/enums.ts +16 -0
  464. package/src/types/fp.ts +50 -0
  465. package/src/types/index.ts +11 -0
  466. package/src/types/operations.ts +105 -0
  467. package/src/types/rfcdate.ts +54 -0
  468. package/src/types/streams.ts +21 -0
  469. package/types/blobs.d.ts +4 -0
  470. package/types/blobs.d.ts.map +1 -0
  471. package/types/blobs.js +62 -0
  472. package/types/blobs.js.map +1 -0
  473. package/types/constdatetime.d.ts +3 -0
  474. package/types/constdatetime.d.ts.map +1 -0
  475. package/types/constdatetime.js +46 -0
  476. package/types/constdatetime.js.map +1 -0
  477. package/types/enums.d.ts +12 -0
  478. package/types/enums.d.ts.map +1 -0
  479. package/types/enums.js +10 -0
  480. package/types/enums.js.map +1 -0
  481. package/types/fp.d.ts +31 -0
  482. package/types/fp.d.ts.map +1 -0
  483. package/types/fp.js +37 -0
  484. package/types/fp.js.map +1 -0
  485. package/types/index.d.ts +8 -0
  486. package/types/index.d.ts.map +1 -0
  487. package/types/index.js +16 -0
  488. package/types/index.js.map +1 -0
  489. package/types/operations.d.ts +27 -0
  490. package/types/operations.d.ts.map +1 -0
  491. package/types/operations.js +83 -0
  492. package/types/operations.js.map +1 -0
  493. package/types/rfcdate.d.ts +21 -0
  494. package/types/rfcdate.d.ts.map +1 -0
  495. package/types/rfcdate.js +46 -0
  496. package/types/rfcdate.js.map +1 -0
  497. package/types/streams.d.ts +2 -0
  498. package/types/streams.d.ts.map +1 -0
  499. package/types/streams.js +18 -0
  500. package/types/streams.js.map +1 -0
  501. package/src/index.d.ts +0 -3
  502. package/src/index.js +0 -7
  503. package/src/index.js.map +0 -1
  504. package/src/lib/api/contacts/index.d.ts +0 -9
  505. package/src/lib/api/contacts/index.js +0 -25
  506. package/src/lib/api/contacts/index.js.map +0 -1
  507. package/src/lib/api/deployments.d.ts +0 -45
  508. package/src/lib/api/deployments.js +0 -172
  509. package/src/lib/api/deployments.js.map +0 -1
  510. package/src/lib/api/feedback/feedback.d.ts +0 -20
  511. package/src/lib/api/feedback/feedback.js +0 -51
  512. package/src/lib/api/feedback/feedback.js.map +0 -1
  513. package/src/lib/api/feedback/index.d.ts +0 -1
  514. package/src/lib/api/feedback/index.js +0 -5
  515. package/src/lib/api/feedback/index.js.map +0 -1
  516. package/src/lib/api/index.d.ts +0 -1
  517. package/src/lib/api/index.js +0 -5
  518. package/src/lib/api/index.js.map +0 -1
  519. package/src/lib/api/webhooks/index.d.ts +0 -1
  520. package/src/lib/api/webhooks/index.js +0 -5
  521. package/src/lib/api/webhooks/index.js.map +0 -1
  522. package/src/lib/api/webhooks/webhooks.d.ts +0 -14
  523. package/src/lib/api/webhooks/webhooks.js +0 -40
  524. package/src/lib/api/webhooks/webhooks.js.map +0 -1
  525. package/src/lib/client.d.ts +0 -17
  526. package/src/lib/client.js +0 -47
  527. package/src/lib/client.js.map +0 -1
  528. package/src/lib/exceptions/index.d.ts +0 -9
  529. package/src/lib/exceptions/index.js +0 -31
  530. package/src/lib/exceptions/index.js.map +0 -1
  531. package/src/lib/http/index.d.ts +0 -7
  532. package/src/lib/http/index.js +0 -15
  533. package/src/lib/http/index.js.map +0 -1
  534. package/src/lib/models/contacts.d.ts +0 -8
  535. package/src/lib/models/contacts.js +0 -3
  536. package/src/lib/models/contacts.js.map +0 -1
  537. package/src/lib/models/deployments.d.ts +0 -167
  538. package/src/lib/models/deployments.js +0 -40
  539. package/src/lib/models/deployments.js.map +0 -1
  540. package/src/lib/models/feedback.models.d.ts +0 -23
  541. package/src/lib/models/feedback.models.js +0 -3
  542. package/src/lib/models/feedback.models.js.map +0 -1
  543. package/src/lib/models/index.d.ts +0 -6
  544. package/src/lib/models/index.js +0 -10
  545. package/src/lib/models/index.js.map +0 -1
  546. package/src/lib/models/options.d.ts +0 -13
  547. package/src/lib/models/options.js +0 -3
  548. package/src/lib/models/options.js.map +0 -1
  549. package/src/lib/models/user-info.d.ts +0 -3
  550. package/src/lib/models/user-info.js +0 -3
  551. package/src/lib/models/user-info.js.map +0 -1
  552. package/src/lib/models/webhooks.d.ts +0 -83
  553. package/src/lib/models/webhooks.js +0 -8
  554. package/src/lib/models/webhooks.js.map +0 -1
  555. package/src/lib/utils/index.d.ts +0 -6
  556. package/src/lib/utils/index.js +0 -51
  557. package/src/lib/utils/index.js.map +0 -1
  558. package/src/lib/version.d.ts +0 -1
  559. package/src/lib/version.js +0 -5
  560. package/src/lib/version.js.map +0 -1
package/README.md CHANGED
@@ -1,241 +1,564 @@
1
- <p align="left">
2
- <a href="https://orq.ai" target="_blank">
3
- <img src="https://asset.brandfetch.io/idtBhDRr2x/idcrPsCm4K.png" alt="Orq">
4
- </a>
5
- </p>
1
+ # @orq-ai/node
6
2
 
7
- Build AI Applications from Playground to Production
3
+ Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@orq-ai/node* API.
8
4
 
9
- # orq.ai Node SDK
5
+ <div align="left">
6
+ <a href="https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
7
+ <a href="https://opensource.org/licenses/MIT">
8
+ <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
9
+ </a>
10
+ </div>
10
11
 
11
- The orq.ai Node library enables easy orq.ai REST API integration in NodeJS 16+ apps.
12
12
 
13
- # Documentation
13
+ <br /><br />
14
+ > [!IMPORTANT]
15
+ > This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/orq/orq). Delete this section before > publishing to a package manager.
14
16
 
15
- The REST API documentation can be found on [docs.orq.ai](https://docs.orq.ai/reference/authentication).
17
+ <!-- Start Summary [summary] -->
18
+ ## Summary
16
19
 
17
- ## Installation
20
+ [Dev] orq.ai API: The Orquesta API
21
+
22
+ For more information about the API: [orq.ai Documentation](https://docs.orq.ai)
23
+ <!-- End Summary [summary] -->
24
+
25
+ <!-- Start Table of Contents [toc] -->
26
+ ## Table of Contents
27
+ <!-- $toc-max-depth=2 -->
28
+ * [@orq-ai/node](#orq-ainode)
29
+ * [SDK Installation](#sdk-installation)
30
+ * [Requirements](#requirements)
31
+ * [SDK Example Usage](#sdk-example-usage)
32
+ * [Authentication](#authentication)
33
+ * [Available Resources and Operations](#available-resources-and-operations)
34
+ * [Standalone functions](#standalone-functions)
35
+ * [Server-sent event streaming](#server-sent-event-streaming)
36
+ * [File uploads](#file-uploads)
37
+ * [Retries](#retries)
38
+ * [Error Handling](#error-handling)
39
+ * [Server Selection](#server-selection)
40
+ * [Custom HTTP Client](#custom-http-client)
41
+ * [Debugging](#debugging)
42
+ * [Development](#development)
43
+ * [Maturity](#maturity)
44
+ * [Contributions](#contributions)
45
+
46
+ <!-- End Table of Contents [toc] -->
47
+
48
+ <!-- Start SDK Installation [installation] -->
49
+ ## SDK Installation
50
+
51
+ The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
52
+
53
+ ### NPM
54
+
55
+ ```bash
56
+ npm add @orq-ai/node
57
+ ```
58
+
59
+ ### PNPM
60
+
61
+ ```bash
62
+ pnpm add @orq-ai/node
63
+ ```
64
+
65
+ ### Bun
18
66
 
19
67
  ```bash
20
- npm install @orq-ai/node
68
+ bun add @orq-ai/node
21
69
  ```
22
70
 
71
+ ### Yarn
72
+
23
73
  ```bash
24
- yarn add @orq-ai/node
74
+ yarn add @orq-ai/node zod
75
+
76
+ # Note that Yarn does not install peer dependencies automatically. You will need
77
+ # to install zod as shown above.
25
78
  ```
79
+ <!-- End SDK Installation [installation] -->
26
80
 
27
- ## Usage
81
+ <!-- Start Requirements [requirements] -->
82
+ ## Requirements
28
83
 
29
- _You can get your workspace API key from the settings section in your orq.ai workspace. `https://my.orq.ai/<workspace>/settings/developers`_
84
+ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
85
+ <!-- End Requirements [requirements] -->
30
86
 
31
- Initialize the orq.ai client with your API key:
87
+ <!-- Start SDK Example Usage [usage] -->
88
+ ## SDK Example Usage
32
89
 
33
- ```ts
34
- import { createClient } from '@orq-ai/node';
90
+ ### Example
35
91
 
36
- const client = createClient({
37
- apiKey: 'orquesta-api-key',
38
- environment: 'production',
92
+ ```typescript
93
+ import { Orq } from "@orq-ai/node";
94
+
95
+ const orq = new Orq({
96
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
39
97
  });
40
98
 
41
- generation = await client.deployments.invoke(
42
- key: 'customer_service',
43
- context: { environments: 'production', country: 'NLD' },
44
- inputs: { firstname: 'John', city: 'New York' },
45
- metadata: { customer_id: 'Qwtqwty90281' },
46
- );
99
+ async function run() {
100
+ const result = await orq.contacts.create({
101
+ externalId: "<id>",
102
+ });
103
+
104
+ // Handle the result
105
+ console.log(result);
106
+ }
107
+
108
+ run();
109
+
47
110
  ```
111
+ <!-- End SDK Example Usage [usage] -->
112
+
113
+ <!-- Start Authentication [security] -->
114
+ ## Authentication
48
115
 
49
- ## Deployments
116
+ ### Per-Client Security Schemes
50
117
 
51
- The Deployments API delivers text outputs, images or tool calls based on the configuration established within orq.ai for your deployments. Additionally, this API supports streaming. To ensure ease of use and minimize errors, using the code snippets from the orq.ai Admin panel is highly recommended.
118
+ This SDK supports the following security scheme globally:
52
119
 
53
- ### Invoke a deployment
120
+ | Name | Type | Scheme | Environment Variable |
121
+ | -------- | ---- | ----------- | -------------------- |
122
+ | `apiKey` | http | HTTP Bearer | `ORQ_API_KEY` |
54
123
 
55
- #### `invoke()`
124
+ To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
125
+ ```typescript
126
+ import { Orq } from "@orq-ai/node";
56
127
 
57
- ```ts
58
- const generation = await client.deployments.invoke({
59
- key: 'customer_service',
60
- context: { environments: 'production', country: 'NLD' },
61
- inputs: { firstname: 'John', city: 'New York' },
62
- metadata: { customer_id: 'Qwtqwty90281' },
128
+ const orq = new Orq({
129
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
63
130
  });
64
131
 
65
- console.log(generation?.choices[0].message.content);
132
+ async function run() {
133
+ const result = await orq.contacts.create({
134
+ externalId: "<id>",
135
+ });
136
+
137
+ // Handle the result
138
+ console.log(result);
139
+ }
140
+
141
+ run();
142
+
66
143
  ```
144
+ <!-- End Authentication [security] -->
145
+
146
+ <!-- Start Available Resources and Operations [operations] -->
147
+ ## Available Resources and Operations
148
+
149
+ <details open>
150
+ <summary>Available methods</summary>
151
+
152
+ ### [contacts](docs/sdks/contacts/README.md)
153
+
154
+ * [create](docs/sdks/contacts/README.md#create) - Update user information
155
+
156
+ ### [deployments](docs/sdks/deployments/README.md)
157
+
158
+ * [all](docs/sdks/deployments/README.md#all) - List all deployments
159
+ * [getConfig](docs/sdks/deployments/README.md#getconfig) - Get config
160
+ * [invoke](docs/sdks/deployments/README.md#invoke) - Invoke
67
161
 
68
- #### `invoke_with_stream()`
162
+ #### [deployments.metrics](docs/sdks/metrics/README.md)
69
163
 
70
- ```ts
71
- const deployment = await client.deployments.invoke({
72
- key: 'customer_service',
73
- context: { environments: 'production', country: 'NLD' },
74
- inputs: { firstname: 'John', city: 'New York' },
75
- metadata: { customer_id: 'Qwtqwty90281' },
164
+ * [create](docs/sdks/metrics/README.md#create) - Add metrics
165
+
166
+ ### [feedback](docs/sdks/feedback/README.md)
167
+
168
+ * [create](docs/sdks/feedback/README.md#create) - Submit feedback
169
+
170
+ ### [files](docs/sdks/files/README.md)
171
+
172
+ * [upload](docs/sdks/files/README.md#upload) - Upload file
173
+ * [list](docs/sdks/files/README.md#list) - List all files
174
+ * [get](docs/sdks/files/README.md#get) - Get file by ID
175
+ * [update](docs/sdks/files/README.md#update) - Update file name
176
+ * [delete](docs/sdks/files/README.md#delete) - Delete file
177
+ * [bulkUpload](docs/sdks/files/README.md#bulkupload) - Bulk upload file
178
+
179
+
180
+ ### [prompt](docs/sdks/prompt/README.md)
181
+
182
+
183
+ #### [prompt.snippets](docs/sdks/snippets/README.md)
184
+
185
+ * [findOne](docs/sdks/snippets/README.md#findone) - Get one prompt snippet
186
+
187
+ #### [prompt.templates](docs/sdks/templates/README.md)
188
+
189
+ * [getAll](docs/sdks/templates/README.md#getall) - Get all prompt templates
190
+
191
+ ### [prompts](docs/sdks/prompts/README.md)
192
+
193
+ * [create](docs/sdks/prompts/README.md#create) - Create a new prompt
194
+ * [createVersion](docs/sdks/prompts/README.md#createversion) - Create a new prompt version
195
+ * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
196
+ * [getOne](docs/sdks/prompts/README.md#getone) - Get one prompt
197
+ * [update](docs/sdks/prompts/README.md#update) - Update a prompt
198
+ * [duplicate](docs/sdks/prompts/README.md#duplicate) - Duplicate a prompt
199
+ * [getAll](docs/sdks/prompts/README.md#getall) - Get all prompts
200
+
201
+ ### [remoteconfig](docs/sdks/remoteconfig/README.md)
202
+
203
+ * [getConfig](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
204
+
205
+ </details>
206
+ <!-- End Available Resources and Operations [operations] -->
207
+
208
+ <!-- Start Standalone functions [standalone-funcs] -->
209
+ ## Standalone functions
210
+
211
+ All the methods listed above are available as standalone functions. These
212
+ functions are ideal for use in applications running in the browser, serverless
213
+ runtimes or other environments where application bundle size is a primary
214
+ concern. When using a bundler to build your application, all unused
215
+ functionality will be either excluded from the final bundle or tree-shaken away.
216
+
217
+ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
218
+
219
+ <details>
220
+
221
+ <summary>Available standalone functions</summary>
222
+
223
+ - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Update user information
224
+ - [`deploymentsAll`](docs/sdks/deployments/README.md#all) - List all deployments
225
+ - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
226
+ - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
227
+ - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
228
+ - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
229
+ - [`filesBulkUpload`](docs/sdks/files/README.md#bulkupload) - Bulk upload file
230
+ - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete file
231
+ - [`filesGet`](docs/sdks/files/README.md#get) - Get file by ID
232
+ - [`filesList`](docs/sdks/files/README.md#list) - List all files
233
+ - [`filesUpdate`](docs/sdks/files/README.md#update) - Update file name
234
+ - [`filesUpload`](docs/sdks/files/README.md#upload) - Upload file
235
+ - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a new prompt
236
+ - [`promptsCreateVersion`](docs/sdks/prompts/README.md#createversion) - Create a new prompt version
237
+ - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
238
+ - [`promptsDuplicate`](docs/sdks/prompts/README.md#duplicate) - Duplicate a prompt
239
+ - [`promptsGetAll`](docs/sdks/prompts/README.md#getall) - Get all prompts
240
+ - [`promptsGetOne`](docs/sdks/prompts/README.md#getone) - Get one prompt
241
+ - [`promptSnippetsFindOne`](docs/sdks/snippets/README.md#findone) - Get one prompt snippet
242
+ - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
243
+ - [`promptTemplatesGetAll`](docs/sdks/templates/README.md#getall) - Get all prompt templates
244
+ - [`remoteconfigGetConfig`](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
245
+
246
+ </details>
247
+ <!-- End Standalone functions [standalone-funcs] -->
248
+
249
+ <!-- Start Server-sent event streaming [eventstream] -->
250
+ ## Server-sent event streaming
251
+
252
+ [Server-sent events][mdn-sse] are used to stream content from certain
253
+ operations. These operations will expose the stream as an async iterable that
254
+ can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
255
+ terminate when the server no longer has any events to send and closes the
256
+ underlying connection.
257
+
258
+ ```typescript
259
+ import { Orq } from "@orq-ai/node";
260
+
261
+ const orq = new Orq({
262
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
76
263
  });
77
264
 
78
- for await (const chunk of stream) {
79
- console.log(chunk.choices[0]?.message.content);
265
+ async function run() {
266
+ const result = await orq.deployments.invoke({
267
+ key: "<key>",
268
+ });
269
+
270
+ for await (const event of result) {
271
+ // Handle the event
272
+ console.log(event);
273
+ }
80
274
  }
275
+
276
+ run();
277
+
81
278
  ```
82
279
 
83
- #### Adding messages as part of your request
280
+ [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
281
+ [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
282
+ <!-- End Server-sent event streaming [eventstream] -->
84
283
 
85
- If you are using the `invoke` method, you can include `messages` in your request to the model. The `messages` property
86
- allows you to combine `chat_history` with the prompt configuration in Orq, or to directly send `messages` to the
87
- model if you are managing the prompt in your code.
284
+ <!-- Start File uploads [file-upload] -->
285
+ ## File uploads
286
+
287
+ Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
288
+
289
+ > [!TIP]
290
+ >
291
+ > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
292
+ >
293
+ > - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
294
+ > - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
295
+ > - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
296
+ > - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
297
+
298
+ ```typescript
299
+ import { Orq } from "@orq-ai/node";
300
+
301
+ const orq = new Orq({
302
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
303
+ });
304
+
305
+ async function run() {
306
+ const result = await orq.files.upload();
307
+
308
+ // Handle the result
309
+ console.log(result);
310
+ }
311
+
312
+ run();
88
313
 
89
- ```ts
90
- generation = await client.deployments.invoke(
91
- key: 'customer_service',
92
- context:{
93
- language: [],
94
- environments: [],
95
- },
96
- metadata: {
97
- 'custom-field-name': 'custom-metadata-value',
98
- },
99
- inputs:{ firstname: 'John', city: 'New York' },
100
- messages: [
101
- {
102
- role: 'user',
103
- content:
104
- 'A customer is asking about the latest software update features. Generate a detailed and informative response highlighting the key new features and improvements in the latest update.',
105
- },
106
- ]
107
- );
108
314
  ```
315
+ <!-- End File uploads [file-upload] -->
316
+
317
+ <!-- Start Retries [retries] -->
318
+ ## Retries
319
+
320
+ Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
321
+
322
+ To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
323
+ ```typescript
324
+ import { Orq } from "@orq-ai/node";
325
+
326
+ const orq = new Orq({
327
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
328
+ });
109
329
 
110
- #### Logging metrics to the deployment configuration
330
+ async function run() {
331
+ const result = await orq.contacts.create({
332
+ externalId: "<id>",
333
+ }, {
334
+ retries: {
335
+ strategy: "backoff",
336
+ backoff: {
337
+ initialInterval: 1,
338
+ maxInterval: 50,
339
+ exponent: 1.1,
340
+ maxElapsedTime: 100,
341
+ },
342
+ retryConnectionErrors: false,
343
+ },
344
+ });
345
+
346
+ // Handle the result
347
+ console.log(result);
348
+ }
111
349
 
112
- After invoking, streaming or getting the configuration of a deployment, you can use the `add_metrics` method to add information to the deployment.
350
+ run();
113
351
 
114
- ```ts
115
- generation.addMetrics({
116
- user_id: 'e3a202a6-461b-447c-abe2-018ba4d04cd0',
117
- feedback: { score: 100 },
118
- metadata: {
119
- custom: 'custom_metadata',
120
- chain_id: 'ad1231xsdaABw',
352
+ ```
353
+
354
+ If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
355
+ ```typescript
356
+ import { Orq } from "@orq-ai/node";
357
+
358
+ const orq = new Orq({
359
+ retryConfig: {
360
+ strategy: "backoff",
361
+ backoff: {
362
+ initialInterval: 1,
363
+ maxInterval: 50,
364
+ exponent: 1.1,
365
+ maxElapsedTime: 100,
366
+ },
367
+ retryConnectionErrors: false,
121
368
  },
369
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
122
370
  });
371
+
372
+ async function run() {
373
+ const result = await orq.contacts.create({
374
+ externalId: "<id>",
375
+ });
376
+
377
+ // Handle the result
378
+ console.log(result);
379
+ }
380
+
381
+ run();
382
+
123
383
  ```
384
+ <!-- End Retries [retries] -->
124
385
 
125
- ### Get deployment configuration
386
+ <!-- Start Error Handling [errors] -->
387
+ ## Error Handling
126
388
 
127
- #### `get_config()`
389
+ Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `all` method may throw the following errors:
128
390
 
129
- ```ts
130
- const deploymentPromptConfig = await client.deployments.getConfig({
131
- key: 'customer_service',
132
- context: { environments: 'production', country: 'NLD' },
133
- inputs: { firstname: 'John', city: 'New York' },
134
- metadata: { customer_id: 'Qwtqwty90281' },
391
+ | Error Type | Status Code | Content Type |
392
+ | ------------------- | ----------- | ---------------- |
393
+ | errors.HonoApiError | 500 | application/json |
394
+ | errors.APIError | 4XX, 5XX | \*/\* |
395
+
396
+ If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
397
+
398
+ ```typescript
399
+ import { Orq } from "@orq-ai/node";
400
+ import { HonoApiError, SDKValidationError } from "@orq-ai/node/models/errors";
401
+
402
+ const orq = new Orq({
403
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
135
404
  });
136
405
 
137
- console.log(deploymentPromptConfig);
406
+ async function run() {
407
+ let result;
408
+ try {
409
+ result = await orq.deployments.all();
410
+
411
+ // Handle the result
412
+ console.log(result);
413
+ } catch (err) {
414
+ switch (true) {
415
+ // The server response does not match the expected SDK schema
416
+ case (err instanceof SDKValidationError): {
417
+ // Pretty-print will provide a human-readable multi-line error message
418
+ console.error(err.pretty());
419
+ // Raw value may also be inspected
420
+ console.error(err.rawValue);
421
+ return;
422
+ }
423
+ case (err instanceof HonoApiError): {
424
+ // Handle err.data$: HonoApiErrorData
425
+ console.error(err);
426
+ return;
427
+ }
428
+ default: {
429
+ // Other errors such as network errors, see HTTPClientErrors for more details
430
+ throw err;
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ run();
437
+
138
438
  ```
139
439
 
140
- #### Logging metrics to the deployment configuration
440
+ Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
141
441
 
142
- After invoking, streaming or getting the configuration of a deployment, you can use the `add_metrics` method to add information to the deployment.
442
+ In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
143
443
 
144
- ```ts
145
- deploymentPromptConfig.addMetrics({
146
- chain_id: 'c4a75b53-62fa-401b-8e97-493f3d299316',
147
- user_id: 'e3a202a6-461b-447c-abe2-018ba4d04cd0',
148
- feedback: { score: 100 },
149
- metadata: {
150
- custom: 'custom_metadata',
151
- chain_id: 'ad1231xsdaABw',
152
- },
153
- usage: {
154
- prompt_tokens: 100,
155
- completion_tokens: 900,
156
- total_tokens: 1000,
157
- },
158
- performance: {
159
- latency: 9000,
160
- time_to_first_token: 250,
161
- },
444
+ | HTTP Client Error | Description |
445
+ | ---------------------------------------------------- | ---------------------------------------------------- |
446
+ | RequestAbortedError | HTTP request was aborted by the client |
447
+ | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
448
+ | ConnectionError | HTTP client was unable to make a request to a server |
449
+ | InvalidRequestError | Any input used to create a request is invalid |
450
+ | UnexpectedClientError | Unrecognised or unexpected error |
451
+ <!-- End Error Handling [errors] -->
452
+
453
+ <!-- Start Server Selection [server] -->
454
+ ## Server Selection
455
+
456
+ ### Override Server URL Per-Client
457
+
458
+ The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
459
+ ```typescript
460
+ import { Orq } from "@orq-ai/node";
461
+
462
+ const orq = new Orq({
463
+ serverURL: "https://my.staging.orq.ai",
464
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
162
465
  });
163
- ```
164
466
 
165
- ### Logging LLM responses
467
+ async function run() {
468
+ const result = await orq.contacts.create({
469
+ externalId: "<id>",
470
+ });
166
471
 
167
- Whether you use the `get_config` or `invoke`, you can log the model generations to the deployment. Here are some
168
- examples of how to do it.
472
+ // Handle the result
473
+ console.log(result);
474
+ }
169
475
 
170
- #### Logging the completion choices the model generated for the input prompt
476
+ run();
171
477
 
172
- ```ts
173
- generation.addMetrics(
174
- choices:[
175
- {
176
- index: 0,
177
- finish_reason: 'assistant',
178
- message: {
179
- role: 'assistant',
180
- content:
181
- "Dear customer: Thank you for your interest in our latest software update! We're excited to share with you the new features and improvements we've rolled out. Here's what you can look forward to in this update",
182
- },
183
- },
184
- ]
185
- );
186
478
  ```
479
+ <!-- End Server Selection [server] -->
480
+
481
+ <!-- Start Custom HTTP Client [http-client] -->
482
+ ## Custom HTTP Client
483
+
484
+ The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
485
+ [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
486
+ client is a thin wrapper around `fetch` and provides the ability to attach hooks
487
+ around the request lifecycle that can be used to modify the request or handle
488
+ errors and response.
489
+
490
+ The `HTTPClient` constructor takes an optional `fetcher` argument that can be
491
+ used to integrate a third-party HTTP client or when writing tests to mock out
492
+ the HTTP client and feed in fixtures.
493
+
494
+ The following example shows how to use the `"beforeRequest"` hook to to add a
495
+ custom header and a timeout to requests and how to use the `"requestError"` hook
496
+ to log errors:
497
+
498
+ ```typescript
499
+ import { Orq } from "@orq-ai/node";
500
+ import { HTTPClient } from "@orq-ai/node/lib/http";
501
+
502
+ const httpClient = new HTTPClient({
503
+ // fetcher takes a function that has the same signature as native `fetch`.
504
+ fetcher: (request) => {
505
+ return fetch(request);
506
+ }
507
+ });
187
508
 
188
- #### Logging the completion choices the model generated for the input prompt
509
+ httpClient.addHook("beforeRequest", (request) => {
510
+ const nextRequest = new Request(request, {
511
+ signal: request.signal || AbortSignal.timeout(5000)
512
+ });
189
513
 
190
- You can save the images generated by the model in Orq. If the image format is `base64` we always store it as
191
- a `png`.
514
+ nextRequest.headers.set("x-custom-header", "custom value");
192
515
 
193
- ```ts
194
- generation.addMetrics(
195
- choices: [
196
- {
197
- index: 0,
198
- finish_reason: 'stop',
199
- message: {
200
- role: 'assistant',
201
- url: '<image_url>',
202
- },
203
- },
204
- ]
205
- );
516
+ return nextRequest;
517
+ });
518
+
519
+ httpClient.addHook("requestError", (error, request) => {
520
+ console.group("Request Error");
521
+ console.log("Reason:", `${error}`);
522
+ console.log("Endpoint:", `${request.method} ${request.url}`);
523
+ console.groupEnd();
524
+ });
525
+
526
+ const sdk = new Orq({ httpClient });
206
527
  ```
528
+ <!-- End Custom HTTP Client [http-client] -->
207
529
 
208
- #### Logging the output of the tool calls
209
-
210
- ```ts
211
- generation.addMetrics(
212
- choices: [
213
- {
214
- index: 0,
215
- message: {
216
- role: 'assistant',
217
- content: None,
218
- tool_calls: [
219
- {
220
- type: 'function',
221
- id: 'call_pDBPMMacPXOtoWhTWibW1D94',
222
- function: {
223
- name: 'get_weather',
224
- arguments: '{"location":"San Francisco, CA"}',
225
- },
226
- },
227
- ],
228
- },
229
- finish_reason: 'tool_calls',
230
- },
231
- ]
232
- );
530
+ <!-- Start Debugging [debug] -->
531
+ ## Debugging
532
+
533
+ You can setup your SDK to emit debug logs for SDK requests and responses.
534
+
535
+ You can pass a logger that matches `console`'s interface as an SDK option.
536
+
537
+ > [!WARNING]
538
+ > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
539
+
540
+ ```typescript
541
+ import { Orq } from "@orq-ai/node";
542
+
543
+ const sdk = new Orq({ debugLogger: console });
233
544
  ```
234
545
 
235
- ### API documentation
546
+ You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
547
+ <!-- End Debugging [debug] -->
548
+
549
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
550
+
551
+ # Development
552
+
553
+ ## Maturity
554
+
555
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
556
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
557
+ looking for the latest version.
236
558
 
237
- [Contacts](https://github.com/orquestadev/orquesta-node/blob/main/orq-ai-sdk/src/lib/api/contacts/README.md)
559
+ ## Contributions
238
560
 
239
- [Feedback](https://github.com/orquestadev/orquesta-node/blob/main/orq-ai-sdk/src/lib/api/feedback/README.md)
561
+ While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
562
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
240
563
 
241
- [Webhooks](https://github.com/orquestadev/orquesta-node/blob/main/orq-ai-sdk/src/lib/api/webhooks/README.md)
564
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)