@orq-ai/node 1.7.0 → 1.31.0-rc.7

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 (504) hide show
  1. package/README.md +491 -171
  2. package/core.d.ts +10 -0
  3. package/core.d.ts.map +1 -0
  4. package/core.js +17 -0
  5. package/core.js.map +1 -0
  6. package/docs/sdks/contacts/README.md +84 -0
  7. package/docs/sdks/deployments/README.md +314 -0
  8. package/docs/sdks/feedback/README.md +92 -0
  9. package/docs/sdks/files/README.md +171 -0
  10. package/docs/sdks/metrics/README.md +86 -0
  11. package/docs/sdks/orq/README.md +10 -0
  12. package/docs/sdks/prompt/README.md +6 -0
  13. package/docs/sdks/prompts/README.md +533 -0
  14. package/docs/sdks/remoteconfig/README.md +80 -0
  15. package/docs/sdks/snippets/README.md +84 -0
  16. package/docs/sdks/templates/README.md +80 -0
  17. package/funcs/contactsCreate.d.ts +15 -0
  18. package/funcs/contactsCreate.d.ts.map +1 -0
  19. package/funcs/contactsCreate.js +105 -0
  20. package/funcs/contactsCreate.js.map +1 -0
  21. package/funcs/deploymentsAll.d.ts +16 -0
  22. package/funcs/deploymentsAll.d.ts.map +1 -0
  23. package/funcs/deploymentsAll.js +113 -0
  24. package/funcs/deploymentsAll.js.map +1 -0
  25. package/funcs/deploymentsGetConfig.d.ts +15 -0
  26. package/funcs/deploymentsGetConfig.d.ts.map +1 -0
  27. package/funcs/deploymentsGetConfig.js +105 -0
  28. package/funcs/deploymentsGetConfig.js.map +1 -0
  29. package/funcs/deploymentsInvalidate.d.ts +15 -0
  30. package/funcs/deploymentsInvalidate.d.ts.map +1 -0
  31. package/funcs/deploymentsInvalidate.js +111 -0
  32. package/funcs/deploymentsInvalidate.js.map +1 -0
  33. package/funcs/deploymentsInvoke.d.ts +22 -0
  34. package/funcs/deploymentsInvoke.d.ts.map +1 -0
  35. package/funcs/deploymentsInvoke.js +115 -0
  36. package/funcs/deploymentsInvoke.js.map +1 -0
  37. package/funcs/deploymentsMetricsCreate.d.ts +15 -0
  38. package/funcs/deploymentsMetricsCreate.d.ts.map +1 -0
  39. package/funcs/deploymentsMetricsCreate.js +111 -0
  40. package/funcs/deploymentsMetricsCreate.js.map +1 -0
  41. package/funcs/feedbackCreate.d.ts +15 -0
  42. package/funcs/feedbackCreate.d.ts.map +1 -0
  43. package/funcs/feedbackCreate.js +105 -0
  44. package/funcs/feedbackCreate.js.map +1 -0
  45. package/funcs/filesBulkUpload.d.ts +15 -0
  46. package/funcs/filesBulkUpload.d.ts.map +1 -0
  47. package/funcs/filesBulkUpload.js +106 -0
  48. package/funcs/filesBulkUpload.js.map +1 -0
  49. package/funcs/filesUpload.d.ts +15 -0
  50. package/funcs/filesUpload.d.ts.map +1 -0
  51. package/funcs/filesUpload.js +122 -0
  52. package/funcs/filesUpload.js.map +1 -0
  53. package/funcs/promptSnippetsFindOne.d.ts +12 -0
  54. package/funcs/promptSnippetsFindOne.d.ts.map +1 -0
  55. package/funcs/promptSnippetsFindOne.js +107 -0
  56. package/funcs/promptSnippetsFindOne.js.map +1 -0
  57. package/funcs/promptTemplatesGetAll.d.ts +12 -0
  58. package/funcs/promptTemplatesGetAll.d.ts.map +1 -0
  59. package/funcs/promptTemplatesGetAll.js +107 -0
  60. package/funcs/promptTemplatesGetAll.js.map +1 -0
  61. package/funcs/promptsCreate.d.ts +12 -0
  62. package/funcs/promptsCreate.d.ts.map +1 -0
  63. package/funcs/promptsCreate.js +104 -0
  64. package/funcs/promptsCreate.js.map +1 -0
  65. package/funcs/promptsCreateVersion.d.ts +12 -0
  66. package/funcs/promptsCreateVersion.d.ts.map +1 -0
  67. package/funcs/promptsCreateVersion.js +108 -0
  68. package/funcs/promptsCreateVersion.js.map +1 -0
  69. package/funcs/promptsDelete.d.ts +12 -0
  70. package/funcs/promptsDelete.d.ts.map +1 -0
  71. package/funcs/promptsDelete.js +108 -0
  72. package/funcs/promptsDelete.js.map +1 -0
  73. package/funcs/promptsDuplicate.d.ts +12 -0
  74. package/funcs/promptsDuplicate.d.ts.map +1 -0
  75. package/funcs/promptsDuplicate.js +108 -0
  76. package/funcs/promptsDuplicate.js.map +1 -0
  77. package/funcs/promptsGetAll.d.ts +12 -0
  78. package/funcs/promptsGetAll.d.ts.map +1 -0
  79. package/funcs/promptsGetAll.js +107 -0
  80. package/funcs/promptsGetAll.js.map +1 -0
  81. package/funcs/promptsGetOne.d.ts +12 -0
  82. package/funcs/promptsGetOne.d.ts.map +1 -0
  83. package/funcs/promptsGetOne.js +108 -0
  84. package/funcs/promptsGetOne.js.map +1 -0
  85. package/funcs/promptsUpdate.d.ts +13 -0
  86. package/funcs/promptsUpdate.d.ts.map +1 -0
  87. package/funcs/promptsUpdate.js +112 -0
  88. package/funcs/promptsUpdate.js.map +1 -0
  89. package/funcs/remoteconfigGetConfig.d.ts +12 -0
  90. package/funcs/remoteconfigGetConfig.d.ts.map +1 -0
  91. package/funcs/remoteconfigGetConfig.js +105 -0
  92. package/funcs/remoteconfigGetConfig.js.map +1 -0
  93. package/hooks/hooks.d.ts +24 -0
  94. package/hooks/hooks.d.ts.map +1 -0
  95. package/hooks/hooks.js +68 -0
  96. package/hooks/hooks.js.map +1 -0
  97. package/hooks/index.d.ts +3 -0
  98. package/hooks/index.d.ts.map +1 -0
  99. package/hooks/index.js +22 -0
  100. package/hooks/index.js.map +1 -0
  101. package/hooks/registration.d.ts +3 -0
  102. package/hooks/registration.d.ts.map +1 -0
  103. package/hooks/registration.js +15 -0
  104. package/hooks/registration.js.map +1 -0
  105. package/hooks/types.d.ts +76 -0
  106. package/hooks/types.d.ts.map +1 -0
  107. package/hooks/types.js +6 -0
  108. package/hooks/types.js.map +1 -0
  109. package/index.d.ts +4 -0
  110. package/index.d.ts.map +1 -0
  111. package/index.js +46 -0
  112. package/index.js.map +1 -0
  113. package/lib/base64.d.ts +10 -0
  114. package/lib/base64.d.ts.map +1 -0
  115. package/lib/base64.js +71 -0
  116. package/lib/base64.js.map +1 -0
  117. package/lib/config.d.ts +34 -0
  118. package/lib/config.d.ts.map +1 -0
  119. package/lib/config.js +36 -0
  120. package/lib/config.js.map +1 -0
  121. package/lib/dlv.d.ts +14 -0
  122. package/lib/dlv.d.ts.map +1 -0
  123. package/lib/dlv.js +49 -0
  124. package/lib/dlv.js.map +1 -0
  125. package/lib/encodings.d.ts +51 -0
  126. package/lib/encodings.d.ts.map +1 -0
  127. package/lib/encodings.js +343 -0
  128. package/lib/encodings.js.map +1 -0
  129. package/lib/env.d.ts +15 -0
  130. package/lib/env.d.ts.map +1 -0
  131. package/lib/env.js +66 -0
  132. package/lib/env.js.map +1 -0
  133. package/lib/event-streams.d.ts +17 -0
  134. package/lib/event-streams.d.ts.map +1 -0
  135. package/lib/event-streams.js +221 -0
  136. package/lib/event-streams.js.map +1 -0
  137. package/lib/files.d.ts +8 -0
  138. package/lib/files.d.ts.map +1 -0
  139. package/lib/files.js +36 -0
  140. package/lib/files.js.map +1 -0
  141. package/lib/http.d.ts +67 -0
  142. package/lib/http.d.ts.map +1 -0
  143. package/lib/http.js +218 -0
  144. package/lib/http.js.map +1 -0
  145. package/lib/is-plain-object.d.ts +2 -0
  146. package/lib/is-plain-object.d.ts.map +1 -0
  147. package/lib/is-plain-object.js +41 -0
  148. package/lib/is-plain-object.js.map +1 -0
  149. package/lib/logger.d.ts +6 -0
  150. package/lib/logger.d.ts.map +1 -0
  151. package/lib/logger.js +6 -0
  152. package/lib/logger.js.map +1 -0
  153. package/lib/matchers.d.ts +64 -0
  154. package/lib/matchers.d.ts.map +1 -0
  155. package/lib/matchers.js +208 -0
  156. package/lib/matchers.js.map +1 -0
  157. package/lib/primitives.d.ts +22 -0
  158. package/lib/primitives.d.ts.map +1 -0
  159. package/lib/primitives.js +94 -0
  160. package/lib/primitives.js.map +1 -0
  161. package/lib/retries.d.ts +38 -0
  162. package/lib/retries.d.ts.map +1 -0
  163. package/lib/retries.js +155 -0
  164. package/lib/retries.js.map +1 -0
  165. package/lib/schemas.d.ts +19 -0
  166. package/lib/schemas.d.ts.map +1 -0
  167. package/lib/schemas.js +59 -0
  168. package/lib/schemas.js.map +1 -0
  169. package/lib/sdks.d.ts +56 -0
  170. package/lib/sdks.d.ts.map +1 -0
  171. package/lib/sdks.js +277 -0
  172. package/lib/sdks.js.map +1 -0
  173. package/lib/security.d.ts +82 -0
  174. package/lib/security.d.ts.map +1 -0
  175. package/lib/security.js +140 -0
  176. package/lib/security.js.map +1 -0
  177. package/lib/url.d.ts +5 -0
  178. package/lib/url.d.ts.map +1 -0
  179. package/lib/url.js +25 -0
  180. package/lib/url.js.map +1 -0
  181. package/models/components/deployments.d.ts +890 -0
  182. package/models/components/deployments.d.ts.map +1 -0
  183. package/models/components/deployments.js +918 -0
  184. package/models/components/deployments.js.map +1 -0
  185. package/models/components/index.d.ts +3 -0
  186. package/models/components/index.d.ts.map +1 -0
  187. package/models/components/index.js +22 -0
  188. package/models/components/index.js.map +1 -0
  189. package/models/components/security.d.ts +29 -0
  190. package/models/components/security.d.ts.map +1 -0
  191. package/models/components/security.js +78 -0
  192. package/models/components/security.js.map +1 -0
  193. package/models/errors/apierror.d.ts +8 -0
  194. package/models/errors/apierror.d.ts.map +1 -0
  195. package/models/errors/apierror.js +21 -0
  196. package/models/errors/apierror.js.map +1 -0
  197. package/models/errors/honoapierror.d.ts +42 -0
  198. package/models/errors/honoapierror.d.ts.map +1 -0
  199. package/models/errors/honoapierror.js +80 -0
  200. package/models/errors/honoapierror.js.map +1 -0
  201. package/models/errors/httpclienterrors.d.ts +44 -0
  202. package/models/errors/httpclienterrors.d.ts.map +1 -0
  203. package/models/errors/httpclienterrors.js +78 -0
  204. package/models/errors/httpclienterrors.js.map +1 -0
  205. package/models/errors/index.d.ts +6 -0
  206. package/models/errors/index.d.ts.map +1 -0
  207. package/models/errors/index.js +25 -0
  208. package/models/errors/index.js.map +1 -0
  209. package/models/errors/sdkvalidationerror.d.ts +20 -0
  210. package/models/errors/sdkvalidationerror.d.ts.map +1 -0
  211. package/models/errors/sdkvalidationerror.js +115 -0
  212. package/models/errors/sdkvalidationerror.js.map +1 -0
  213. package/models/errors/updateprompt.d.ts +36 -0
  214. package/models/errors/updateprompt.d.ts.map +1 -0
  215. package/models/errors/updateprompt.js +79 -0
  216. package/models/errors/updateprompt.js.map +1 -0
  217. package/models/operations/bulkfileupload.d.ts +162 -0
  218. package/models/operations/bulkfileupload.d.ts.map +1 -0
  219. package/models/operations/bulkfileupload.js +204 -0
  220. package/models/operations/bulkfileupload.js.map +1 -0
  221. package/models/operations/createcontact.d.ts +139 -0
  222. package/models/operations/createcontact.d.ts.map +1 -0
  223. package/models/operations/createcontact.js +149 -0
  224. package/models/operations/createcontact.js.map +1 -0
  225. package/models/operations/createfeedback.d.ts +136 -0
  226. package/models/operations/createfeedback.d.ts.map +1 -0
  227. package/models/operations/createfeedback.js +172 -0
  228. package/models/operations/createfeedback.js.map +1 -0
  229. package/models/operations/createprompt.d.ts +2023 -0
  230. package/models/operations/createprompt.d.ts.map +1 -0
  231. package/models/operations/createprompt.js +1849 -0
  232. package/models/operations/createprompt.js.map +1 -0
  233. package/models/operations/createpromptversion.d.ts +1989 -0
  234. package/models/operations/createpromptversion.d.ts.map +1 -0
  235. package/models/operations/createpromptversion.js +1844 -0
  236. package/models/operations/createpromptversion.js.map +1 -0
  237. package/models/operations/deleteprompt.d.ts +32 -0
  238. package/models/operations/deleteprompt.d.ts.map +1 -0
  239. package/models/operations/deleteprompt.js +69 -0
  240. package/models/operations/deleteprompt.js.map +1 -0
  241. package/models/operations/deploymentcreatemetric.d.ts +957 -0
  242. package/models/operations/deploymentcreatemetric.d.ts.map +1 -0
  243. package/models/operations/deploymentcreatemetric.js +954 -0
  244. package/models/operations/deploymentcreatemetric.js.map +1 -0
  245. package/models/operations/deploymentgetconfig.d.ts +1852 -0
  246. package/models/operations/deploymentgetconfig.d.ts.map +1 -0
  247. package/models/operations/deploymentgetconfig.js +1751 -0
  248. package/models/operations/deploymentgetconfig.js.map +1 -0
  249. package/models/operations/deploymentinvoke.d.ts +1344 -0
  250. package/models/operations/deploymentinvoke.d.ts.map +1 -0
  251. package/models/operations/deploymentinvoke.js +1208 -0
  252. package/models/operations/deploymentinvoke.js.map +1 -0
  253. package/models/operations/deployments.d.ts +1223 -0
  254. package/models/operations/deployments.d.ts.map +1 -0
  255. package/models/operations/deployments.js +1101 -0
  256. package/models/operations/deployments.js.map +1 -0
  257. package/models/operations/duplicateprompt.d.ts +32 -0
  258. package/models/operations/duplicateprompt.d.ts.map +1 -0
  259. package/models/operations/duplicateprompt.js +69 -0
  260. package/models/operations/duplicateprompt.js.map +1 -0
  261. package/models/operations/fileupload.d.ts +168 -0
  262. package/models/operations/fileupload.d.ts.map +1 -0
  263. package/models/operations/fileupload.js +206 -0
  264. package/models/operations/fileupload.js.map +1 -0
  265. package/models/operations/findonepromptsnippet.d.ts +6242 -0
  266. package/models/operations/findonepromptsnippet.d.ts.map +1 -0
  267. package/models/operations/findonepromptsnippet.js +5879 -0
  268. package/models/operations/findonepromptsnippet.js.map +1 -0
  269. package/models/operations/getallprompts.d.ts +6577 -0
  270. package/models/operations/getallprompts.d.ts.map +1 -0
  271. package/models/operations/getallprompts.js +6149 -0
  272. package/models/operations/getallprompts.js.map +1 -0
  273. package/models/operations/getallprompttemplates.d.ts +6571 -0
  274. package/models/operations/getallprompttemplates.d.ts.map +1 -0
  275. package/models/operations/getallprompttemplates.js +6213 -0
  276. package/models/operations/getallprompttemplates.js.map +1 -0
  277. package/models/operations/getoneprompt.d.ts +32 -0
  278. package/models/operations/getoneprompt.d.ts.map +1 -0
  279. package/models/operations/getoneprompt.js +69 -0
  280. package/models/operations/getoneprompt.js.map +1 -0
  281. package/models/operations/index.d.ts +20 -0
  282. package/models/operations/index.d.ts.map +1 -0
  283. package/models/operations/index.js +39 -0
  284. package/models/operations/index.js.map +1 -0
  285. package/models/operations/invaliddeployment.d.ts +29 -0
  286. package/models/operations/invaliddeployment.d.ts.map +1 -0
  287. package/models/operations/invaliddeployment.js +78 -0
  288. package/models/operations/invaliddeployment.js.map +1 -0
  289. package/models/operations/remoteconfigsgetconfig.d.ts +121 -0
  290. package/models/operations/remoteconfigsgetconfig.d.ts.map +1 -0
  291. package/models/operations/remoteconfigsgetconfig.js +126 -0
  292. package/models/operations/remoteconfigsgetconfig.js.map +1 -0
  293. package/models/operations/updateprompt.d.ts +7209 -0
  294. package/models/operations/updateprompt.d.ts.map +1 -0
  295. package/models/operations/updateprompt.js +6664 -0
  296. package/models/operations/updateprompt.js.map +1 -0
  297. package/package.json +28 -23
  298. package/sdk/contacts.d.ts +12 -0
  299. package/sdk/contacts.d.ts.map +1 -0
  300. package/sdk/contacts.js +22 -0
  301. package/sdk/contacts.js.map +1 -0
  302. package/sdk/deployments.d.ts +41 -0
  303. package/sdk/deployments.d.ts.map +1 -0
  304. package/sdk/deployments.js +59 -0
  305. package/sdk/deployments.js.map +1 -0
  306. package/sdk/feedback.d.ts +12 -0
  307. package/sdk/feedback.d.ts.map +1 -0
  308. package/sdk/feedback.js +22 -0
  309. package/sdk/feedback.js.map +1 -0
  310. package/sdk/files.d.ts +19 -0
  311. package/sdk/files.d.ts.map +1 -0
  312. package/sdk/files.js +32 -0
  313. package/sdk/files.js.map +1 -0
  314. package/sdk/index.d.ts +2 -0
  315. package/sdk/index.d.ts.map +1 -0
  316. package/sdk/index.js +21 -0
  317. package/sdk/index.js.map +1 -0
  318. package/sdk/metrics.d.ts +12 -0
  319. package/sdk/metrics.d.ts.map +1 -0
  320. package/sdk/metrics.js +22 -0
  321. package/sdk/metrics.js.map +1 -0
  322. package/sdk/prompt.d.ts +10 -0
  323. package/sdk/prompt.d.ts.map +1 -0
  324. package/sdk/prompt.js +21 -0
  325. package/sdk/prompt.js.map +1 -0
  326. package/sdk/prompts.d.ts +33 -0
  327. package/sdk/prompts.d.ts.map +1 -0
  328. package/sdk/prompts.js +61 -0
  329. package/sdk/prompts.js.map +1 -0
  330. package/sdk/remoteconfig.d.ts +9 -0
  331. package/sdk/remoteconfig.d.ts.map +1 -0
  332. package/sdk/remoteconfig.js +19 -0
  333. package/sdk/remoteconfig.js.map +1 -0
  334. package/sdk/sdk.d.ts +25 -0
  335. package/sdk/sdk.d.ts.map +1 -0
  336. package/sdk/sdk.js +46 -0
  337. package/sdk/sdk.js.map +1 -0
  338. package/sdk/snippets.d.ts +9 -0
  339. package/sdk/snippets.d.ts.map +1 -0
  340. package/sdk/snippets.js +19 -0
  341. package/sdk/snippets.js.map +1 -0
  342. package/sdk/templates.d.ts +9 -0
  343. package/sdk/templates.d.ts.map +1 -0
  344. package/sdk/templates.js +19 -0
  345. package/sdk/templates.js.map +1 -0
  346. package/src/core.ts +13 -0
  347. package/src/funcs/contactsCreate.ts +123 -0
  348. package/src/funcs/deploymentsAll.ts +137 -0
  349. package/src/funcs/deploymentsGetConfig.ts +131 -0
  350. package/src/funcs/deploymentsInvalidate.ts +132 -0
  351. package/src/funcs/deploymentsInvoke.ts +134 -0
  352. package/src/funcs/deploymentsMetricsCreate.ts +131 -0
  353. package/src/funcs/feedbackCreate.ts +123 -0
  354. package/src/funcs/filesBulkUpload.ts +125 -0
  355. package/src/funcs/filesUpload.ts +144 -0
  356. package/src/funcs/promptSnippetsFindOne.ts +127 -0
  357. package/src/funcs/promptTemplatesGetAll.ts +129 -0
  358. package/src/funcs/promptsCreate.ts +123 -0
  359. package/src/funcs/promptsCreateVersion.ts +128 -0
  360. package/src/funcs/promptsDelete.ts +127 -0
  361. package/src/funcs/promptsDuplicate.ts +127 -0
  362. package/src/funcs/promptsGetAll.ts +127 -0
  363. package/src/funcs/promptsGetOne.ts +127 -0
  364. package/src/funcs/promptsUpdate.ts +135 -0
  365. package/src/funcs/remoteconfigGetConfig.ts +124 -0
  366. package/src/hooks/hooks.ts +112 -0
  367. package/src/hooks/index.ts +6 -0
  368. package/src/hooks/registration.ts +14 -0
  369. package/src/hooks/types.ts +102 -0
  370. package/src/index.ts +7 -0
  371. package/src/lib/base64.ts +37 -0
  372. package/src/lib/config.ts +60 -0
  373. package/src/lib/dlv.ts +53 -0
  374. package/src/lib/encodings.ts +449 -0
  375. package/src/lib/env.ts +41 -0
  376. package/src/lib/event-streams.ts +264 -0
  377. package/src/lib/files.ts +40 -0
  378. package/src/lib/http.ts +323 -0
  379. package/src/lib/is-plain-object.ts +43 -0
  380. package/src/lib/logger.ts +9 -0
  381. package/src/lib/matchers.ts +325 -0
  382. package/src/lib/primitives.ts +122 -0
  383. package/src/lib/retries.ts +219 -0
  384. package/src/lib/schemas.ts +86 -0
  385. package/src/lib/sdks.ts +392 -0
  386. package/src/lib/security.ts +254 -0
  387. package/src/lib/url.ts +33 -0
  388. package/src/models/components/deployments.ts +1607 -0
  389. package/src/models/components/index.ts +6 -0
  390. package/src/models/components/security.ts +71 -0
  391. package/src/models/errors/apierror.ts +27 -0
  392. package/src/models/errors/honoapierror.ts +82 -0
  393. package/src/models/errors/httpclienterrors.ts +62 -0
  394. package/src/models/errors/index.ts +9 -0
  395. package/src/models/errors/sdkvalidationerror.ts +97 -0
  396. package/src/models/errors/updateprompt.ts +71 -0
  397. package/src/models/operations/bulkfileupload.ts +304 -0
  398. package/src/models/operations/createcontact.ts +256 -0
  399. package/src/models/operations/createfeedback.ts +286 -0
  400. package/src/models/operations/createprompt.ts +3451 -0
  401. package/src/models/operations/createpromptversion.ts +3693 -0
  402. package/src/models/operations/deleteprompt.ts +69 -0
  403. package/src/models/operations/deploymentcreatemetric.ts +1790 -0
  404. package/src/models/operations/deploymentgetconfig.ts +3416 -0
  405. package/src/models/operations/deploymentinvoke.ts +2383 -0
  406. package/src/models/operations/deployments.ts +2084 -0
  407. package/src/models/operations/duplicateprompt.ts +69 -0
  408. package/src/models/operations/fileupload.ts +311 -0
  409. package/src/models/operations/findonepromptsnippet.ts +13617 -0
  410. package/src/models/operations/getallprompts.ts +13378 -0
  411. package/src/models/operations/getallprompttemplates.ts +13678 -0
  412. package/src/models/operations/getoneprompt.ts +69 -0
  413. package/src/models/operations/index.ts +23 -0
  414. package/src/models/operations/invaliddeployment.ts +75 -0
  415. package/src/models/operations/remoteconfigsgetconfig.ts +190 -0
  416. package/src/models/operations/updateprompt.ts +14393 -0
  417. package/src/sdk/contacts.ts +27 -0
  418. package/src/sdk/deployments.ts +93 -0
  419. package/src/sdk/feedback.ts +27 -0
  420. package/src/sdk/files.ts +45 -0
  421. package/src/sdk/index.ts +5 -0
  422. package/src/sdk/metrics.ts +27 -0
  423. package/src/sdk/prompt.ts +19 -0
  424. package/src/sdk/prompts.ts +114 -0
  425. package/src/sdk/remoteconfig.ts +24 -0
  426. package/src/sdk/sdk.ts +49 -0
  427. package/src/sdk/snippets.ts +24 -0
  428. package/src/sdk/templates.ts +24 -0
  429. package/src/types/blobs.ts +31 -0
  430. package/src/types/constdatetime.ts +15 -0
  431. package/src/types/enums.ts +16 -0
  432. package/src/types/fp.ts +50 -0
  433. package/src/types/index.ts +11 -0
  434. package/src/types/operations.ts +105 -0
  435. package/src/types/rfcdate.ts +54 -0
  436. package/src/types/streams.ts +21 -0
  437. package/types/blobs.d.ts +4 -0
  438. package/types/blobs.d.ts.map +1 -0
  439. package/types/blobs.js +62 -0
  440. package/types/blobs.js.map +1 -0
  441. package/types/constdatetime.d.ts +3 -0
  442. package/types/constdatetime.d.ts.map +1 -0
  443. package/types/constdatetime.js +46 -0
  444. package/types/constdatetime.js.map +1 -0
  445. package/types/enums.d.ts +12 -0
  446. package/types/enums.d.ts.map +1 -0
  447. package/types/enums.js +10 -0
  448. package/types/enums.js.map +1 -0
  449. package/types/fp.d.ts +31 -0
  450. package/types/fp.d.ts.map +1 -0
  451. package/types/fp.js +37 -0
  452. package/types/fp.js.map +1 -0
  453. package/types/index.d.ts +8 -0
  454. package/types/index.d.ts.map +1 -0
  455. package/types/index.js +16 -0
  456. package/types/index.js.map +1 -0
  457. package/types/operations.d.ts +27 -0
  458. package/types/operations.d.ts.map +1 -0
  459. package/types/operations.js +83 -0
  460. package/types/operations.js.map +1 -0
  461. package/types/rfcdate.d.ts +21 -0
  462. package/types/rfcdate.d.ts.map +1 -0
  463. package/types/rfcdate.js +46 -0
  464. package/types/rfcdate.js.map +1 -0
  465. package/types/streams.d.ts +2 -0
  466. package/types/streams.d.ts.map +1 -0
  467. package/types/streams.js +18 -0
  468. package/types/streams.js.map +1 -0
  469. package/src/index.d.ts +0 -3
  470. package/src/index.js +0 -7
  471. package/src/index.js.map +0 -1
  472. package/src/lib/api/deployments.d.ts +0 -42
  473. package/src/lib/api/deployments.js +0 -145
  474. package/src/lib/api/deployments.js.map +0 -1
  475. package/src/lib/api/index.d.ts +0 -1
  476. package/src/lib/api/index.js +0 -5
  477. package/src/lib/api/index.js.map +0 -1
  478. package/src/lib/client.d.ts +0 -11
  479. package/src/lib/client.js +0 -32
  480. package/src/lib/client.js.map +0 -1
  481. package/src/lib/exceptions/index.d.ts +0 -9
  482. package/src/lib/exceptions/index.js +0 -34
  483. package/src/lib/exceptions/index.js.map +0 -1
  484. package/src/lib/http/index.d.ts +0 -8
  485. package/src/lib/http/index.js +0 -20
  486. package/src/lib/http/index.js.map +0 -1
  487. package/src/lib/models/deployments.d.ts +0 -143
  488. package/src/lib/models/deployments.js +0 -40
  489. package/src/lib/models/deployments.js.map +0 -1
  490. package/src/lib/models/index.d.ts +0 -3
  491. package/src/lib/models/index.js +0 -7
  492. package/src/lib/models/index.js.map +0 -1
  493. package/src/lib/models/options.d.ts +0 -12
  494. package/src/lib/models/options.js +0 -3
  495. package/src/lib/models/options.js.map +0 -1
  496. package/src/lib/models/user-info.d.ts +0 -3
  497. package/src/lib/models/user-info.js +0 -3
  498. package/src/lib/models/user-info.js.map +0 -1
  499. package/src/lib/utils/index.d.ts +0 -7
  500. package/src/lib/utils/index.js +0 -49
  501. package/src/lib/utils/index.js.map +0 -1
  502. package/src/lib/version.d.ts +0 -1
  503. package/src/lib/version.js +0 -5
  504. package/src/lib/version.js.map +0 -1
package/README.md CHANGED
@@ -1,236 +1,556 @@
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
18
54
 
19
55
  ```bash
20
- npm install @orq-ai/node
56
+ npm add @orq-ai/node
21
57
  ```
22
58
 
59
+ ### PNPM
60
+
23
61
  ```bash
24
- yarn add @orq-ai/node
62
+ pnpm add @orq-ai/node
25
63
  ```
26
64
 
27
- ## Usage
65
+ ### Bun
66
+
67
+ ```bash
68
+ bun add @orq-ai/node
69
+ ```
70
+
71
+ ### Yarn
72
+
73
+ ```bash
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.
78
+ ```
79
+ <!-- End SDK Installation [installation] -->
80
+
81
+ <!-- Start Requirements [requirements] -->
82
+ ## Requirements
83
+
84
+ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
85
+ <!-- End Requirements [requirements] -->
28
86
 
29
- _You can get your workspace API key from the settings section in your orq.ai workspace. `https://my.orq.ai/<workspace>/settings/developers`_
87
+ <!-- Start SDK Example Usage [usage] -->
88
+ ## SDK Example Usage
30
89
 
31
- Initialize the orq.ai client with your API key:
90
+ ### Example
32
91
 
33
- ```ts
34
- import { createClient } from '@orq-ai/node';
92
+ ```typescript
93
+ import { Orq } from "@orq-ai/node";
35
94
 
36
- const client = createClient({
37
- apiKey: 'orquesta-api-key',
38
- environment: 'production',
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] -->
48
112
 
49
- ## Deployments
113
+ <!-- Start Authentication [security] -->
114
+ ## Authentication
50
115
 
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.
116
+ ### Per-Client Security Schemes
52
117
 
53
- ### Invoke a deployment
118
+ This SDK supports the following security scheme globally:
54
119
 
55
- #### `invoke()`
120
+ | Name | Type | Scheme | Environment Variable |
121
+ | -------- | ---- | ----------- | -------------------- |
122
+ | `apiKey` | http | HTTP Bearer | `ORQ_API_KEY` |
56
123
 
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' },
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";
127
+
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
+ * [invalidate](docs/sdks/deployments/README.md#invalidate) - Invalidates cache
160
+ * [getConfig](docs/sdks/deployments/README.md#getconfig) - Get config
161
+ * [invoke](docs/sdks/deployments/README.md#invoke) - Invoke
162
+
163
+ #### [deployments.metrics](docs/sdks/metrics/README.md)
67
164
 
68
- #### `invoke_with_stream()`
165
+ * [create](docs/sdks/metrics/README.md#create) - Add metrics
69
166
 
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' },
167
+ ### [feedback](docs/sdks/feedback/README.md)
168
+
169
+ * [create](docs/sdks/feedback/README.md#create) - Submit feedback
170
+
171
+ ### [files](docs/sdks/files/README.md)
172
+
173
+ * [upload](docs/sdks/files/README.md#upload) - Upload file
174
+ * [bulkUpload](docs/sdks/files/README.md#bulkupload) - Bulk upload file
175
+
176
+
177
+ ### [prompt](docs/sdks/prompt/README.md)
178
+
179
+
180
+ #### [prompt.snippets](docs/sdks/snippets/README.md)
181
+
182
+ * [findOne](docs/sdks/snippets/README.md#findone) - Get one prompt snippet
183
+
184
+ #### [prompt.templates](docs/sdks/templates/README.md)
185
+
186
+ * [getAll](docs/sdks/templates/README.md#getall) - Get all prompt templates
187
+
188
+ ### [prompts](docs/sdks/prompts/README.md)
189
+
190
+ * [create](docs/sdks/prompts/README.md#create) - Create a new prompt
191
+ * [createVersion](docs/sdks/prompts/README.md#createversion) - Create a new prompt version
192
+ * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
193
+ * [getOne](docs/sdks/prompts/README.md#getone) - Get one prompt
194
+ * [update](docs/sdks/prompts/README.md#update) - Update a prompt
195
+ * [duplicate](docs/sdks/prompts/README.md#duplicate) - Duplicate a prompt
196
+ * [getAll](docs/sdks/prompts/README.md#getall) - Get all prompts
197
+
198
+ ### [remoteconfig](docs/sdks/remoteconfig/README.md)
199
+
200
+ * [getConfig](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
201
+
202
+ </details>
203
+ <!-- End Available Resources and Operations [operations] -->
204
+
205
+ <!-- Start Standalone functions [standalone-funcs] -->
206
+ ## Standalone functions
207
+
208
+ All the methods listed above are available as standalone functions. These
209
+ functions are ideal for use in applications running in the browser, serverless
210
+ runtimes or other environments where application bundle size is a primary
211
+ concern. When using a bundler to build your application, all unused
212
+ functionality will be either excluded from the final bundle or tree-shaken away.
213
+
214
+ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
215
+
216
+ <details>
217
+
218
+ <summary>Available standalone functions</summary>
219
+
220
+ - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Update user information
221
+ - [`deploymentsAll`](docs/sdks/deployments/README.md#all) - List all deployments
222
+ - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
223
+ - [`deploymentsInvalidate`](docs/sdks/deployments/README.md#invalidate) - Invalidates cache
224
+ - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
225
+ - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
226
+ - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
227
+ - [`filesBulkUpload`](docs/sdks/files/README.md#bulkupload) - Bulk upload file
228
+ - [`filesUpload`](docs/sdks/files/README.md#upload) - Upload file
229
+ - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a new prompt
230
+ - [`promptsCreateVersion`](docs/sdks/prompts/README.md#createversion) - Create a new prompt version
231
+ - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
232
+ - [`promptsDuplicate`](docs/sdks/prompts/README.md#duplicate) - Duplicate a prompt
233
+ - [`promptsGetAll`](docs/sdks/prompts/README.md#getall) - Get all prompts
234
+ - [`promptsGetOne`](docs/sdks/prompts/README.md#getone) - Get one prompt
235
+ - [`promptSnippetsFindOne`](docs/sdks/snippets/README.md#findone) - Get one prompt snippet
236
+ - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
237
+ - [`promptTemplatesGetAll`](docs/sdks/templates/README.md#getall) - Get all prompt templates
238
+ - [`remoteconfigGetConfig`](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
239
+
240
+ </details>
241
+ <!-- End Standalone functions [standalone-funcs] -->
242
+
243
+ <!-- Start Server-sent event streaming [eventstream] -->
244
+ ## Server-sent event streaming
245
+
246
+ [Server-sent events][mdn-sse] are used to stream content from certain
247
+ operations. These operations will expose the stream as an async iterable that
248
+ can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
249
+ terminate when the server no longer has any events to send and closes the
250
+ underlying connection.
251
+
252
+ ```typescript
253
+ import { Orq } from "@orq-ai/node";
254
+
255
+ const orq = new Orq({
256
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
76
257
  });
77
258
 
78
- for await (const chunk of stream) {
79
- console.log(chunk.choices[0]?.message.content);
259
+ async function run() {
260
+ const result = await orq.deployments.invoke({
261
+ key: "<key>",
262
+ });
263
+
264
+ for await (const event of result) {
265
+ // Handle the event
266
+ console.log(event);
267
+ }
80
268
  }
269
+
270
+ run();
271
+
81
272
  ```
82
273
 
83
- #### Adding messages as part of your request
274
+ [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
275
+ [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
276
+ <!-- End Server-sent event streaming [eventstream] -->
84
277
 
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.
278
+ <!-- Start File uploads [file-upload] -->
279
+ ## File uploads
280
+
281
+ 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.
282
+
283
+ > [!TIP]
284
+ >
285
+ > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
286
+ >
287
+ > - **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).
288
+ > - **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.
289
+ > - **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.
290
+ > - **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).
291
+
292
+ ```typescript
293
+ import { Orq } from "@orq-ai/node";
294
+
295
+ const orq = new Orq({
296
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
297
+ });
298
+
299
+ async function run() {
300
+ const result = await orq.files.upload();
301
+
302
+ // Handle the result
303
+ console.log(result);
304
+ }
305
+
306
+ run();
88
307
 
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
308
  ```
309
+ <!-- End File uploads [file-upload] -->
109
310
 
110
- #### Logging metrics to the deployment configuration
311
+ <!-- Start Retries [retries] -->
312
+ ## Retries
111
313
 
112
- After invoking, streaming or getting the configuration of a deployment, you can use the `add_metrics` method to add information to the deployment.
314
+ 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.
315
+
316
+ To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
317
+ ```typescript
318
+ import { Orq } from "@orq-ai/node";
319
+
320
+ const orq = new Orq({
321
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
322
+ });
323
+
324
+ async function run() {
325
+ const result = await orq.contacts.create({
326
+ externalId: "<id>",
327
+ }, {
328
+ retries: {
329
+ strategy: "backoff",
330
+ backoff: {
331
+ initialInterval: 1,
332
+ maxInterval: 50,
333
+ exponent: 1.1,
334
+ maxElapsedTime: 100,
335
+ },
336
+ retryConnectionErrors: false,
337
+ },
338
+ });
339
+
340
+ // Handle the result
341
+ console.log(result);
342
+ }
113
343
 
114
- ```ts
115
- generation.addMetrics({
116
- chain_id: 'c4a75b53-62fa-401b-8e97-493f3d299316',
117
- conversation_id: 'ee7b0c8c-eeb2-43cf-83e9-a4a49f8f13ea',
118
- user_id: 'e3a202a6-461b-447c-abe2-018ba4d04cd0',
119
- feedback: { score: 100 },
120
- metadata: {
121
- custom: 'custom_metadata',
122
- chain_id: 'ad1231xsdaABw',
344
+ run();
345
+
346
+ ```
347
+
348
+ If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
349
+ ```typescript
350
+ import { Orq } from "@orq-ai/node";
351
+
352
+ const orq = new Orq({
353
+ retryConfig: {
354
+ strategy: "backoff",
355
+ backoff: {
356
+ initialInterval: 1,
357
+ maxInterval: 50,
358
+ exponent: 1.1,
359
+ maxElapsedTime: 100,
360
+ },
361
+ retryConnectionErrors: false,
123
362
  },
363
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
124
364
  });
365
+
366
+ async function run() {
367
+ const result = await orq.contacts.create({
368
+ externalId: "<id>",
369
+ });
370
+
371
+ // Handle the result
372
+ console.log(result);
373
+ }
374
+
375
+ run();
376
+
125
377
  ```
378
+ <!-- End Retries [retries] -->
379
+
380
+ <!-- Start Error Handling [errors] -->
381
+ ## Error Handling
382
+
383
+ All SDK methods return a response object or throw an error. By default, an API error will throw a `errors.APIError`.
384
+
385
+ If a HTTP request fails, an operation my also throw an error from the `models/errors/httpclienterrors.ts` module:
126
386
 
127
- ### Get deployment configuration
387
+ | HTTP Client Error | Description |
388
+ | ---------------------------------------------------- | ---------------------------------------------------- |
389
+ | RequestAbortedError | HTTP request was aborted by the client |
390
+ | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
391
+ | ConnectionError | HTTP client was unable to make a request to a server |
392
+ | InvalidRequestError | Any input used to create a request is invalid |
393
+ | UnexpectedClientError | Unrecognised or unexpected error |
128
394
 
129
- #### `get_config()`
395
+ In addition, when custom error responses are specified for an operation, the SDK may throw their associated Error type. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. For example, the `all` method may throw the following errors:
130
396
 
131
- ```ts
132
- const deploymentPromptConfig = await client.deployments.getConfig({
133
- key: 'customer_service',
134
- context: { environments: 'production', country: 'NLD' },
135
- inputs: { firstname: 'John', city: 'New York' },
136
- metadata: { customer_id: 'Qwtqwty90281' },
397
+ | Error Type | Status Code | Content Type |
398
+ | ------------------- | ----------- | ---------------- |
399
+ | errors.HonoApiError | 500 | application/json |
400
+ | errors.APIError | 4XX, 5XX | \*/\* |
401
+
402
+ ```typescript
403
+ import { Orq } from "@orq-ai/node";
404
+ import { HonoApiError, SDKValidationError } from "@orq-ai/node/models/errors";
405
+
406
+ const orq = new Orq({
407
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
137
408
  });
138
409
 
139
- console.log(deploymentPromptConfig);
410
+ async function run() {
411
+ let result;
412
+ try {
413
+ result = await orq.deployments.all();
414
+
415
+ // Handle the result
416
+ console.log(result);
417
+ } catch (err) {
418
+ switch (true) {
419
+ case (err instanceof SDKValidationError): {
420
+ // Validation errors can be pretty-printed
421
+ console.error(err.pretty());
422
+ // Raw value may also be inspected
423
+ console.error(err.rawValue);
424
+ return;
425
+ }
426
+ case (err instanceof HonoApiError): {
427
+ // Handle err.data$: HonoApiErrorData
428
+ console.error(err);
429
+ return;
430
+ }
431
+ default: {
432
+ throw err;
433
+ }
434
+ }
435
+ }
436
+ }
437
+
438
+ run();
439
+
140
440
  ```
141
441
 
142
- #### Logging metrics to the deployment configuration
442
+ 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 string since validation errors can list many issues and the plain error string may be difficult read when debugging.
443
+ <!-- End Error Handling [errors] -->
143
444
 
144
- After invoking, streaming or getting the configuration of a deployment, you can use the `add_metrics` method to add information to the deployment.
445
+ <!-- Start Server Selection [server] -->
446
+ ## Server Selection
145
447
 
146
- ```ts
147
- deploymentPromptConfig.addMetrics({
148
- chain_id: 'c4a75b53-62fa-401b-8e97-493f3d299316',
149
- conversation_id: 'ee7b0c8c-eeb2-43cf-83e9-a4a49f8f13ea',
150
- user_id: 'e3a202a6-461b-447c-abe2-018ba4d04cd0',
151
- feedback: { score: 100 },
152
- metadata: {
153
- custom: 'custom_metadata',
154
- chain_id: 'ad1231xsdaABw',
155
- },
156
- usage: {
157
- prompt_tokens: 100,
158
- completion_tokens: 900,
159
- total_tokens: 1000,
160
- },
161
- performance: {
162
- latency: 9000,
163
- time_to_first_token: 250,
164
- },
448
+ ### Override Server URL Per-Client
449
+
450
+ 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:
451
+ ```typescript
452
+ import { Orq } from "@orq-ai/node";
453
+
454
+ const orq = new Orq({
455
+ serverURL: "https://my.staging.orq.ai",
456
+ apiKey: process.env["ORQ_API_KEY"] ?? "",
165
457
  });
166
- ```
167
458
 
168
- ### Logging LLM responses
459
+ async function run() {
460
+ const result = await orq.contacts.create({
461
+ externalId: "<id>",
462
+ });
169
463
 
170
- Whether you use the `get_config` or `invoke`, you can log the model generations to the deployment. Here are some
171
- examples of how to do it.
464
+ // Handle the result
465
+ console.log(result);
466
+ }
172
467
 
173
- #### Logging the completion choices the model generated for the input prompt
468
+ run();
174
469
 
175
- ```ts
176
- generation.addMetrics(
177
- choices:[
178
- {
179
- index: 0,
180
- finish_reason: 'assistant',
181
- message: {
182
- role: 'assistant',
183
- content:
184
- "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",
185
- },
186
- },
187
- ]
188
- );
189
470
  ```
471
+ <!-- End Server Selection [server] -->
472
+
473
+ <!-- Start Custom HTTP Client [http-client] -->
474
+ ## Custom HTTP Client
475
+
476
+ The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
477
+ [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
478
+ client is a thin wrapper around `fetch` and provides the ability to attach hooks
479
+ around the request lifecycle that can be used to modify the request or handle
480
+ errors and response.
481
+
482
+ The `HTTPClient` constructor takes an optional `fetcher` argument that can be
483
+ used to integrate a third-party HTTP client or when writing tests to mock out
484
+ the HTTP client and feed in fixtures.
485
+
486
+ The following example shows how to use the `"beforeRequest"` hook to to add a
487
+ custom header and a timeout to requests and how to use the `"requestError"` hook
488
+ to log errors:
489
+
490
+ ```typescript
491
+ import { Orq } from "@orq-ai/node";
492
+ import { HTTPClient } from "@orq-ai/node/lib/http";
493
+
494
+ const httpClient = new HTTPClient({
495
+ // fetcher takes a function that has the same signature as native `fetch`.
496
+ fetcher: (request) => {
497
+ return fetch(request);
498
+ }
499
+ });
190
500
 
191
- #### Logging the completion choices the model generated for the input prompt
501
+ httpClient.addHook("beforeRequest", (request) => {
502
+ const nextRequest = new Request(request, {
503
+ signal: request.signal || AbortSignal.timeout(5000)
504
+ });
192
505
 
193
- You can save the images generated by the model in Orq. If the image format is `base64` we always store it as
194
- a `png`.
506
+ nextRequest.headers.set("x-custom-header", "custom value");
195
507
 
196
- ```ts
197
- generation.addMetrics(
198
- choices: [
199
- {
200
- index: 0,
201
- finish_reason: 'stop',
202
- message: {
203
- role: 'assistant',
204
- url: '<image_url>',
205
- },
206
- },
207
- ]
208
- );
508
+ return nextRequest;
509
+ });
510
+
511
+ httpClient.addHook("requestError", (error, request) => {
512
+ console.group("Request Error");
513
+ console.log("Reason:", `${error}`);
514
+ console.log("Endpoint:", `${request.method} ${request.url}`);
515
+ console.groupEnd();
516
+ });
517
+
518
+ const sdk = new Orq({ httpClient });
209
519
  ```
520
+ <!-- End Custom HTTP Client [http-client] -->
210
521
 
211
- #### Logging the output of the tool calls
212
-
213
- ```ts
214
- generation.addMetrics(
215
- choices: [
216
- {
217
- index: 0,
218
- message: {
219
- role: 'assistant',
220
- content: None,
221
- tool_calls: [
222
- {
223
- type: 'function',
224
- id: 'call_pDBPMMacPXOtoWhTWibW1D94',
225
- function: {
226
- name: 'get_weather',
227
- arguments: '{"location":"San Francisco, CA"}',
228
- },
229
- },
230
- ],
231
- },
232
- finish_reason: 'tool_calls',
233
- },
234
- ]
235
- );
522
+ <!-- Start Debugging [debug] -->
523
+ ## Debugging
524
+
525
+ You can setup your SDK to emit debug logs for SDK requests and responses.
526
+
527
+ You can pass a logger that matches `console`'s interface as an SDK option.
528
+
529
+ > [!WARNING]
530
+ > 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.
531
+
532
+ ```typescript
533
+ import { Orq } from "@orq-ai/node";
534
+
535
+ const sdk = new Orq({ debugLogger: console });
236
536
  ```
537
+
538
+ You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
539
+ <!-- End Debugging [debug] -->
540
+
541
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
542
+
543
+ # Development
544
+
545
+ ## Maturity
546
+
547
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
548
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
549
+ looking for the latest version.
550
+
551
+ ## Contributions
552
+
553
+ 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.
554
+ 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.
555
+
556
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)