@orq-ai/node 3.9.4 → 3.10.0-rc.2

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 (490) hide show
  1. package/bin/mcp-server.js +245 -322
  2. package/bin/mcp-server.js.map +33 -33
  3. package/examples/README.md +26 -0
  4. package/examples/contactsCreate.example.ts +40 -0
  5. package/examples/package-lock.json +626 -0
  6. package/examples/package.json +18 -0
  7. package/funcs/deploymentsStream.js +7 -7
  8. package/funcs/deploymentsStream.js.map +1 -1
  9. package/jsr.json +1 -1
  10. package/lib/config.d.ts +3 -3
  11. package/lib/config.js +3 -3
  12. package/lib/config.js.map +1 -1
  13. package/lib/event-streams.d.ts +4 -10
  14. package/lib/event-streams.d.ts.map +1 -1
  15. package/lib/event-streams.js +110 -194
  16. package/lib/event-streams.js.map +1 -1
  17. package/lib/matchers.d.ts.map +1 -1
  18. package/lib/matchers.js +1 -4
  19. package/lib/matchers.js.map +1 -1
  20. package/mcp-server/mcp-server.js +1 -1
  21. package/mcp-server/mcp-server.js.map +1 -1
  22. package/mcp-server/server.js +1 -1
  23. package/mcp-server/server.js.map +1 -1
  24. package/models/operations/createcontact.js +2 -2
  25. package/models/operations/createdataset.js +2 -2
  26. package/models/operations/createdatasetitem.js +2 -2
  27. package/models/operations/createdatasource.js +2 -2
  28. package/models/operations/createeval.js +16 -16
  29. package/models/operations/fileget.js +2 -2
  30. package/models/operations/filelist.js +2 -2
  31. package/models/operations/fileupload.js +2 -2
  32. package/models/operations/getevals.js +28 -28
  33. package/models/operations/listcontacts.js +2 -2
  34. package/models/operations/listdatasetdatapoints.js +2 -2
  35. package/models/operations/listdatasets.js +2 -2
  36. package/models/operations/listdatasources.js +2 -2
  37. package/models/operations/retrievecontact.js +2 -2
  38. package/models/operations/retrievedatapoint.js +2 -2
  39. package/models/operations/retrievedataset.js +2 -2
  40. package/models/operations/retrievedatasource.js +2 -2
  41. package/models/operations/updatecontact.js +2 -2
  42. package/models/operations/updatedatapoint.js +2 -2
  43. package/models/operations/updatedataset.js +2 -2
  44. package/models/operations/updatedatasource.js +2 -2
  45. package/models/operations/updateeval.js +16 -16
  46. package/package.json +3 -2
  47. package/src/funcs/deploymentsStream.ts +7 -8
  48. package/src/lib/config.ts +3 -3
  49. package/src/lib/event-streams.ts +114 -231
  50. package/src/lib/matchers.ts +1 -4
  51. package/src/mcp-server/mcp-server.ts +1 -1
  52. package/src/mcp-server/server.ts +1 -1
  53. package/src/models/operations/createcontact.ts +2 -2
  54. package/src/models/operations/createdataset.ts +2 -2
  55. package/src/models/operations/createdatasetitem.ts +2 -2
  56. package/src/models/operations/createdatasource.ts +2 -2
  57. package/src/models/operations/createeval.ts +16 -16
  58. package/src/models/operations/fileget.ts +2 -2
  59. package/src/models/operations/filelist.ts +2 -2
  60. package/src/models/operations/fileupload.ts +2 -2
  61. package/src/models/operations/getevals.ts +28 -28
  62. package/src/models/operations/listcontacts.ts +2 -2
  63. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  64. package/src/models/operations/listdatasets.ts +2 -2
  65. package/src/models/operations/listdatasources.ts +2 -2
  66. package/src/models/operations/retrievecontact.ts +2 -2
  67. package/src/models/operations/retrievedatapoint.ts +2 -2
  68. package/src/models/operations/retrievedataset.ts +2 -2
  69. package/src/models/operations/retrievedatasource.ts +2 -2
  70. package/src/models/operations/updatecontact.ts +2 -2
  71. package/src/models/operations/updatedatapoint.ts +2 -2
  72. package/src/models/operations/updatedataset.ts +2 -2
  73. package/src/models/operations/updatedatasource.ts +2 -2
  74. package/src/models/operations/updateeval.ts +16 -16
  75. package/packages/orq-rc/FUNCTIONS.md +0 -103
  76. package/packages/orq-rc/README.md +0 -958
  77. package/packages/orq-rc/RUNTIMES.md +0 -48
  78. package/packages/orq-rc/docs/sdks/contacts/README.md +0 -445
  79. package/packages/orq-rc/docs/sdks/datasets/README.md +0 -825
  80. package/packages/orq-rc/docs/sdks/deployments/README.md +0 -310
  81. package/packages/orq-rc/docs/sdks/evals/README.md +0 -3035
  82. package/packages/orq-rc/docs/sdks/feedback/README.md +0 -88
  83. package/packages/orq-rc/docs/sdks/files/README.md +0 -297
  84. package/packages/orq-rc/docs/sdks/knowledge/README.md +0 -1150
  85. package/packages/orq-rc/docs/sdks/knowledgebases/README.md +0 -94
  86. package/packages/orq-rc/docs/sdks/metrics/README.md +0 -82
  87. package/packages/orq-rc/docs/sdks/models/README.md +0 -75
  88. package/packages/orq-rc/docs/sdks/orq/README.md +0 -10
  89. package/packages/orq-rc/docs/sdks/prompts/README.md +0 -550
  90. package/packages/orq-rc/docs/sdks/remoteconfigs/README.md +0 -76
  91. package/packages/orq-rc/jsr.json +0 -28
  92. package/packages/orq-rc/package-lock.json +0 -3206
  93. package/packages/orq-rc/package.json +0 -45
  94. package/packages/orq-rc/src/core.ts +0 -13
  95. package/packages/orq-rc/src/funcs/contactsCreate.ts +0 -165
  96. package/packages/orq-rc/src/funcs/contactsDelete.ts +0 -176
  97. package/packages/orq-rc/src/funcs/contactsList.ts +0 -169
  98. package/packages/orq-rc/src/funcs/contactsRetrieve.ts +0 -175
  99. package/packages/orq-rc/src/funcs/contactsUpdate.ts +0 -176
  100. package/packages/orq-rc/src/funcs/datasetsClear.ts +0 -167
  101. package/packages/orq-rc/src/funcs/datasetsCreate.ts +0 -165
  102. package/packages/orq-rc/src/funcs/datasetsCreateDatapoint.ts +0 -167
  103. package/packages/orq-rc/src/funcs/datasetsDelete.ts +0 -167
  104. package/packages/orq-rc/src/funcs/datasetsDeleteDatapoint.ts +0 -182
  105. package/packages/orq-rc/src/funcs/datasetsList.ts +0 -167
  106. package/packages/orq-rc/src/funcs/datasetsListDatapoints.ts +0 -174
  107. package/packages/orq-rc/src/funcs/datasetsRetrieve.ts +0 -175
  108. package/packages/orq-rc/src/funcs/datasetsRetrieveDatapoint.ts +0 -181
  109. package/packages/orq-rc/src/funcs/datasetsUpdate.ts +0 -176
  110. package/packages/orq-rc/src/funcs/datasetsUpdateDatapoint.ts +0 -179
  111. package/packages/orq-rc/src/funcs/deploymentsGetConfig.ts +0 -168
  112. package/packages/orq-rc/src/funcs/deploymentsInvoke.ts +0 -176
  113. package/packages/orq-rc/src/funcs/deploymentsList.ts +0 -176
  114. package/packages/orq-rc/src/funcs/deploymentsMetricsCreate.ts +0 -168
  115. package/packages/orq-rc/src/funcs/deploymentsStream.ts +0 -184
  116. package/packages/orq-rc/src/funcs/evalsAgeAppropriate.ts +0 -175
  117. package/packages/orq-rc/src/funcs/evalsAll.ts +0 -173
  118. package/packages/orq-rc/src/funcs/evalsBertScore.ts +0 -175
  119. package/packages/orq-rc/src/funcs/evalsBleuScore.ts +0 -175
  120. package/packages/orq-rc/src/funcs/evalsBotDetection.ts +0 -175
  121. package/packages/orq-rc/src/funcs/evalsContains.ts +0 -175
  122. package/packages/orq-rc/src/funcs/evalsContainsAll.ts +0 -175
  123. package/packages/orq-rc/src/funcs/evalsContainsAny.ts +0 -175
  124. package/packages/orq-rc/src/funcs/evalsContainsEmail.ts +0 -175
  125. package/packages/orq-rc/src/funcs/evalsContainsNone.ts +0 -175
  126. package/packages/orq-rc/src/funcs/evalsContainsUrl.ts +0 -175
  127. package/packages/orq-rc/src/funcs/evalsContainsValidLink.ts +0 -177
  128. package/packages/orq-rc/src/funcs/evalsCreate.ts +0 -169
  129. package/packages/orq-rc/src/funcs/evalsDelete.ts +0 -173
  130. package/packages/orq-rc/src/funcs/evalsEndsWith.ts +0 -175
  131. package/packages/orq-rc/src/funcs/evalsExactMatch.ts +0 -175
  132. package/packages/orq-rc/src/funcs/evalsFactCheckingKnowledgeBase.ts +0 -183
  133. package/packages/orq-rc/src/funcs/evalsGrammar.ts +0 -173
  134. package/packages/orq-rc/src/funcs/evalsInvoke.ts +0 -177
  135. package/packages/orq-rc/src/funcs/evalsLengthBetween.ts +0 -175
  136. package/packages/orq-rc/src/funcs/evalsLengthGreaterThan.ts +0 -177
  137. package/packages/orq-rc/src/funcs/evalsLengthLessThan.ts +0 -175
  138. package/packages/orq-rc/src/funcs/evalsLocalization.ts +0 -175
  139. package/packages/orq-rc/src/funcs/evalsPii.ts +0 -173
  140. package/packages/orq-rc/src/funcs/evalsRagasCoherence.ts +0 -175
  141. package/packages/orq-rc/src/funcs/evalsRagasConciseness.ts +0 -174
  142. package/packages/orq-rc/src/funcs/evalsRagasContextEntitiesRecall.ts +0 -183
  143. package/packages/orq-rc/src/funcs/evalsRagasContextPrecision.ts +0 -180
  144. package/packages/orq-rc/src/funcs/evalsRagasContextRecall.ts +0 -177
  145. package/packages/orq-rc/src/funcs/evalsRagasCorrectness.ts +0 -174
  146. package/packages/orq-rc/src/funcs/evalsRagasFaithfulness.ts +0 -177
  147. package/packages/orq-rc/src/funcs/evalsRagasHarmfulness.ts +0 -174
  148. package/packages/orq-rc/src/funcs/evalsRagasMaliciousness.ts +0 -177
  149. package/packages/orq-rc/src/funcs/evalsRagasNoiseSensitivity.ts +0 -180
  150. package/packages/orq-rc/src/funcs/evalsRagasResponseRelevancy.ts +0 -183
  151. package/packages/orq-rc/src/funcs/evalsRagasSummarization.ts +0 -177
  152. package/packages/orq-rc/src/funcs/evalsSentimentClassification.ts +0 -183
  153. package/packages/orq-rc/src/funcs/evalsSummarization.ts +0 -175
  154. package/packages/orq-rc/src/funcs/evalsToneOfVoice.ts +0 -175
  155. package/packages/orq-rc/src/funcs/evalsTranslation.ts +0 -175
  156. package/packages/orq-rc/src/funcs/evalsUpdate.ts +0 -173
  157. package/packages/orq-rc/src/funcs/evalsValidJson.ts +0 -175
  158. package/packages/orq-rc/src/funcs/feedbackCreate.ts +0 -160
  159. package/packages/orq-rc/src/funcs/filesCreate.ts +0 -187
  160. package/packages/orq-rc/src/funcs/filesDelete.ts +0 -164
  161. package/packages/orq-rc/src/funcs/filesGet.ts +0 -166
  162. package/packages/orq-rc/src/funcs/filesList.ts +0 -167
  163. package/packages/orq-rc/src/funcs/knowledgeBasesChunkText.ts +0 -160
  164. package/packages/orq-rc/src/funcs/knowledgeCreateChunks.ts +0 -171
  165. package/packages/orq-rc/src/funcs/knowledgeCreateDatasource.ts +0 -166
  166. package/packages/orq-rc/src/funcs/knowledgeDelete.ts +0 -167
  167. package/packages/orq-rc/src/funcs/knowledgeDeleteChunk.ts +0 -174
  168. package/packages/orq-rc/src/funcs/knowledgeDeleteDatasource.ts +0 -173
  169. package/packages/orq-rc/src/funcs/knowledgeList.ts +0 -169
  170. package/packages/orq-rc/src/funcs/knowledgeListChunks.ts +0 -178
  171. package/packages/orq-rc/src/funcs/knowledgeListDatasources.ts +0 -174
  172. package/packages/orq-rc/src/funcs/knowledgeRetrieve.ts +0 -166
  173. package/packages/orq-rc/src/funcs/knowledgeRetrieveChunk.ts +0 -173
  174. package/packages/orq-rc/src/funcs/knowledgeRetrieveDatasource.ts +0 -169
  175. package/packages/orq-rc/src/funcs/knowledgeSearch.ts +0 -167
  176. package/packages/orq-rc/src/funcs/knowledgeUpdate.ts +0 -164
  177. package/packages/orq-rc/src/funcs/knowledgeUpdateChunk.ts +0 -174
  178. package/packages/orq-rc/src/funcs/knowledgeUpdateDatasource.ts +0 -170
  179. package/packages/orq-rc/src/funcs/modelsList.ts +0 -142
  180. package/packages/orq-rc/src/funcs/promptsCreate.ts +0 -160
  181. package/packages/orq-rc/src/funcs/promptsDelete.ts +0 -164
  182. package/packages/orq-rc/src/funcs/promptsGetVersion.ts +0 -181
  183. package/packages/orq-rc/src/funcs/promptsList.ts +0 -167
  184. package/packages/orq-rc/src/funcs/promptsListVersions.ts +0 -173
  185. package/packages/orq-rc/src/funcs/promptsRetrieve.ts +0 -166
  186. package/packages/orq-rc/src/funcs/promptsUpdate.ts +0 -173
  187. package/packages/orq-rc/src/funcs/remoteconfigsRetrieve.ts +0 -161
  188. package/packages/orq-rc/src/hooks/global.ts +0 -44
  189. package/packages/orq-rc/src/hooks/hooks.ts +0 -132
  190. package/packages/orq-rc/src/hooks/index.ts +0 -6
  191. package/packages/orq-rc/src/hooks/registration.ts +0 -15
  192. package/packages/orq-rc/src/hooks/types.ts +0 -112
  193. package/packages/orq-rc/src/index.ts +0 -9
  194. package/packages/orq-rc/src/lib/base64.ts +0 -37
  195. package/packages/orq-rc/src/lib/config.ts +0 -74
  196. package/packages/orq-rc/src/lib/dlv.ts +0 -53
  197. package/packages/orq-rc/src/lib/encodings.ts +0 -483
  198. package/packages/orq-rc/src/lib/env.ts +0 -73
  199. package/packages/orq-rc/src/lib/event-streams.ts +0 -264
  200. package/packages/orq-rc/src/lib/files.ts +0 -82
  201. package/packages/orq-rc/src/lib/http.ts +0 -323
  202. package/packages/orq-rc/src/lib/is-plain-object.ts +0 -43
  203. package/packages/orq-rc/src/lib/logger.ts +0 -9
  204. package/packages/orq-rc/src/lib/matchers.ts +0 -348
  205. package/packages/orq-rc/src/lib/primitives.ts +0 -150
  206. package/packages/orq-rc/src/lib/retries.ts +0 -218
  207. package/packages/orq-rc/src/lib/schemas.ts +0 -91
  208. package/packages/orq-rc/src/lib/sdks.ts +0 -407
  209. package/packages/orq-rc/src/lib/security.ts +0 -261
  210. package/packages/orq-rc/src/lib/url.ts +0 -33
  211. package/packages/orq-rc/src/mcp-server/cli/start/command.ts +0 -112
  212. package/packages/orq-rc/src/mcp-server/cli/start/impl.ts +0 -136
  213. package/packages/orq-rc/src/mcp-server/cli.ts +0 -13
  214. package/packages/orq-rc/src/mcp-server/console-logger.ts +0 -71
  215. package/packages/orq-rc/src/mcp-server/extensions.ts +0 -17
  216. package/packages/orq-rc/src/mcp-server/mcp-server.ts +0 -26
  217. package/packages/orq-rc/src/mcp-server/prompts.ts +0 -117
  218. package/packages/orq-rc/src/mcp-server/resources.ts +0 -172
  219. package/packages/orq-rc/src/mcp-server/scopes.ts +0 -7
  220. package/packages/orq-rc/src/mcp-server/server.ts +0 -249
  221. package/packages/orq-rc/src/mcp-server/shared.ts +0 -75
  222. package/packages/orq-rc/src/mcp-server/tools/contactsCreate.ts +0 -37
  223. package/packages/orq-rc/src/mcp-server/tools/contactsDelete.ts +0 -35
  224. package/packages/orq-rc/src/mcp-server/tools/contactsList.ts +0 -37
  225. package/packages/orq-rc/src/mcp-server/tools/contactsRetrieve.ts +0 -37
  226. package/packages/orq-rc/src/mcp-server/tools/contactsUpdate.ts +0 -37
  227. package/packages/orq-rc/src/mcp-server/tools/datasetsClear.ts +0 -35
  228. package/packages/orq-rc/src/mcp-server/tools/datasetsCreate.ts +0 -37
  229. package/packages/orq-rc/src/mcp-server/tools/datasetsCreateDatapoint.ts +0 -37
  230. package/packages/orq-rc/src/mcp-server/tools/datasetsDelete.ts +0 -35
  231. package/packages/orq-rc/src/mcp-server/tools/datasetsDeleteDatapoint.ts +0 -35
  232. package/packages/orq-rc/src/mcp-server/tools/datasetsList.ts +0 -37
  233. package/packages/orq-rc/src/mcp-server/tools/datasetsListDatapoints.ts +0 -37
  234. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieve.ts +0 -37
  235. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieveDatapoint.ts +0 -37
  236. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdate.ts +0 -37
  237. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdateDatapoint.ts +0 -35
  238. package/packages/orq-rc/src/mcp-server/tools/deploymentsGetConfig.ts +0 -37
  239. package/packages/orq-rc/src/mcp-server/tools/deploymentsInvoke.ts +0 -37
  240. package/packages/orq-rc/src/mcp-server/tools/deploymentsList.ts +0 -37
  241. package/packages/orq-rc/src/mcp-server/tools/deploymentsMetricsCreate.ts +0 -37
  242. package/packages/orq-rc/src/mcp-server/tools/deploymentsStream.ts +0 -37
  243. package/packages/orq-rc/src/mcp-server/tools/evalsAgeAppropriate.ts +0 -35
  244. package/packages/orq-rc/src/mcp-server/tools/evalsAll.ts +0 -35
  245. package/packages/orq-rc/src/mcp-server/tools/evalsBertScore.ts +0 -35
  246. package/packages/orq-rc/src/mcp-server/tools/evalsBleuScore.ts +0 -35
  247. package/packages/orq-rc/src/mcp-server/tools/evalsBotDetection.ts +0 -35
  248. package/packages/orq-rc/src/mcp-server/tools/evalsContains.ts +0 -35
  249. package/packages/orq-rc/src/mcp-server/tools/evalsContainsAll.ts +0 -35
  250. package/packages/orq-rc/src/mcp-server/tools/evalsContainsAny.ts +0 -35
  251. package/packages/orq-rc/src/mcp-server/tools/evalsContainsEmail.ts +0 -35
  252. package/packages/orq-rc/src/mcp-server/tools/evalsContainsNone.ts +0 -35
  253. package/packages/orq-rc/src/mcp-server/tools/evalsContainsUrl.ts +0 -35
  254. package/packages/orq-rc/src/mcp-server/tools/evalsContainsValidLink.ts +0 -36
  255. package/packages/orq-rc/src/mcp-server/tools/evalsCreate.ts +0 -35
  256. package/packages/orq-rc/src/mcp-server/tools/evalsDelete.ts +0 -33
  257. package/packages/orq-rc/src/mcp-server/tools/evalsEndsWith.ts +0 -35
  258. package/packages/orq-rc/src/mcp-server/tools/evalsExactMatch.ts +0 -35
  259. package/packages/orq-rc/src/mcp-server/tools/evalsFactCheckingKnowledgeBase.ts +0 -37
  260. package/packages/orq-rc/src/mcp-server/tools/evalsGrammar.ts +0 -35
  261. package/packages/orq-rc/src/mcp-server/tools/evalsInvoke.ts +0 -35
  262. package/packages/orq-rc/src/mcp-server/tools/evalsLengthBetween.ts +0 -35
  263. package/packages/orq-rc/src/mcp-server/tools/evalsLengthGreaterThan.ts +0 -36
  264. package/packages/orq-rc/src/mcp-server/tools/evalsLengthLessThan.ts +0 -35
  265. package/packages/orq-rc/src/mcp-server/tools/evalsLocalization.ts +0 -35
  266. package/packages/orq-rc/src/mcp-server/tools/evalsPii.ts +0 -35
  267. package/packages/orq-rc/src/mcp-server/tools/evalsRagasCoherence.ts +0 -35
  268. package/packages/orq-rc/src/mcp-server/tools/evalsRagasConciseness.ts +0 -35
  269. package/packages/orq-rc/src/mcp-server/tools/evalsRagasContextEntitiesRecall.ts +0 -37
  270. package/packages/orq-rc/src/mcp-server/tools/evalsRagasContextPrecision.ts +0 -36
  271. package/packages/orq-rc/src/mcp-server/tools/evalsRagasContextRecall.ts +0 -36
  272. package/packages/orq-rc/src/mcp-server/tools/evalsRagasCorrectness.ts +0 -35
  273. package/packages/orq-rc/src/mcp-server/tools/evalsRagasFaithfulness.ts +0 -36
  274. package/packages/orq-rc/src/mcp-server/tools/evalsRagasHarmfulness.ts +0 -35
  275. package/packages/orq-rc/src/mcp-server/tools/evalsRagasMaliciousness.ts +0 -36
  276. package/packages/orq-rc/src/mcp-server/tools/evalsRagasNoiseSensitivity.ts +0 -36
  277. package/packages/orq-rc/src/mcp-server/tools/evalsRagasResponseRelevancy.ts +0 -36
  278. package/packages/orq-rc/src/mcp-server/tools/evalsRagasSummarization.ts +0 -36
  279. package/packages/orq-rc/src/mcp-server/tools/evalsSentimentClassification.ts +0 -36
  280. package/packages/orq-rc/src/mcp-server/tools/evalsSummarization.ts +0 -35
  281. package/packages/orq-rc/src/mcp-server/tools/evalsToneOfVoice.ts +0 -35
  282. package/packages/orq-rc/src/mcp-server/tools/evalsTranslation.ts +0 -35
  283. package/packages/orq-rc/src/mcp-server/tools/evalsUpdate.ts +0 -35
  284. package/packages/orq-rc/src/mcp-server/tools/evalsValidJson.ts +0 -35
  285. package/packages/orq-rc/src/mcp-server/tools/feedbackCreate.ts +0 -37
  286. package/packages/orq-rc/src/mcp-server/tools/filesCreate.ts +0 -37
  287. package/packages/orq-rc/src/mcp-server/tools/filesDelete.ts +0 -33
  288. package/packages/orq-rc/src/mcp-server/tools/filesGet.ts +0 -37
  289. package/packages/orq-rc/src/mcp-server/tools/filesList.ts +0 -37
  290. package/packages/orq-rc/src/mcp-server/tools/knowledgeBasesChunkText.ts +0 -37
  291. package/packages/orq-rc/src/mcp-server/tools/knowledgeCreateChunks.ts +0 -35
  292. package/packages/orq-rc/src/mcp-server/tools/knowledgeCreateDatasource.ts +0 -35
  293. package/packages/orq-rc/src/mcp-server/tools/knowledgeDelete.ts +0 -35
  294. package/packages/orq-rc/src/mcp-server/tools/knowledgeDeleteChunk.ts +0 -33
  295. package/packages/orq-rc/src/mcp-server/tools/knowledgeDeleteDatasource.ts +0 -35
  296. package/packages/orq-rc/src/mcp-server/tools/knowledgeList.ts +0 -37
  297. package/packages/orq-rc/src/mcp-server/tools/knowledgeListChunks.ts +0 -35
  298. package/packages/orq-rc/src/mcp-server/tools/knowledgeListDatasources.ts +0 -35
  299. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieve.ts +0 -37
  300. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieveChunk.ts +0 -35
  301. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieveDatasource.ts +0 -35
  302. package/packages/orq-rc/src/mcp-server/tools/knowledgeSearch.ts +0 -37
  303. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdate.ts +0 -35
  304. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdateChunk.ts +0 -35
  305. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdateDatasource.ts +0 -35
  306. package/packages/orq-rc/src/mcp-server/tools/modelsList.ts +0 -30
  307. package/packages/orq-rc/src/mcp-server/tools/promptsCreate.ts +0 -35
  308. package/packages/orq-rc/src/mcp-server/tools/promptsDelete.ts +0 -33
  309. package/packages/orq-rc/src/mcp-server/tools/promptsGetVersion.ts +0 -37
  310. package/packages/orq-rc/src/mcp-server/tools/promptsList.ts +0 -37
  311. package/packages/orq-rc/src/mcp-server/tools/promptsListVersions.ts +0 -37
  312. package/packages/orq-rc/src/mcp-server/tools/promptsRetrieve.ts +0 -37
  313. package/packages/orq-rc/src/mcp-server/tools/promptsUpdate.ts +0 -35
  314. package/packages/orq-rc/src/mcp-server/tools/remoteconfigsRetrieve.ts +0 -36
  315. package/packages/orq-rc/src/mcp-server/tools.ts +0 -129
  316. package/packages/orq-rc/src/models/components/deployments.ts +0 -7289
  317. package/packages/orq-rc/src/models/components/index.ts +0 -6
  318. package/packages/orq-rc/src/models/components/security.ts +0 -71
  319. package/packages/orq-rc/src/models/errors/apierror.ts +0 -40
  320. package/packages/orq-rc/src/models/errors/createeval.ts +0 -80
  321. package/packages/orq-rc/src/models/errors/deletecontact.ts +0 -91
  322. package/packages/orq-rc/src/models/errors/deleteeval.ts +0 -80
  323. package/packages/orq-rc/src/models/errors/evalsageappropriate.ts +0 -156
  324. package/packages/orq-rc/src/models/errors/evalsbertscore.ts +0 -154
  325. package/packages/orq-rc/src/models/errors/evalsbleuscore.ts +0 -154
  326. package/packages/orq-rc/src/models/errors/evalsbotdetection.ts +0 -155
  327. package/packages/orq-rc/src/models/errors/evalscontains.ts +0 -154
  328. package/packages/orq-rc/src/models/errors/evalscontainsall.ts +0 -155
  329. package/packages/orq-rc/src/models/errors/evalscontainsany.ts +0 -155
  330. package/packages/orq-rc/src/models/errors/evalscontainsemail.ts +0 -156
  331. package/packages/orq-rc/src/models/errors/evalscontainsnone.ts +0 -155
  332. package/packages/orq-rc/src/models/errors/evalscontainsurl.ts +0 -155
  333. package/packages/orq-rc/src/models/errors/evalscontainsvalidlink.ts +0 -157
  334. package/packages/orq-rc/src/models/errors/evalsendswith.ts +0 -154
  335. package/packages/orq-rc/src/models/errors/evalsexactmatch.ts +0 -154
  336. package/packages/orq-rc/src/models/errors/evalsfactcheckingknowledgebase.ts +0 -160
  337. package/packages/orq-rc/src/models/errors/evalsgrammar.ts +0 -154
  338. package/packages/orq-rc/src/models/errors/evalslengthbetween.ts +0 -156
  339. package/packages/orq-rc/src/models/errors/evalslengthgreaterthan.ts +0 -157
  340. package/packages/orq-rc/src/models/errors/evalslengthlessthan.ts +0 -156
  341. package/packages/orq-rc/src/models/errors/evalslocalization.ts +0 -155
  342. package/packages/orq-rc/src/models/errors/evalspii.ts +0 -154
  343. package/packages/orq-rc/src/models/errors/evalsragascoherence.ts +0 -156
  344. package/packages/orq-rc/src/models/errors/evalsragasconciseness.ts +0 -157
  345. package/packages/orq-rc/src/models/errors/evalsragascontextentitiesrecall.ts +0 -163
  346. package/packages/orq-rc/src/models/errors/evalsragascontextprecision.ts +0 -160
  347. package/packages/orq-rc/src/models/errors/evalsragascontextrecall.ts +0 -158
  348. package/packages/orq-rc/src/models/errors/evalsragascorrectness.ts +0 -157
  349. package/packages/orq-rc/src/models/errors/evalsragasfaithfulness.ts +0 -157
  350. package/packages/orq-rc/src/models/errors/evalsragasharmfulness.ts +0 -157
  351. package/packages/orq-rc/src/models/errors/evalsragasmaliciousness.ts +0 -158
  352. package/packages/orq-rc/src/models/errors/evalsragasnoisesensitivity.ts +0 -160
  353. package/packages/orq-rc/src/models/errors/evalsragasresponserelevancy.ts +0 -160
  354. package/packages/orq-rc/src/models/errors/evalsragassummarization.ts +0 -158
  355. package/packages/orq-rc/src/models/errors/evalssentimentclassification.ts +0 -160
  356. package/packages/orq-rc/src/models/errors/evalssummarization.ts +0 -156
  357. package/packages/orq-rc/src/models/errors/evalstoneofvoice.ts +0 -155
  358. package/packages/orq-rc/src/models/errors/evalstranslation.ts +0 -155
  359. package/packages/orq-rc/src/models/errors/evalsvalidjson.ts +0 -154
  360. package/packages/orq-rc/src/models/errors/getevals.ts +0 -80
  361. package/packages/orq-rc/src/models/errors/getpromptversion.ts +0 -80
  362. package/packages/orq-rc/src/models/errors/honoapierror.ts +0 -90
  363. package/packages/orq-rc/src/models/errors/httpclienterrors.ts +0 -62
  364. package/packages/orq-rc/src/models/errors/index.ts +0 -56
  365. package/packages/orq-rc/src/models/errors/invokeeval.ts +0 -154
  366. package/packages/orq-rc/src/models/errors/orqerror.ts +0 -35
  367. package/packages/orq-rc/src/models/errors/responsevalidationerror.ts +0 -50
  368. package/packages/orq-rc/src/models/errors/retrievecontact.ts +0 -91
  369. package/packages/orq-rc/src/models/errors/sdkvalidationerror.ts +0 -109
  370. package/packages/orq-rc/src/models/errors/updatecontact.ts +0 -83
  371. package/packages/orq-rc/src/models/errors/updateeval.ts +0 -80
  372. package/packages/orq-rc/src/models/errors/updateprompt.ts +0 -80
  373. package/packages/orq-rc/src/models/operations/chunktext.ts +0 -1629
  374. package/packages/orq-rc/src/models/operations/cleardataset.ts +0 -75
  375. package/packages/orq-rc/src/models/operations/createchunk.ts +0 -428
  376. package/packages/orq-rc/src/models/operations/createcontact.ts +0 -267
  377. package/packages/orq-rc/src/models/operations/createdataset.ts +0 -296
  378. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +0 -5222
  379. package/packages/orq-rc/src/models/operations/createdatasource.ts +0 -852
  380. package/packages/orq-rc/src/models/operations/createeval.ts +0 -3830
  381. package/packages/orq-rc/src/models/operations/createfeedback.ts +0 -286
  382. package/packages/orq-rc/src/models/operations/createprompt.ts +0 -4083
  383. package/packages/orq-rc/src/models/operations/deletechunk.ts +0 -96
  384. package/packages/orq-rc/src/models/operations/deletecontact.ts +0 -69
  385. package/packages/orq-rc/src/models/operations/deletedatapoint.ts +0 -81
  386. package/packages/orq-rc/src/models/operations/deletedataset.ts +0 -75
  387. package/packages/orq-rc/src/models/operations/deletedatasource.ts +0 -87
  388. package/packages/orq-rc/src/models/operations/deleteeval.ts +0 -66
  389. package/packages/orq-rc/src/models/operations/deleteknowledge.ts +0 -78
  390. package/packages/orq-rc/src/models/operations/deleteprompt.ts +0 -69
  391. package/packages/orq-rc/src/models/operations/deploymentcreatemetric.ts +0 -5439
  392. package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +0 -9379
  393. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +0 -1256
  394. package/packages/orq-rc/src/models/operations/deployments.ts +0 -2328
  395. package/packages/orq-rc/src/models/operations/deploymentstream.ts +0 -9499
  396. package/packages/orq-rc/src/models/operations/evalsageappropriate.ts +0 -253
  397. package/packages/orq-rc/src/models/operations/evalsbertscore.ts +0 -197
  398. package/packages/orq-rc/src/models/operations/evalsbleuscore.ts +0 -131
  399. package/packages/orq-rc/src/models/operations/evalsbotdetection.ts +0 -249
  400. package/packages/orq-rc/src/models/operations/evalscontains.ts +0 -250
  401. package/packages/orq-rc/src/models/operations/evalscontainsall.ts +0 -248
  402. package/packages/orq-rc/src/models/operations/evalscontainsany.ts +0 -254
  403. package/packages/orq-rc/src/models/operations/evalscontainsemail.ts +0 -181
  404. package/packages/orq-rc/src/models/operations/evalscontainsnone.ts +0 -254
  405. package/packages/orq-rc/src/models/operations/evalscontainsurl.ts +0 -181
  406. package/packages/orq-rc/src/models/operations/evalscontainsvalidlink.ts +0 -186
  407. package/packages/orq-rc/src/models/operations/evalsendswith.ts +0 -250
  408. package/packages/orq-rc/src/models/operations/evalsexactmatch.ts +0 -183
  409. package/packages/orq-rc/src/models/operations/evalsfactcheckingknowledgebase.ts +0 -299
  410. package/packages/orq-rc/src/models/operations/evalsgrammar.ts +0 -243
  411. package/packages/orq-rc/src/models/operations/evalslengthbetween.ts +0 -268
  412. package/packages/orq-rc/src/models/operations/evalslengthgreaterthan.ts +0 -266
  413. package/packages/orq-rc/src/models/operations/evalslengthlessthan.ts +0 -259
  414. package/packages/orq-rc/src/models/operations/evalslocalization.ts +0 -253
  415. package/packages/orq-rc/src/models/operations/evalspii.ts +0 -243
  416. package/packages/orq-rc/src/models/operations/evalsragascoherence.ts +0 -152
  417. package/packages/orq-rc/src/models/operations/evalsragasconciseness.ts +0 -153
  418. package/packages/orq-rc/src/models/operations/evalsragascontextentitiesrecall.ts +0 -164
  419. package/packages/orq-rc/src/models/operations/evalsragascontextprecision.ts +0 -166
  420. package/packages/orq-rc/src/models/operations/evalsragascontextrecall.ts +0 -164
  421. package/packages/orq-rc/src/models/operations/evalsragascorrectness.ts +0 -153
  422. package/packages/orq-rc/src/models/operations/evalsragasfaithfulness.ts +0 -155
  423. package/packages/orq-rc/src/models/operations/evalsragasharmfulness.ts +0 -146
  424. package/packages/orq-rc/src/models/operations/evalsragasmaliciousness.ts +0 -157
  425. package/packages/orq-rc/src/models/operations/evalsragasnoisesensitivity.ts +0 -166
  426. package/packages/orq-rc/src/models/operations/evalsragasresponserelevancy.ts +0 -165
  427. package/packages/orq-rc/src/models/operations/evalsragassummarization.ts +0 -150
  428. package/packages/orq-rc/src/models/operations/evalssentimentclassification.ts +0 -285
  429. package/packages/orq-rc/src/models/operations/evalssummarization.ts +0 -253
  430. package/packages/orq-rc/src/models/operations/evalstoneofvoice.ts +0 -251
  431. package/packages/orq-rc/src/models/operations/evalstranslation.ts +0 -251
  432. package/packages/orq-rc/src/models/operations/evalsvalidjson.ts +0 -177
  433. package/packages/orq-rc/src/models/operations/filedelete.ts +0 -78
  434. package/packages/orq-rc/src/models/operations/fileget.ts +0 -223
  435. package/packages/orq-rc/src/models/operations/filelist.ts +0 -337
  436. package/packages/orq-rc/src/models/operations/fileupload.ts +0 -327
  437. package/packages/orq-rc/src/models/operations/getallprompts.ts +0 -2296
  438. package/packages/orq-rc/src/models/operations/getevals.ts +0 -6163
  439. package/packages/orq-rc/src/models/operations/getonechunk.ts +0 -315
  440. package/packages/orq-rc/src/models/operations/getoneknowledge.ts +0 -537
  441. package/packages/orq-rc/src/models/operations/getoneprompt.ts +0 -2157
  442. package/packages/orq-rc/src/models/operations/getpromptversion.ts +0 -2162
  443. package/packages/orq-rc/src/models/operations/index.ts +0 -97
  444. package/packages/orq-rc/src/models/operations/invokeeval.ts +0 -2520
  445. package/packages/orq-rc/src/models/operations/listchunks.ts +0 -494
  446. package/packages/orq-rc/src/models/operations/listcontacts.ts +0 -490
  447. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +0 -2784
  448. package/packages/orq-rc/src/models/operations/listdatasets.ts +0 -406
  449. package/packages/orq-rc/src/models/operations/listdatasources.ts +0 -447
  450. package/packages/orq-rc/src/models/operations/listknowledgebases.ts +0 -663
  451. package/packages/orq-rc/src/models/operations/listmodels.ts +0 -273
  452. package/packages/orq-rc/src/models/operations/listpromptversions.ts +0 -2294
  453. package/packages/orq-rc/src/models/operations/remoteconfigsgetconfig.ts +0 -190
  454. package/packages/orq-rc/src/models/operations/retrievecontact.ts +0 -210
  455. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +0 -2586
  456. package/packages/orq-rc/src/models/operations/retrievedataset.ts +0 -288
  457. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +0 -273
  458. package/packages/orq-rc/src/models/operations/searchknowledge.ts +0 -3367
  459. package/packages/orq-rc/src/models/operations/updatechunk.ts +0 -448
  460. package/packages/orq-rc/src/models/operations/updatecontact.ts +0 -325
  461. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +0 -5155
  462. package/packages/orq-rc/src/models/operations/updatedataset.ts +0 -393
  463. package/packages/orq-rc/src/models/operations/updatedatasource.ts +0 -345
  464. package/packages/orq-rc/src/models/operations/updateeval.ts +0 -4131
  465. package/packages/orq-rc/src/models/operations/updateknowledge.ts +0 -920
  466. package/packages/orq-rc/src/models/operations/updateprompt.ts +0 -4220
  467. package/packages/orq-rc/src/sdk/contacts.ts +0 -99
  468. package/packages/orq-rc/src/sdk/datasets.ts +0 -204
  469. package/packages/orq-rc/src/sdk/deployments.ts +0 -89
  470. package/packages/orq-rc/src/sdk/evals.ts +0 -639
  471. package/packages/orq-rc/src/sdk/feedback.ts +0 -27
  472. package/packages/orq-rc/src/sdk/files.ts +0 -78
  473. package/packages/orq-rc/src/sdk/index.ts +0 -5
  474. package/packages/orq-rc/src/sdk/knowledge.ts +0 -249
  475. package/packages/orq-rc/src/sdk/knowledgebases.ts +0 -27
  476. package/packages/orq-rc/src/sdk/metrics.ts +0 -27
  477. package/packages/orq-rc/src/sdk/models.ts +0 -25
  478. package/packages/orq-rc/src/sdk/prompts.ts +0 -126
  479. package/packages/orq-rc/src/sdk/remoteconfigs.ts +0 -24
  480. package/packages/orq-rc/src/sdk/sdk.ts +0 -73
  481. package/packages/orq-rc/src/types/async.ts +0 -68
  482. package/packages/orq-rc/src/types/blobs.ts +0 -31
  483. package/packages/orq-rc/src/types/constdatetime.ts +0 -15
  484. package/packages/orq-rc/src/types/enums.ts +0 -16
  485. package/packages/orq-rc/src/types/fp.ts +0 -50
  486. package/packages/orq-rc/src/types/index.ts +0 -11
  487. package/packages/orq-rc/src/types/operations.ts +0 -105
  488. package/packages/orq-rc/src/types/rfcdate.ts +0 -54
  489. package/packages/orq-rc/src/types/streams.ts +0 -21
  490. package/packages/orq-rc/tsconfig.json +0 -41
@@ -1,958 +0,0 @@
1
- # @orq-ai/node
2
-
3
- Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@orq-ai/node* API.
4
-
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>
11
-
12
- <!-- Start Summary [summary] -->
13
- ## Summary
14
-
15
- orq.ai API: orq.ai API documentation
16
-
17
- For more information about the API: [orq.ai Documentation](https://docs.orq.ai)
18
- <!-- End Summary [summary] -->
19
-
20
- <!-- Start Table of Contents [toc] -->
21
- ## Table of Contents
22
- <!-- $toc-max-depth=2 -->
23
- * [@orq-ai/node](#orq-ainode)
24
- * [SDK Installation](#sdk-installation)
25
- * [Requirements](#requirements)
26
- * [SDK Example Usage](#sdk-example-usage)
27
- * [Authentication](#authentication)
28
- * [Available Resources and Operations](#available-resources-and-operations)
29
- * [Standalone functions](#standalone-functions)
30
- * [Server-sent event streaming](#server-sent-event-streaming)
31
- * [File uploads](#file-uploads)
32
- * [Retries](#retries)
33
- * [Error Handling](#error-handling)
34
- * [Server Selection](#server-selection)
35
- * [Custom HTTP Client](#custom-http-client)
36
- * [Debugging](#debugging)
37
- * [Development](#development)
38
- * [Maturity](#maturity)
39
- * [Contributions](#contributions)
40
-
41
- <!-- End Table of Contents [toc] -->
42
-
43
- <!-- Start SDK Installation [installation] -->
44
- ## SDK Installation
45
-
46
- 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.
47
-
48
- ### NPM
49
-
50
- ```bash
51
- npm add @orq-ai/node
52
- ```
53
-
54
- ### PNPM
55
-
56
- ```bash
57
- pnpm add @orq-ai/node
58
- ```
59
-
60
- ### Bun
61
-
62
- ```bash
63
- bun add @orq-ai/node
64
- ```
65
-
66
- ### Yarn
67
-
68
- ```bash
69
- yarn add @orq-ai/node zod
70
-
71
- # Note that Yarn does not install peer dependencies automatically. You will need
72
- # to install zod as shown above.
73
- ```
74
-
75
-
76
-
77
- ### Model Context Protocol (MCP) Server
78
-
79
- This SDK is also an installable MCP server where the various SDK methods are
80
- exposed as tools that can be invoked by AI applications.
81
-
82
- > Node.js v20 or greater is required to run the MCP server from npm.
83
-
84
- <details>
85
- <summary>Claude installation steps</summary>
86
-
87
- Add the following server definition to your `claude_desktop_config.json` file:
88
-
89
- ```json
90
- {
91
- "mcpServers": {
92
- "Orq": {
93
- "command": "npx",
94
- "args": [
95
- "-y", "--package", "@orq-ai/node",
96
- "--",
97
- "mcp", "start",
98
- "--api-key", "...",
99
- "--contact-id", "...",
100
- "--environment", "..."
101
- ]
102
- }
103
- }
104
- }
105
- ```
106
-
107
- </details>
108
-
109
- <details>
110
- <summary>Cursor installation steps</summary>
111
-
112
- Create a `.cursor/mcp.json` file in your project root with the following content:
113
-
114
- ```json
115
- {
116
- "mcpServers": {
117
- "Orq": {
118
- "command": "npx",
119
- "args": [
120
- "-y", "--package", "@orq-ai/node",
121
- "--",
122
- "mcp", "start",
123
- "--api-key", "...",
124
- "--contact-id", "...",
125
- "--environment", "..."
126
- ]
127
- }
128
- }
129
- }
130
- ```
131
-
132
- </details>
133
-
134
- You can also run MCP servers as a standalone binary with no additional dependencies. You must pull these binaries from available Github releases:
135
-
136
- ```bash
137
- curl -L -o mcp-server \
138
- https://github.com/{org}/{repo}/releases/download/{tag}/mcp-server-bun-darwin-arm64 && \
139
- chmod +x mcp-server
140
- ```
141
-
142
- If the repo is a private repo you must add your Github PAT to download a release `-H "Authorization: Bearer {GITHUB_PAT}"`.
143
-
144
-
145
- ```json
146
- {
147
- "mcpServers": {
148
- "Todos": {
149
- "command": "./DOWNLOAD/PATH/mcp-server",
150
- "args": [
151
- "start"
152
- ]
153
- }
154
- }
155
- }
156
- ```
157
-
158
- For a full list of server arguments, run:
159
-
160
- ```sh
161
- npx -y --package @orq-ai/node -- mcp start --help
162
- ```
163
- <!-- End SDK Installation [installation] -->
164
-
165
- <!-- Start Requirements [requirements] -->
166
- ## Requirements
167
-
168
- For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
169
- <!-- End Requirements [requirements] -->
170
-
171
- <!-- Start SDK Example Usage [usage] -->
172
- ## SDK Example Usage
173
-
174
- ### Example
175
-
176
- ```typescript
177
- import { Orq } from "@orq-ai/node";
178
-
179
- const orq = new Orq({
180
- apiKey: process.env["ORQ_API_KEY"] ?? "",
181
- });
182
-
183
- async function run() {
184
- const result = await orq.contacts.create({
185
- externalId: "user_12345",
186
- displayName: "Jane Smith",
187
- email: "jane.smith@example.com",
188
- avatarUrl: "https://example.com/avatars/jane-smith.jpg",
189
- tags: [
190
- "premium",
191
- "beta-user",
192
- "enterprise",
193
- ],
194
- metadata: {
195
- "department": "Engineering",
196
- "role": "Senior Developer",
197
- "subscription_tier": "premium",
198
- "last_login": "2024-01-15T10:30:00Z",
199
- },
200
- });
201
-
202
- console.log(result);
203
- }
204
-
205
- run();
206
-
207
- ```
208
- <!-- End SDK Example Usage [usage] -->
209
-
210
- <!-- Start Authentication [security] -->
211
- ## Authentication
212
-
213
- ### Per-Client Security Schemes
214
-
215
- This SDK supports the following security scheme globally:
216
-
217
- | Name | Type | Scheme | Environment Variable |
218
- | -------- | ---- | ----------- | -------------------- |
219
- | `apiKey` | http | HTTP Bearer | `ORQ_API_KEY` |
220
-
221
- To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
222
- ```typescript
223
- import { Orq } from "@orq-ai/node";
224
-
225
- const orq = new Orq({
226
- apiKey: process.env["ORQ_API_KEY"] ?? "",
227
- });
228
-
229
- async function run() {
230
- const result = await orq.contacts.create({
231
- externalId: "user_12345",
232
- displayName: "Jane Smith",
233
- email: "jane.smith@example.com",
234
- avatarUrl: "https://example.com/avatars/jane-smith.jpg",
235
- tags: [
236
- "premium",
237
- "beta-user",
238
- "enterprise",
239
- ],
240
- metadata: {
241
- "department": "Engineering",
242
- "role": "Senior Developer",
243
- "subscription_tier": "premium",
244
- "last_login": "2024-01-15T10:30:00Z",
245
- },
246
- });
247
-
248
- console.log(result);
249
- }
250
-
251
- run();
252
-
253
- ```
254
- <!-- End Authentication [security] -->
255
-
256
- <!-- Start Available Resources and Operations [operations] -->
257
- ## Available Resources and Operations
258
-
259
- <details open>
260
- <summary>Available methods</summary>
261
-
262
- ### [contacts](docs/sdks/contacts/README.md)
263
-
264
- * [create](docs/sdks/contacts/README.md#create) - Create a contact
265
- * [list](docs/sdks/contacts/README.md#list) - List contacts
266
- * [retrieve](docs/sdks/contacts/README.md#retrieve) - Retrieve a contact
267
- * [update](docs/sdks/contacts/README.md#update) - Update a contact
268
- * [delete](docs/sdks/contacts/README.md#delete) - Delete a contact
269
-
270
- ### [datasets](docs/sdks/datasets/README.md)
271
-
272
- * [list](docs/sdks/datasets/README.md#list) - List datasets
273
- * [create](docs/sdks/datasets/README.md#create) - Create a dataset
274
- * [retrieve](docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
275
- * [update](docs/sdks/datasets/README.md#update) - Update a dataset
276
- * [delete](docs/sdks/datasets/README.md#delete) - Delete a dataset
277
- * [listDatapoints](docs/sdks/datasets/README.md#listdatapoints) - List datapoints
278
- * [createDatapoint](docs/sdks/datasets/README.md#createdatapoint) - Create a datapoint
279
- * [retrieveDatapoint](docs/sdks/datasets/README.md#retrievedatapoint) - Retrieve a datapoint
280
- * [updateDatapoint](docs/sdks/datasets/README.md#updatedatapoint) - Update a datapoint
281
- * [deleteDatapoint](docs/sdks/datasets/README.md#deletedatapoint) - Delete a datapoint
282
- * [clear](docs/sdks/datasets/README.md#clear) - Delete all datapoints
283
-
284
- ### [deployments](docs/sdks/deployments/README.md)
285
-
286
- * [list](docs/sdks/deployments/README.md#list) - List all deployments
287
- * [getConfig](docs/sdks/deployments/README.md#getconfig) - Get config
288
- * [invoke](docs/sdks/deployments/README.md#invoke) - Invoke
289
- * [stream](docs/sdks/deployments/README.md#stream) - Stream
290
-
291
- #### [deployments.metrics](docs/sdks/metrics/README.md)
292
-
293
- * [create](docs/sdks/metrics/README.md#create) - Add metrics
294
-
295
- ### [evals](docs/sdks/evals/README.md)
296
-
297
- * [all](docs/sdks/evals/README.md#all) - Get all Evaluators
298
- * [create](docs/sdks/evals/README.md#create) - Create an Evaluator
299
- * [update](docs/sdks/evals/README.md#update) - Update an Evaluator
300
- * [delete](docs/sdks/evals/README.md#delete) - Delete an Evaluator
301
- * [bertScore](docs/sdks/evals/README.md#bertscore) - Run BertScore Evaluator
302
- * [bleuScore](docs/sdks/evals/README.md#bleuscore) - Run BLEU Score Evaluator
303
- * [containsAll](docs/sdks/evals/README.md#containsall) - Run Contains All Evaluator
304
- * [containsAny](docs/sdks/evals/README.md#containsany) - Run Contains Any Evaluator
305
- * [containsEmail](docs/sdks/evals/README.md#containsemail) - Run Contains Email Evaluator
306
- * [containsNone](docs/sdks/evals/README.md#containsnone) - Run Contains None Evaluator
307
- * [containsUrl](docs/sdks/evals/README.md#containsurl) - Run Contains URL Evaluator
308
- * [containsValidLink](docs/sdks/evals/README.md#containsvalidlink) - Run Contains Valid Link Evaluator
309
- * [contains](docs/sdks/evals/README.md#contains) - Run Contains Evaluator
310
- * [endsWith](docs/sdks/evals/README.md#endswith) - Run Ends With Evaluator
311
- * [exactMatch](docs/sdks/evals/README.md#exactmatch) - Run Exact Match Evaluator
312
- * [lengthBetween](docs/sdks/evals/README.md#lengthbetween) - Run Length Between Evaluator
313
- * [lengthGreaterThan](docs/sdks/evals/README.md#lengthgreaterthan) - Run Length Greater Than Evaluator
314
- * [lengthLessThan](docs/sdks/evals/README.md#lengthlessthan) - Run Length Less Than Evaluator
315
- * [validJson](docs/sdks/evals/README.md#validjson) - Run JSON Validation Evaluator
316
- * [ageAppropriate](docs/sdks/evals/README.md#ageappropriate) - Run Age Appropriate Evaluator
317
- * [botDetection](docs/sdks/evals/README.md#botdetection) - Run Bot Detection Evaluator
318
- * [factCheckingKnowledgeBase](docs/sdks/evals/README.md#factcheckingknowledgebase) - Run Fact Checking Knowledge Base Evaluator
319
- * [grammar](docs/sdks/evals/README.md#grammar) - Run Grammar Evaluator
320
- * [localization](docs/sdks/evals/README.md#localization) - Run Localization Evaluator
321
- * [pii](docs/sdks/evals/README.md#pii) - Run PII Evaluator
322
- * [sentimentClassification](docs/sdks/evals/README.md#sentimentclassification) - Run Sentiment Classification Evaluator
323
- * [summarization](docs/sdks/evals/README.md#summarization) - Run Summarization Evaluator
324
- * [toneOfVoice](docs/sdks/evals/README.md#toneofvoice) - Run Tone of Voice Evaluator
325
- * [translation](docs/sdks/evals/README.md#translation) - Run Translation Evaluator
326
- * [ragasCoherence](docs/sdks/evals/README.md#ragascoherence) - Run Coherence Evaluator
327
- * [ragasConciseness](docs/sdks/evals/README.md#ragasconciseness) - Run Conciseness Evaluator
328
- * [ragasContextPrecision](docs/sdks/evals/README.md#ragascontextprecision) - Run Context Precision Evaluator
329
- * [ragasContextRecall](docs/sdks/evals/README.md#ragascontextrecall) - Run Context Recall Evaluator
330
- * [ragasContextEntitiesRecall](docs/sdks/evals/README.md#ragascontextentitiesrecall) - Run Context Entities Recall Evaluator
331
- * [ragasCorrectness](docs/sdks/evals/README.md#ragascorrectness) - Run Correctness Evaluator
332
- * [ragasFaithfulness](docs/sdks/evals/README.md#ragasfaithfulness) - Run Faithfulness Evaluator
333
- * [ragasHarmfulness](docs/sdks/evals/README.md#ragasharmfulness) - Run Harmfulness Evaluator
334
- * [ragasMaliciousness](docs/sdks/evals/README.md#ragasmaliciousness) - Run Maliciousness Evaluator
335
- * [ragasNoiseSensitivity](docs/sdks/evals/README.md#ragasnoisesensitivity) - Run Noise Sensitivity Evaluator
336
- * [ragasResponseRelevancy](docs/sdks/evals/README.md#ragasresponserelevancy) - Run Response Relevancy Evaluator
337
- * [ragasSummarization](docs/sdks/evals/README.md#ragassummarization) - Run Summarization Evaluator
338
- * [invoke](docs/sdks/evals/README.md#invoke) - Invoke a Custom Evaluator
339
-
340
- ### [feedback](docs/sdks/feedback/README.md)
341
-
342
- * [create](docs/sdks/feedback/README.md#create) - Submit feedback
343
-
344
- ### [files](docs/sdks/files/README.md)
345
-
346
- * [create](docs/sdks/files/README.md#create) - Create file
347
- * [list](docs/sdks/files/README.md#list) - List all files
348
- * [get](docs/sdks/files/README.md#get) - Retrieve a file
349
- * [delete](docs/sdks/files/README.md#delete) - Delete file
350
-
351
- ### [knowledge](docs/sdks/knowledge/README.md)
352
-
353
- * [list](docs/sdks/knowledge/README.md#list) - List all knowledge bases
354
- * [retrieve](docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
355
- * [update](docs/sdks/knowledge/README.md#update) - Updates a knowledge
356
- * [delete](docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
357
- * [search](docs/sdks/knowledge/README.md#search) - Search knowledge base
358
- * [listDatasources](docs/sdks/knowledge/README.md#listdatasources) - List all datasources
359
- * [createDatasource](docs/sdks/knowledge/README.md#createdatasource) - Create a new datasource
360
- * [retrieveDatasource](docs/sdks/knowledge/README.md#retrievedatasource) - Retrieve a datasource
361
- * [deleteDatasource](docs/sdks/knowledge/README.md#deletedatasource) - Deletes a datasource
362
- * [updateDatasource](docs/sdks/knowledge/README.md#updatedatasource) - Update a datasource
363
- * [createChunks](docs/sdks/knowledge/README.md#createchunks) - Create chunks for a datasource
364
- * [listChunks](docs/sdks/knowledge/README.md#listchunks) - List all chunks for a datasource
365
- * [updateChunk](docs/sdks/knowledge/README.md#updatechunk) - Update a chunk
366
- * [deleteChunk](docs/sdks/knowledge/README.md#deletechunk) - Delete a chunk
367
- * [retrieveChunk](docs/sdks/knowledge/README.md#retrievechunk) - Retrieve a chunk
368
-
369
- ### [knowledgeBases](docs/sdks/knowledgebases/README.md)
370
-
371
- * [chunkText](docs/sdks/knowledgebases/README.md#chunktext) - Chunk text
372
-
373
- ### [models](docs/sdks/models/README.md)
374
-
375
- * [list](docs/sdks/models/README.md#list) - List models
376
-
377
-
378
- ### [prompts](docs/sdks/prompts/README.md)
379
-
380
- * [list](docs/sdks/prompts/README.md#list) - List all prompts
381
- * [create](docs/sdks/prompts/README.md#create) - Create a prompt
382
- * [retrieve](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
383
- * [update](docs/sdks/prompts/README.md#update) - Update a prompt
384
- * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
385
- * [listVersions](docs/sdks/prompts/README.md#listversions) - List all prompt versions
386
- * [getVersion](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
387
-
388
- ### [remoteconfigs](docs/sdks/remoteconfigs/README.md)
389
-
390
- * [retrieve](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
391
-
392
- </details>
393
- <!-- End Available Resources and Operations [operations] -->
394
-
395
- <!-- Start Standalone functions [standalone-funcs] -->
396
- ## Standalone functions
397
-
398
- All the methods listed above are available as standalone functions. These
399
- functions are ideal for use in applications running in the browser, serverless
400
- runtimes or other environments where application bundle size is a primary
401
- concern. When using a bundler to build your application, all unused
402
- functionality will be either excluded from the final bundle or tree-shaken away.
403
-
404
- To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
405
-
406
- <details>
407
-
408
- <summary>Available standalone functions</summary>
409
-
410
- - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Create a contact
411
- - [`contactsDelete`](docs/sdks/contacts/README.md#delete) - Delete a contact
412
- - [`contactsList`](docs/sdks/contacts/README.md#list) - List contacts
413
- - [`contactsRetrieve`](docs/sdks/contacts/README.md#retrieve) - Retrieve a contact
414
- - [`contactsUpdate`](docs/sdks/contacts/README.md#update) - Update a contact
415
- - [`datasetsClear`](docs/sdks/datasets/README.md#clear) - Delete all datapoints
416
- - [`datasetsCreate`](docs/sdks/datasets/README.md#create) - Create a dataset
417
- - [`datasetsCreateDatapoint`](docs/sdks/datasets/README.md#createdatapoint) - Create a datapoint
418
- - [`datasetsDelete`](docs/sdks/datasets/README.md#delete) - Delete a dataset
419
- - [`datasetsDeleteDatapoint`](docs/sdks/datasets/README.md#deletedatapoint) - Delete a datapoint
420
- - [`datasetsList`](docs/sdks/datasets/README.md#list) - List datasets
421
- - [`datasetsListDatapoints`](docs/sdks/datasets/README.md#listdatapoints) - List datapoints
422
- - [`datasetsRetrieve`](docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
423
- - [`datasetsRetrieveDatapoint`](docs/sdks/datasets/README.md#retrievedatapoint) - Retrieve a datapoint
424
- - [`datasetsUpdate`](docs/sdks/datasets/README.md#update) - Update a dataset
425
- - [`datasetsUpdateDatapoint`](docs/sdks/datasets/README.md#updatedatapoint) - Update a datapoint
426
- - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
427
- - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
428
- - [`deploymentsList`](docs/sdks/deployments/README.md#list) - List all deployments
429
- - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
430
- - [`deploymentsStream`](docs/sdks/deployments/README.md#stream) - Stream
431
- - [`evalsAgeAppropriate`](docs/sdks/evals/README.md#ageappropriate) - Run Age Appropriate Evaluator
432
- - [`evalsAll`](docs/sdks/evals/README.md#all) - Get all Evaluators
433
- - [`evalsBertScore`](docs/sdks/evals/README.md#bertscore) - Run BertScore Evaluator
434
- - [`evalsBleuScore`](docs/sdks/evals/README.md#bleuscore) - Run BLEU Score Evaluator
435
- - [`evalsBotDetection`](docs/sdks/evals/README.md#botdetection) - Run Bot Detection Evaluator
436
- - [`evalsContains`](docs/sdks/evals/README.md#contains) - Run Contains Evaluator
437
- - [`evalsContainsAll`](docs/sdks/evals/README.md#containsall) - Run Contains All Evaluator
438
- - [`evalsContainsAny`](docs/sdks/evals/README.md#containsany) - Run Contains Any Evaluator
439
- - [`evalsContainsEmail`](docs/sdks/evals/README.md#containsemail) - Run Contains Email Evaluator
440
- - [`evalsContainsNone`](docs/sdks/evals/README.md#containsnone) - Run Contains None Evaluator
441
- - [`evalsContainsUrl`](docs/sdks/evals/README.md#containsurl) - Run Contains URL Evaluator
442
- - [`evalsContainsValidLink`](docs/sdks/evals/README.md#containsvalidlink) - Run Contains Valid Link Evaluator
443
- - [`evalsCreate`](docs/sdks/evals/README.md#create) - Create an Evaluator
444
- - [`evalsDelete`](docs/sdks/evals/README.md#delete) - Delete an Evaluator
445
- - [`evalsEndsWith`](docs/sdks/evals/README.md#endswith) - Run Ends With Evaluator
446
- - [`evalsExactMatch`](docs/sdks/evals/README.md#exactmatch) - Run Exact Match Evaluator
447
- - [`evalsFactCheckingKnowledgeBase`](docs/sdks/evals/README.md#factcheckingknowledgebase) - Run Fact Checking Knowledge Base Evaluator
448
- - [`evalsGrammar`](docs/sdks/evals/README.md#grammar) - Run Grammar Evaluator
449
- - [`evalsInvoke`](docs/sdks/evals/README.md#invoke) - Invoke a Custom Evaluator
450
- - [`evalsLengthBetween`](docs/sdks/evals/README.md#lengthbetween) - Run Length Between Evaluator
451
- - [`evalsLengthGreaterThan`](docs/sdks/evals/README.md#lengthgreaterthan) - Run Length Greater Than Evaluator
452
- - [`evalsLengthLessThan`](docs/sdks/evals/README.md#lengthlessthan) - Run Length Less Than Evaluator
453
- - [`evalsLocalization`](docs/sdks/evals/README.md#localization) - Run Localization Evaluator
454
- - [`evalsPii`](docs/sdks/evals/README.md#pii) - Run PII Evaluator
455
- - [`evalsRagasCoherence`](docs/sdks/evals/README.md#ragascoherence) - Run Coherence Evaluator
456
- - [`evalsRagasConciseness`](docs/sdks/evals/README.md#ragasconciseness) - Run Conciseness Evaluator
457
- - [`evalsRagasContextEntitiesRecall`](docs/sdks/evals/README.md#ragascontextentitiesrecall) - Run Context Entities Recall Evaluator
458
- - [`evalsRagasContextPrecision`](docs/sdks/evals/README.md#ragascontextprecision) - Run Context Precision Evaluator
459
- - [`evalsRagasContextRecall`](docs/sdks/evals/README.md#ragascontextrecall) - Run Context Recall Evaluator
460
- - [`evalsRagasCorrectness`](docs/sdks/evals/README.md#ragascorrectness) - Run Correctness Evaluator
461
- - [`evalsRagasFaithfulness`](docs/sdks/evals/README.md#ragasfaithfulness) - Run Faithfulness Evaluator
462
- - [`evalsRagasHarmfulness`](docs/sdks/evals/README.md#ragasharmfulness) - Run Harmfulness Evaluator
463
- - [`evalsRagasMaliciousness`](docs/sdks/evals/README.md#ragasmaliciousness) - Run Maliciousness Evaluator
464
- - [`evalsRagasNoiseSensitivity`](docs/sdks/evals/README.md#ragasnoisesensitivity) - Run Noise Sensitivity Evaluator
465
- - [`evalsRagasResponseRelevancy`](docs/sdks/evals/README.md#ragasresponserelevancy) - Run Response Relevancy Evaluator
466
- - [`evalsRagasSummarization`](docs/sdks/evals/README.md#ragassummarization) - Run Summarization Evaluator
467
- - [`evalsSentimentClassification`](docs/sdks/evals/README.md#sentimentclassification) - Run Sentiment Classification Evaluator
468
- - [`evalsSummarization`](docs/sdks/evals/README.md#summarization) - Run Summarization Evaluator
469
- - [`evalsToneOfVoice`](docs/sdks/evals/README.md#toneofvoice) - Run Tone of Voice Evaluator
470
- - [`evalsTranslation`](docs/sdks/evals/README.md#translation) - Run Translation Evaluator
471
- - [`evalsUpdate`](docs/sdks/evals/README.md#update) - Update an Evaluator
472
- - [`evalsValidJson`](docs/sdks/evals/README.md#validjson) - Run JSON Validation Evaluator
473
- - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
474
- - [`filesCreate`](docs/sdks/files/README.md#create) - Create file
475
- - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete file
476
- - [`filesGet`](docs/sdks/files/README.md#get) - Retrieve a file
477
- - [`filesList`](docs/sdks/files/README.md#list) - List all files
478
- - [`knowledgeBasesChunkText`](docs/sdks/knowledgebases/README.md#chunktext) - Chunk text
479
- - [`knowledgeCreateChunks`](docs/sdks/knowledge/README.md#createchunks) - Create chunks for a datasource
480
- - [`knowledgeCreateDatasource`](docs/sdks/knowledge/README.md#createdatasource) - Create a new datasource
481
- - [`knowledgeDelete`](docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
482
- - [`knowledgeDeleteChunk`](docs/sdks/knowledge/README.md#deletechunk) - Delete a chunk
483
- - [`knowledgeDeleteDatasource`](docs/sdks/knowledge/README.md#deletedatasource) - Deletes a datasource
484
- - [`knowledgeList`](docs/sdks/knowledge/README.md#list) - List all knowledge bases
485
- - [`knowledgeListChunks`](docs/sdks/knowledge/README.md#listchunks) - List all chunks for a datasource
486
- - [`knowledgeListDatasources`](docs/sdks/knowledge/README.md#listdatasources) - List all datasources
487
- - [`knowledgeRetrieve`](docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
488
- - [`knowledgeRetrieveChunk`](docs/sdks/knowledge/README.md#retrievechunk) - Retrieve a chunk
489
- - [`knowledgeRetrieveDatasource`](docs/sdks/knowledge/README.md#retrievedatasource) - Retrieve a datasource
490
- - [`knowledgeSearch`](docs/sdks/knowledge/README.md#search) - Search knowledge base
491
- - [`knowledgeUpdate`](docs/sdks/knowledge/README.md#update) - Updates a knowledge
492
- - [`knowledgeUpdateChunk`](docs/sdks/knowledge/README.md#updatechunk) - Update a chunk
493
- - [`knowledgeUpdateDatasource`](docs/sdks/knowledge/README.md#updatedatasource) - Update a datasource
494
- - [`modelsList`](docs/sdks/models/README.md#list) - List models
495
- - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a prompt
496
- - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
497
- - [`promptsGetVersion`](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
498
- - [`promptsList`](docs/sdks/prompts/README.md#list) - List all prompts
499
- - [`promptsListVersions`](docs/sdks/prompts/README.md#listversions) - List all prompt versions
500
- - [`promptsRetrieve`](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
501
- - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
502
- - [`remoteconfigsRetrieve`](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
503
-
504
- </details>
505
- <!-- End Standalone functions [standalone-funcs] -->
506
-
507
- <!-- Start Server-sent event streaming [eventstream] -->
508
- ## Server-sent event streaming
509
-
510
- [Server-sent events][mdn-sse] are used to stream content from certain
511
- operations. These operations will expose the stream as an async iterable that
512
- can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
513
- terminate when the server no longer has any events to send and closes the
514
- underlying connection.
515
-
516
- ```typescript
517
- import { Orq } from "@orq-ai/node";
518
-
519
- const orq = new Orq({
520
- environment: "<value>",
521
- contactId: "<id>",
522
- apiKey: process.env["ORQ_API_KEY"] ?? "",
523
- });
524
-
525
- async function run() {
526
- const result = await orq.deployments.stream({
527
- key: "<key>",
528
- });
529
-
530
- for await (const event of result) {
531
- // Handle the event
532
- console.log(event);
533
- }
534
- }
535
-
536
- run();
537
-
538
- ```
539
-
540
- [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
541
- [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
542
- <!-- End Server-sent event streaming [eventstream] -->
543
-
544
- <!-- Start File uploads [file-upload] -->
545
- ## File uploads
546
-
547
- 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.
548
-
549
- > [!TIP]
550
- >
551
- > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
552
- >
553
- > - **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).
554
- > - **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.
555
- > - **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.
556
- > - **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).
557
-
558
- ```typescript
559
- import { Orq } from "@orq-ai/node";
560
- import { openAsBlob } from "node:fs";
561
-
562
- const orq = new Orq({
563
- apiKey: process.env["ORQ_API_KEY"] ?? "",
564
- });
565
-
566
- async function run() {
567
- const result = await orq.files.create({
568
- file: await openAsBlob("example.file"),
569
- });
570
-
571
- console.log(result);
572
- }
573
-
574
- run();
575
-
576
- ```
577
- <!-- End File uploads [file-upload] -->
578
-
579
- <!-- Start Retries [retries] -->
580
- ## Retries
581
-
582
- 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.
583
-
584
- To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
585
- ```typescript
586
- import { Orq } from "@orq-ai/node";
587
-
588
- const orq = new Orq({
589
- apiKey: process.env["ORQ_API_KEY"] ?? "",
590
- });
591
-
592
- async function run() {
593
- const result = await orq.contacts.create({
594
- externalId: "user_12345",
595
- displayName: "Jane Smith",
596
- email: "jane.smith@example.com",
597
- avatarUrl: "https://example.com/avatars/jane-smith.jpg",
598
- tags: [
599
- "premium",
600
- "beta-user",
601
- "enterprise",
602
- ],
603
- metadata: {
604
- "department": "Engineering",
605
- "role": "Senior Developer",
606
- "subscription_tier": "premium",
607
- "last_login": "2024-01-15T10:30:00Z",
608
- },
609
- }, {
610
- retries: {
611
- strategy: "backoff",
612
- backoff: {
613
- initialInterval: 1,
614
- maxInterval: 50,
615
- exponent: 1.1,
616
- maxElapsedTime: 100,
617
- },
618
- retryConnectionErrors: false,
619
- },
620
- });
621
-
622
- console.log(result);
623
- }
624
-
625
- run();
626
-
627
- ```
628
-
629
- If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
630
- ```typescript
631
- import { Orq } from "@orq-ai/node";
632
-
633
- const orq = new Orq({
634
- retryConfig: {
635
- strategy: "backoff",
636
- backoff: {
637
- initialInterval: 1,
638
- maxInterval: 50,
639
- exponent: 1.1,
640
- maxElapsedTime: 100,
641
- },
642
- retryConnectionErrors: false,
643
- },
644
- apiKey: process.env["ORQ_API_KEY"] ?? "",
645
- });
646
-
647
- async function run() {
648
- const result = await orq.contacts.create({
649
- externalId: "user_12345",
650
- displayName: "Jane Smith",
651
- email: "jane.smith@example.com",
652
- avatarUrl: "https://example.com/avatars/jane-smith.jpg",
653
- tags: [
654
- "premium",
655
- "beta-user",
656
- "enterprise",
657
- ],
658
- metadata: {
659
- "department": "Engineering",
660
- "role": "Senior Developer",
661
- "subscription_tier": "premium",
662
- "last_login": "2024-01-15T10:30:00Z",
663
- },
664
- });
665
-
666
- console.log(result);
667
- }
668
-
669
- run();
670
-
671
- ```
672
- <!-- End Retries [retries] -->
673
-
674
- <!-- Start Error Handling [errors] -->
675
- ## Error Handling
676
-
677
- [`OrqError`](./src/models/errors/orqerror.ts) is the base class for all HTTP error responses. It has the following properties:
678
-
679
- | Property | Type | Description |
680
- | ------------------- | ---------- | --------------------------------------------------------------------------------------- |
681
- | `error.message` | `string` | Error message |
682
- | `error.statusCode` | `number` | HTTP response status code eg `404` |
683
- | `error.headers` | `Headers` | HTTP response headers |
684
- | `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
685
- | `error.rawResponse` | `Response` | Raw HTTP response |
686
- | `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
687
-
688
- ### Example
689
- ```typescript
690
- import { Orq } from "@orq-ai/node";
691
- import * as errors from "@orq-ai/node/models/errors";
692
-
693
- const orq = new Orq({
694
- apiKey: process.env["ORQ_API_KEY"] ?? "",
695
- });
696
-
697
- async function run() {
698
- try {
699
- const result = await orq.contacts.retrieve({
700
- id: "<id>",
701
- });
702
-
703
- console.log(result);
704
- } catch (error) {
705
- // The base class for HTTP error responses
706
- if (error instanceof errors.OrqError) {
707
- console.log(error.message);
708
- console.log(error.statusCode);
709
- console.log(error.body);
710
- console.log(error.headers);
711
-
712
- // Depending on the method different errors may be thrown
713
- if (error instanceof errors.RetrieveContactResponseBody) {
714
- console.log(error.data$.error); // string
715
- }
716
- }
717
- }
718
- }
719
-
720
- run();
721
-
722
- ```
723
-
724
- ### Error Classes
725
- **Primary error:**
726
- * [`OrqError`](./src/models/errors/orqerror.ts): The base class for HTTP error responses.
727
-
728
- <details><summary>Less common errors (92)</summary>
729
-
730
- <br />
731
-
732
- **Network errors:**
733
- * [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
734
- * [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
735
- * [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
736
- * [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
737
- * [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
738
-
739
-
740
- **Inherit from [`OrqError`](./src/models/errors/orqerror.ts)**:
741
- * [`HonoApiError`](./src/models/errors/honoapierror.ts): Applicable to 6 of 93 methods.*
742
- * [`RetrieveContactResponseBody`](./src/models/errors/retrievecontactresponsebody.ts): Contact not found. Status code `404`. Applicable to 1 of 93 methods.*
743
- * [`UpdateContactResponseBody`](./src/models/errors/updatecontactresponsebody.ts): Contact not found. Status code `404`. Applicable to 1 of 93 methods.*
744
- * [`DeleteContactResponseBody`](./src/models/errors/deletecontactresponsebody.ts): Contact not found. Status code `404`. Applicable to 1 of 93 methods.*
745
- * [`UpdatePromptResponseBody`](./src/models/errors/updatepromptresponsebody.ts): Prompt not found. Status code `404`. Applicable to 1 of 93 methods.*
746
- * [`GetPromptVersionResponseBody`](./src/models/errors/getpromptversionresponsebody.ts): Not Found - The prompt or prompt version does not exist. Status code `404`. Applicable to 1 of 93 methods.*
747
- * [`GetEvalsResponseBody`](./src/models/errors/getevalsresponsebody.ts): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 93 methods.*
748
- * [`CreateEvalResponseBody`](./src/models/errors/createevalresponsebody.ts): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 93 methods.*
749
- * [`UpdateEvalResponseBody`](./src/models/errors/updateevalresponsebody.ts): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 93 methods.*
750
- * [`DeleteEvalResponseBody`](./src/models/errors/deleteevalresponsebody.ts): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 93 methods.*
751
- * [`EvalsBertScoreResponseBody`](./src/models/errors/evalsbertscoreresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
752
- * [`EvalsBleuScoreResponseBody`](./src/models/errors/evalsbleuscoreresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
753
- * [`EvalsContainsAllResponseBody`](./src/models/errors/evalscontainsallresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
754
- * [`EvalsContainsAnyResponseBody`](./src/models/errors/evalscontainsanyresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
755
- * [`EvalsContainsEmailResponseBody`](./src/models/errors/evalscontainsemailresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
756
- * [`EvalsContainsNoneResponseBody`](./src/models/errors/evalscontainsnoneresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
757
- * [`EvalsContainsUrlResponseBody`](./src/models/errors/evalscontainsurlresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
758
- * [`EvalsContainsValidLinkResponseBody`](./src/models/errors/evalscontainsvalidlinkresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
759
- * [`EvalsContainsResponseBody`](./src/models/errors/evalscontainsresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
760
- * [`EvalsEndsWithResponseBody`](./src/models/errors/evalsendswithresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
761
- * [`EvalsExactMatchResponseBody`](./src/models/errors/evalsexactmatchresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
762
- * [`EvalsLengthBetweenResponseBody`](./src/models/errors/evalslengthbetweenresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
763
- * [`EvalsLengthGreaterThanResponseBody`](./src/models/errors/evalslengthgreaterthanresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
764
- * [`EvalsLengthLessThanResponseBody`](./src/models/errors/evalslengthlessthanresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
765
- * [`EvalsValidJsonResponseBody`](./src/models/errors/evalsvalidjsonresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
766
- * [`EvalsAgeAppropriateResponseBody`](./src/models/errors/evalsageappropriateresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
767
- * [`EvalsBotDetectionResponseBody`](./src/models/errors/evalsbotdetectionresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
768
- * [`EvalsFactCheckingKnowledgeBaseResponseBody`](./src/models/errors/evalsfactcheckingknowledgebaseresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
769
- * [`EvalsGrammarResponseBody`](./src/models/errors/evalsgrammarresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
770
- * [`EvalsLocalizationResponseBody`](./src/models/errors/evalslocalizationresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
771
- * [`EvalsPiiResponseBody`](./src/models/errors/evalspiiresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
772
- * [`EvalsSentimentClassificationResponseBody`](./src/models/errors/evalssentimentclassificationresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
773
- * [`EvalsSummarizationResponseBody`](./src/models/errors/evalssummarizationresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
774
- * [`EvalsToneOfVoiceResponseBody`](./src/models/errors/evalstoneofvoiceresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
775
- * [`EvalsTranslationResponseBody`](./src/models/errors/evalstranslationresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
776
- * [`EvalsRagasCoherenceResponseBody`](./src/models/errors/evalsragascoherenceresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
777
- * [`EvalsRagasConcisenessResponseBody`](./src/models/errors/evalsragasconcisenessresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
778
- * [`EvalsRagasContextPrecisionResponseBody`](./src/models/errors/evalsragascontextprecisionresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
779
- * [`EvalsRagasContextRecallResponseBody`](./src/models/errors/evalsragascontextrecallresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
780
- * [`EvalsRagasContextEntitiesRecallResponseBody`](./src/models/errors/evalsragascontextentitiesrecallresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
781
- * [`EvalsRagasCorrectnessResponseBody`](./src/models/errors/evalsragascorrectnessresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
782
- * [`EvalsRagasFaithfulnessResponseBody`](./src/models/errors/evalsragasfaithfulnessresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
783
- * [`EvalsRagasHarmfulnessResponseBody`](./src/models/errors/evalsragasharmfulnessresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
784
- * [`EvalsRagasMaliciousnessResponseBody`](./src/models/errors/evalsragasmaliciousnessresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
785
- * [`EvalsRagasNoiseSensitivityResponseBody`](./src/models/errors/evalsragasnoisesensitivityresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
786
- * [`EvalsRagasResponseRelevancyResponseBody`](./src/models/errors/evalsragasresponserelevancyresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
787
- * [`EvalsRagasSummarizationResponseBody`](./src/models/errors/evalsragassummarizationresponsebody.ts): Evaluator not found. Status code `404`. Applicable to 1 of 93 methods.*
788
- * [`InvokeEvalResponseBody`](./src/models/errors/invokeevalresponsebody.ts): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 93 methods.*
789
- * [`EvalsBertScoreEvalsResponseBody`](./src/models/errors/evalsbertscoreevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
790
- * [`EvalsBleuScoreEvalsResponseBody`](./src/models/errors/evalsbleuscoreevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
791
- * [`EvalsContainsAllEvalsResponseBody`](./src/models/errors/evalscontainsallevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
792
- * [`EvalsContainsAnyEvalsResponseBody`](./src/models/errors/evalscontainsanyevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
793
- * [`EvalsContainsEmailEvalsResponseBody`](./src/models/errors/evalscontainsemailevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
794
- * [`EvalsContainsNoneEvalsResponseBody`](./src/models/errors/evalscontainsnoneevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
795
- * [`EvalsContainsUrlEvalsResponseBody`](./src/models/errors/evalscontainsurlevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
796
- * [`EvalsContainsValidLinkEvalsResponseBody`](./src/models/errors/evalscontainsvalidlinkevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
797
- * [`EvalsContainsEvalsResponseBody`](./src/models/errors/evalscontainsevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
798
- * [`EvalsEndsWithEvalsResponseBody`](./src/models/errors/evalsendswithevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
799
- * [`EvalsExactMatchEvalsResponseBody`](./src/models/errors/evalsexactmatchevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
800
- * [`EvalsLengthBetweenEvalsResponseBody`](./src/models/errors/evalslengthbetweenevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
801
- * [`EvalsLengthGreaterThanEvalsResponseBody`](./src/models/errors/evalslengthgreaterthanevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
802
- * [`EvalsLengthLessThanEvalsResponseBody`](./src/models/errors/evalslengthlessthanevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
803
- * [`EvalsValidJsonEvalsResponseBody`](./src/models/errors/evalsvalidjsonevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
804
- * [`EvalsAgeAppropriateEvalsResponseBody`](./src/models/errors/evalsageappropriateevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
805
- * [`EvalsBotDetectionEvalsResponseBody`](./src/models/errors/evalsbotdetectionevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
806
- * [`EvalsFactCheckingKnowledgeBaseEvalsResponseBody`](./src/models/errors/evalsfactcheckingknowledgebaseevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
807
- * [`EvalsGrammarEvalsResponseBody`](./src/models/errors/evalsgrammarevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
808
- * [`EvalsLocalizationEvalsResponseBody`](./src/models/errors/evalslocalizationevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
809
- * [`EvalsPiiEvalsResponseBody`](./src/models/errors/evalspiievalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
810
- * [`EvalsSentimentClassificationEvalsResponseBody`](./src/models/errors/evalssentimentclassificationevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
811
- * [`EvalsSummarizationEvalsResponseBody`](./src/models/errors/evalssummarizationevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
812
- * [`EvalsToneOfVoiceEvalsResponseBody`](./src/models/errors/evalstoneofvoiceevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
813
- * [`EvalsTranslationEvalsResponseBody`](./src/models/errors/evalstranslationevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
814
- * [`EvalsRagasCoherenceEvalsResponseBody`](./src/models/errors/evalsragascoherenceevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
815
- * [`EvalsRagasConcisenessEvalsResponseBody`](./src/models/errors/evalsragasconcisenessevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
816
- * [`EvalsRagasContextPrecisionEvalsResponseBody`](./src/models/errors/evalsragascontextprecisionevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
817
- * [`EvalsRagasContextRecallEvalsResponseBody`](./src/models/errors/evalsragascontextrecallevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
818
- * [`EvalsRagasContextEntitiesRecallEvalsResponseBody`](./src/models/errors/evalsragascontextentitiesrecallevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
819
- * [`EvalsRagasCorrectnessEvalsResponseBody`](./src/models/errors/evalsragascorrectnessevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
820
- * [`EvalsRagasFaithfulnessEvalsResponseBody`](./src/models/errors/evalsragasfaithfulnessevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
821
- * [`EvalsRagasHarmfulnessEvalsResponseBody`](./src/models/errors/evalsragasharmfulnessevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
822
- * [`EvalsRagasMaliciousnessEvalsResponseBody`](./src/models/errors/evalsragasmaliciousnessevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
823
- * [`EvalsRagasNoiseSensitivityEvalsResponseBody`](./src/models/errors/evalsragasnoisesensitivityevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
824
- * [`EvalsRagasResponseRelevancyEvalsResponseBody`](./src/models/errors/evalsragasresponserelevancyevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
825
- * [`EvalsRagasSummarizationEvalsResponseBody`](./src/models/errors/evalsragassummarizationevalsresponsebody.ts): Internal server error. Status code `500`. Applicable to 1 of 93 methods.*
826
- * [`InvokeEvalEvalsResponseBody`](./src/models/errors/invokeevalevalsresponsebody.ts): Error running the evaluator. Status code `500`. Applicable to 1 of 93 methods.*
827
- * [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
828
-
829
- </details>
830
-
831
- \* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
832
- <!-- End Error Handling [errors] -->
833
-
834
- <!-- Start Server Selection [server] -->
835
- ## Server Selection
836
-
837
- ### Override Server URL Per-Client
838
-
839
- The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
840
- ```typescript
841
- import { Orq } from "@orq-ai/node";
842
-
843
- const orq = new Orq({
844
- serverURL: "https://my.orq.ai",
845
- apiKey: process.env["ORQ_API_KEY"] ?? "",
846
- });
847
-
848
- async function run() {
849
- const result = await orq.contacts.create({
850
- externalId: "user_12345",
851
- displayName: "Jane Smith",
852
- email: "jane.smith@example.com",
853
- avatarUrl: "https://example.com/avatars/jane-smith.jpg",
854
- tags: [
855
- "premium",
856
- "beta-user",
857
- "enterprise",
858
- ],
859
- metadata: {
860
- "department": "Engineering",
861
- "role": "Senior Developer",
862
- "subscription_tier": "premium",
863
- "last_login": "2024-01-15T10:30:00Z",
864
- },
865
- });
866
-
867
- console.log(result);
868
- }
869
-
870
- run();
871
-
872
- ```
873
- <!-- End Server Selection [server] -->
874
-
875
- <!-- Start Custom HTTP Client [http-client] -->
876
- ## Custom HTTP Client
877
-
878
- The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
879
- [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
880
- client is a thin wrapper around `fetch` and provides the ability to attach hooks
881
- around the request lifecycle that can be used to modify the request or handle
882
- errors and response.
883
-
884
- The `HTTPClient` constructor takes an optional `fetcher` argument that can be
885
- used to integrate a third-party HTTP client or when writing tests to mock out
886
- the HTTP client and feed in fixtures.
887
-
888
- The following example shows how to use the `"beforeRequest"` hook to to add a
889
- custom header and a timeout to requests and how to use the `"requestError"` hook
890
- to log errors:
891
-
892
- ```typescript
893
- import { Orq } from "@orq-ai/node";
894
- import { HTTPClient } from "@orq-ai/node/lib/http";
895
-
896
- const httpClient = new HTTPClient({
897
- // fetcher takes a function that has the same signature as native `fetch`.
898
- fetcher: (request) => {
899
- return fetch(request);
900
- }
901
- });
902
-
903
- httpClient.addHook("beforeRequest", (request) => {
904
- const nextRequest = new Request(request, {
905
- signal: request.signal || AbortSignal.timeout(5000)
906
- });
907
-
908
- nextRequest.headers.set("x-custom-header", "custom value");
909
-
910
- return nextRequest;
911
- });
912
-
913
- httpClient.addHook("requestError", (error, request) => {
914
- console.group("Request Error");
915
- console.log("Reason:", `${error}`);
916
- console.log("Endpoint:", `${request.method} ${request.url}`);
917
- console.groupEnd();
918
- });
919
-
920
- const sdk = new Orq({ httpClient });
921
- ```
922
- <!-- End Custom HTTP Client [http-client] -->
923
-
924
- <!-- Start Debugging [debug] -->
925
- ## Debugging
926
-
927
- You can setup your SDK to emit debug logs for SDK requests and responses.
928
-
929
- You can pass a logger that matches `console`'s interface as an SDK option.
930
-
931
- > [!WARNING]
932
- > 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.
933
-
934
- ```typescript
935
- import { Orq } from "@orq-ai/node";
936
-
937
- const sdk = new Orq({ debugLogger: console });
938
- ```
939
-
940
- You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
941
- <!-- End Debugging [debug] -->
942
-
943
- <!-- Placeholder for Future Speakeasy SDK Sections -->
944
-
945
- # Development
946
-
947
- ## Maturity
948
-
949
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
950
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
951
- looking for the latest version.
952
-
953
- ## Contributions
954
-
955
- 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.
956
- 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.
957
-
958
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)