scorecard-ai 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/Client.d.ts +9 -0
  2. package/Client.js +15 -0
  3. package/api/errors/ForbiddenError.d.ts +2 -2
  4. package/api/errors/ForbiddenError.js +1 -1
  5. package/api/errors/NotFoundError.d.ts +2 -2
  6. package/api/errors/NotFoundError.js +1 -1
  7. package/api/errors/UnauthorizedError.d.ts +2 -2
  8. package/api/errors/UnauthorizedError.js +1 -1
  9. package/api/errors/UnprocessableEntityError.d.ts +2 -2
  10. package/api/errors/UnprocessableEntityError.js +1 -1
  11. package/api/resources/index.d.ts +5 -0
  12. package/api/resources/index.js +6 -1
  13. package/api/resources/prompt/client/Client.d.ts +131 -0
  14. package/api/resources/prompt/client/Client.js +539 -0
  15. package/api/resources/prompt/client/index.d.ts +1 -0
  16. package/api/resources/prompt/client/index.js +17 -0
  17. package/api/resources/prompt/client/requests/PromptCreateParams.d.ts +40 -0
  18. package/api/resources/prompt/client/requests/PromptUpdateParams.d.ts +12 -0
  19. package/api/resources/prompt/client/requests/index.d.ts +2 -0
  20. package/api/resources/prompt/client/requests/index.js +2 -0
  21. package/api/resources/prompt/index.d.ts +2 -0
  22. package/api/resources/prompt/index.js +18 -0
  23. package/api/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +4 -0
  24. package/api/resources/prompt/types/index.d.ts +1 -0
  25. package/api/resources/prompt/types/index.js +17 -0
  26. package/api/resources/run/client/Client.d.ts +20 -14
  27. package/api/resources/run/client/Client.js +31 -36
  28. package/api/resources/run/client/requests/RunCreateParams.d.ts +2 -9
  29. package/api/resources/run/client/requests/UpdateStatusParams.d.ts +3 -5
  30. package/api/resources/run/client/requests/index.d.ts +2 -2
  31. package/api/resources/runMetric/client/Client.d.ts +38 -0
  32. package/api/resources/runMetric/client/Client.js +150 -0
  33. package/api/resources/runMetric/client/index.d.ts +1 -0
  34. package/api/resources/runMetric/client/index.js +2 -0
  35. package/api/resources/runMetric/index.d.ts +1 -0
  36. package/api/resources/runMetric/index.js +17 -0
  37. package/api/resources/score/client/Client.d.ts +18 -2
  38. package/api/resources/score/client/Client.js +28 -18
  39. package/api/resources/score/client/requests/ScoreCreateParams.d.ts +1 -0
  40. package/api/resources/score/client/requests/index.d.ts +2 -2
  41. package/api/resources/testcase/client/Client.d.ts +22 -6
  42. package/api/resources/testcase/client/Client.js +40 -29
  43. package/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +4 -5
  44. package/api/resources/testcase/client/requests/index.d.ts +1 -1
  45. package/api/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +2 -2
  46. package/api/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +2 -2
  47. package/api/resources/testrecord/client/Client.d.ts +15 -2
  48. package/api/resources/testrecord/client/Client.js +25 -18
  49. package/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -1
  50. package/api/resources/testrecord/client/requests/index.d.ts +1 -1
  51. package/api/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +1 -1
  52. package/api/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +1 -1
  53. package/api/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +1 -1
  54. package/api/resources/testset/client/Client.d.ts +26 -2
  55. package/api/resources/testset/client/Client.js +41 -38
  56. package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -1
  57. package/api/resources/testset/client/requests/TestsetGetTestcasesRequest.d.ts +6 -0
  58. package/api/resources/testset/client/requests/index.d.ts +2 -2
  59. package/api/resources/traces/client/Client.d.ts +38 -0
  60. package/api/resources/traces/client/Client.js +150 -0
  61. package/api/resources/traces/client/index.d.ts +1 -0
  62. package/api/resources/traces/client/index.js +2 -0
  63. package/api/resources/traces/index.d.ts +1 -0
  64. package/api/resources/traces/index.js +17 -0
  65. package/api/types/CustomSchema.d.ts +1 -1
  66. package/api/types/CustomVariable.d.ts +1 -1
  67. package/api/types/Grade.d.ts +6 -2
  68. package/api/types/HttpValidationError.d.ts +1 -1
  69. package/api/types/JsonObject.d.ts +1 -1
  70. package/api/types/JsonObjectInputValue.d.ts +1 -1
  71. package/api/types/JsonObjectOutputValue.d.ts +1 -1
  72. package/api/types/PaginatedTestcaseResponse.d.ts +2 -1
  73. package/api/types/Prompt.d.ts +18 -0
  74. package/api/types/{AppCreateRunParams.d.ts → PromptModelParamsValue.d.ts} +1 -1
  75. package/api/types/RunMetric.d.ts +9 -0
  76. package/api/types/Span.d.ts +29 -0
  77. package/api/types/TestCase.d.ts +3 -1
  78. package/api/types/TestCaseCustomInputsValue.d.ts +2 -2
  79. package/api/types/TestCaseCustomLabelsValue.d.ts +2 -2
  80. package/api/types/TestcaseDeletionResponse.d.ts +9 -0
  81. package/api/types/Testrecord.d.ts +1 -2
  82. package/api/types/TestrecordCustomInputsValue.d.ts +1 -1
  83. package/api/types/TestrecordCustomLabelsValue.d.ts +1 -1
  84. package/api/types/TestrecordCustomOutputsValue.d.ts +1 -1
  85. package/api/types/Testset.d.ts +1 -1
  86. package/api/types/Trace.d.ts +8 -0
  87. package/api/types/ValidationError.d.ts +1 -1
  88. package/api/types/index.d.ts +6 -8
  89. package/api/types/index.js +6 -8
  90. package/core/fetcher/Fetcher.d.ts +2 -2
  91. package/core/fetcher/Fetcher.js +78 -23
  92. package/core/index.d.ts +1 -0
  93. package/core/index.js +1 -0
  94. package/core/runtime/index.d.ts +1 -0
  95. package/core/runtime/index.js +5 -0
  96. package/core/runtime/runtime.d.ts +8 -0
  97. package/core/runtime/runtime.js +82 -0
  98. package/core/schemas/builders/object/object.js +11 -15
  99. package/dist/Client.d.ts +9 -0
  100. package/dist/Client.js +15 -0
  101. package/dist/api/errors/ForbiddenError.d.ts +2 -2
  102. package/dist/api/errors/ForbiddenError.js +1 -1
  103. package/dist/api/errors/NotFoundError.d.ts +2 -2
  104. package/dist/api/errors/NotFoundError.js +1 -1
  105. package/dist/api/errors/UnauthorizedError.d.ts +2 -2
  106. package/dist/api/errors/UnauthorizedError.js +1 -1
  107. package/dist/api/errors/UnprocessableEntityError.d.ts +2 -2
  108. package/dist/api/errors/UnprocessableEntityError.js +1 -1
  109. package/dist/api/resources/index.d.ts +5 -0
  110. package/dist/api/resources/index.js +6 -1
  111. package/dist/api/resources/prompt/client/Client.d.ts +131 -0
  112. package/dist/api/resources/prompt/client/Client.js +539 -0
  113. package/dist/api/resources/prompt/client/index.d.ts +1 -0
  114. package/dist/api/resources/prompt/client/index.js +17 -0
  115. package/dist/api/resources/prompt/client/requests/PromptCreateParams.d.ts +40 -0
  116. package/dist/api/resources/prompt/client/requests/PromptUpdateParams.d.ts +12 -0
  117. package/dist/api/resources/prompt/client/requests/index.d.ts +2 -0
  118. package/dist/api/resources/prompt/client/requests/index.js +2 -0
  119. package/dist/api/resources/prompt/index.d.ts +2 -0
  120. package/dist/api/resources/prompt/index.js +18 -0
  121. package/dist/api/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +4 -0
  122. package/dist/api/resources/prompt/types/index.d.ts +1 -0
  123. package/dist/api/resources/prompt/types/index.js +17 -0
  124. package/dist/api/resources/run/client/Client.d.ts +20 -14
  125. package/dist/api/resources/run/client/Client.js +31 -36
  126. package/dist/api/resources/run/client/requests/RunCreateParams.d.ts +2 -9
  127. package/dist/api/resources/run/client/requests/UpdateStatusParams.d.ts +3 -5
  128. package/dist/api/resources/run/client/requests/index.d.ts +2 -2
  129. package/dist/api/resources/runMetric/client/Client.d.ts +38 -0
  130. package/dist/api/resources/runMetric/client/Client.js +150 -0
  131. package/dist/api/resources/runMetric/client/index.d.ts +1 -0
  132. package/dist/api/resources/runMetric/client/index.js +2 -0
  133. package/dist/api/resources/runMetric/index.d.ts +1 -0
  134. package/dist/api/resources/runMetric/index.js +17 -0
  135. package/dist/api/resources/score/client/Client.d.ts +18 -2
  136. package/dist/api/resources/score/client/Client.js +28 -18
  137. package/dist/api/resources/score/client/requests/ScoreCreateParams.d.ts +1 -0
  138. package/dist/api/resources/score/client/requests/index.d.ts +2 -2
  139. package/dist/api/resources/testcase/client/Client.d.ts +22 -6
  140. package/dist/api/resources/testcase/client/Client.js +40 -29
  141. package/dist/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +4 -5
  142. package/dist/api/resources/testcase/client/requests/index.d.ts +1 -1
  143. package/dist/api/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +2 -2
  144. package/dist/api/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +2 -2
  145. package/dist/api/resources/testrecord/client/Client.d.ts +15 -2
  146. package/dist/api/resources/testrecord/client/Client.js +25 -18
  147. package/dist/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -1
  148. package/dist/api/resources/testrecord/client/requests/index.d.ts +1 -1
  149. package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +1 -1
  150. package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +1 -1
  151. package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +1 -1
  152. package/dist/api/resources/testset/client/Client.d.ts +26 -2
  153. package/dist/api/resources/testset/client/Client.js +41 -38
  154. package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -1
  155. package/dist/api/resources/testset/client/requests/TestsetGetTestcasesRequest.d.ts +6 -0
  156. package/dist/api/resources/testset/client/requests/index.d.ts +2 -2
  157. package/dist/api/resources/traces/client/Client.d.ts +38 -0
  158. package/dist/api/resources/traces/client/Client.js +150 -0
  159. package/dist/api/resources/traces/client/index.d.ts +1 -0
  160. package/dist/api/resources/traces/client/index.js +2 -0
  161. package/dist/api/resources/traces/index.d.ts +1 -0
  162. package/dist/api/resources/traces/index.js +17 -0
  163. package/dist/api/types/CustomSchema.d.ts +1 -1
  164. package/dist/api/types/CustomVariable.d.ts +1 -1
  165. package/dist/api/types/Grade.d.ts +6 -2
  166. package/dist/api/types/HttpValidationError.d.ts +1 -1
  167. package/dist/api/types/JsonObject.d.ts +1 -1
  168. package/dist/api/types/JsonObjectInputValue.d.ts +1 -1
  169. package/dist/api/types/JsonObjectOutputValue.d.ts +1 -1
  170. package/dist/api/types/PaginatedTestcaseResponse.d.ts +2 -1
  171. package/dist/api/types/Prompt.d.ts +18 -0
  172. package/{api/types/AppTestSetCreate.d.ts → dist/api/types/PromptModelParamsValue.d.ts} +1 -1
  173. package/dist/api/types/RunMetric.d.ts +9 -0
  174. package/dist/api/types/Span.d.ts +29 -0
  175. package/dist/api/types/TestCase.d.ts +3 -1
  176. package/dist/api/types/TestCaseCustomInputsValue.d.ts +2 -2
  177. package/dist/api/types/TestCaseCustomLabelsValue.d.ts +2 -2
  178. package/dist/api/types/TestcaseDeletionResponse.d.ts +9 -0
  179. package/dist/api/types/TestcaseDeletionResponse.js +5 -0
  180. package/dist/api/types/Testrecord.d.ts +1 -2
  181. package/dist/api/types/TestrecordCustomInputsValue.d.ts +1 -1
  182. package/dist/api/types/TestrecordCustomLabelsValue.d.ts +1 -1
  183. package/dist/api/types/TestrecordCustomOutputsValue.d.ts +1 -1
  184. package/dist/api/types/Testset.d.ts +1 -1
  185. package/dist/api/types/Trace.d.ts +8 -0
  186. package/dist/api/types/Trace.js +5 -0
  187. package/dist/api/types/ValidationError.d.ts +1 -1
  188. package/dist/api/types/index.d.ts +6 -8
  189. package/dist/api/types/index.js +6 -8
  190. package/dist/core/fetcher/Fetcher.d.ts +2 -2
  191. package/dist/core/fetcher/Fetcher.js +78 -23
  192. package/dist/core/index.d.ts +1 -0
  193. package/dist/core/index.js +1 -0
  194. package/dist/core/runtime/index.d.ts +1 -0
  195. package/dist/core/runtime/index.js +5 -0
  196. package/dist/core/runtime/runtime.d.ts +8 -0
  197. package/dist/core/runtime/runtime.js +82 -0
  198. package/dist/core/schemas/builders/object/object.js +11 -15
  199. package/dist/serialization/resources/index.d.ts +5 -0
  200. package/dist/serialization/resources/index.js +6 -1
  201. package/dist/serialization/resources/prompt/client/index.d.ts +1 -0
  202. package/dist/serialization/resources/prompt/client/index.js +17 -0
  203. package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +18 -0
  204. package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.js +39 -0
  205. package/dist/serialization/resources/prompt/client/requests/PromptUpdateParams.d.ts +12 -0
  206. package/dist/serialization/resources/prompt/client/requests/PromptUpdateParams.js +33 -0
  207. package/dist/serialization/resources/prompt/client/requests/index.d.ts +2 -0
  208. package/dist/serialization/resources/prompt/client/requests/index.js +7 -0
  209. package/dist/serialization/resources/prompt/index.d.ts +2 -0
  210. package/dist/serialization/resources/prompt/index.js +18 -0
  211. package/dist/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +10 -0
  212. package/dist/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.js +36 -0
  213. package/dist/serialization/resources/prompt/types/index.d.ts +1 -0
  214. package/dist/serialization/resources/prompt/types/index.js +17 -0
  215. package/dist/serialization/resources/run/client/requests/RunCreateParams.d.ts +3 -2
  216. package/dist/serialization/resources/run/client/requests/RunCreateParams.js +1 -0
  217. package/dist/serialization/resources/run/client/requests/UpdateStatusParams.d.ts +4 -3
  218. package/dist/serialization/resources/run/client/requests/UpdateStatusParams.js +2 -10
  219. package/dist/serialization/resources/runMetric/client/get.d.ts +11 -0
  220. package/dist/serialization/{types/AppTestSetCreate.js → resources/runMetric/client/get.js} +4 -3
  221. package/dist/serialization/resources/runMetric/client/index.d.ts +1 -0
  222. package/dist/serialization/{types/ModelParams.js → resources/runMetric/client/index.js} +2 -6
  223. package/dist/serialization/resources/runMetric/index.d.ts +1 -0
  224. package/dist/serialization/resources/runMetric/index.js +17 -0
  225. package/dist/serialization/resources/score/client/requests/ScoreCreateParams.d.ts +2 -2
  226. package/dist/serialization/resources/score/client/requests/ScoreUpdateParams.d.ts +2 -2
  227. package/dist/serialization/resources/testcase/client/requests/TestcaseCreateParams.d.ts +7 -5
  228. package/dist/serialization/resources/testcase/client/requests/TestcaseCreateParams.js +5 -16
  229. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +4 -3
  230. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +6 -2
  231. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +4 -3
  232. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +6 -2
  233. package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +12 -7
  234. package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +10 -24
  235. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +4 -3
  236. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -1
  237. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +4 -3
  238. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -1
  239. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +4 -3
  240. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -1
  241. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsModelDebugInfoValue.d.ts +2 -2
  242. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsModelParamsValue.d.ts +2 -2
  243. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -3
  244. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.js +2 -10
  245. package/dist/serialization/resources/traces/client/get.d.ts +10 -0
  246. package/dist/serialization/resources/traces/client/get.js +40 -0
  247. package/dist/serialization/resources/traces/client/index.d.ts +1 -0
  248. package/{serialization/types/ModelParams.js → dist/serialization/resources/traces/client/index.js} +2 -6
  249. package/dist/serialization/resources/traces/index.d.ts +1 -0
  250. package/dist/serialization/resources/traces/index.js +17 -0
  251. package/dist/serialization/types/CreateGithubWorkflowParams.d.ts +2 -2
  252. package/dist/serialization/types/CreateRunParams.d.ts +2 -2
  253. package/dist/serialization/types/CustomSchema.d.ts +4 -3
  254. package/dist/serialization/types/CustomSchema.js +2 -12
  255. package/dist/serialization/types/CustomVariable.d.ts +6 -4
  256. package/dist/serialization/types/CustomVariable.js +4 -11
  257. package/dist/serialization/types/DataTypeEnum.d.ts +2 -2
  258. package/dist/serialization/types/FileUrl.d.ts +2 -2
  259. package/dist/serialization/types/Grade.d.ts +7 -4
  260. package/dist/serialization/types/Grade.js +5 -11
  261. package/dist/serialization/types/HttpValidationError.d.ts +4 -3
  262. package/dist/serialization/types/HttpValidationError.js +2 -12
  263. package/dist/serialization/types/JsonObject.d.ts +2 -2
  264. package/dist/serialization/types/JsonObjectInputValue.d.ts +2 -2
  265. package/dist/serialization/types/JsonObjectOutputValue.d.ts +2 -2
  266. package/dist/serialization/types/NotFoundErrorBody.d.ts +2 -2
  267. package/dist/serialization/types/PaginatedTestcaseResponse.d.ts +4 -3
  268. package/dist/serialization/types/PaginatedTestcaseResponse.js +2 -10
  269. package/dist/serialization/types/Prompt.d.ts +24 -0
  270. package/dist/serialization/types/Prompt.js +45 -0
  271. package/dist/serialization/types/PromptModelParamsValue.d.ts +10 -0
  272. package/dist/serialization/types/PromptModelParamsValue.js +35 -0
  273. package/dist/serialization/types/RoleEnum.d.ts +2 -2
  274. package/dist/serialization/types/Run.d.ts +2 -2
  275. package/dist/serialization/types/RunMetric.d.ts +15 -0
  276. package/dist/serialization/types/RunMetric.js +36 -0
  277. package/dist/serialization/types/RunStatus.d.ts +2 -2
  278. package/dist/serialization/types/ScoreStatus.d.ts +2 -2
  279. package/dist/serialization/types/Span.d.ts +34 -0
  280. package/dist/serialization/types/Span.js +64 -0
  281. package/dist/serialization/types/TestCase.d.ts +6 -4
  282. package/dist/serialization/types/TestCase.js +4 -15
  283. package/dist/serialization/types/TestCaseCreate.d.ts +2 -2
  284. package/dist/serialization/types/TestCaseCustomInputsValue.d.ts +4 -3
  285. package/dist/serialization/types/TestCaseCustomInputsValue.js +6 -2
  286. package/dist/serialization/types/TestCaseCustomLabelsValue.d.ts +4 -3
  287. package/dist/serialization/types/TestCaseCustomLabelsValue.js +6 -2
  288. package/dist/serialization/types/TestRecordCreate.d.ts +2 -2
  289. package/dist/serialization/types/TestSetCreate.d.ts +2 -2
  290. package/dist/serialization/types/TestcaseDeletionResponse.d.ts +13 -0
  291. package/dist/serialization/types/{AppCreateRunParams.js → TestcaseDeletionResponse.js} +5 -2
  292. package/dist/serialization/types/Testrecord.d.ts +12 -8
  293. package/dist/serialization/types/Testrecord.js +10 -25
  294. package/dist/serialization/types/TestrecordCustomInputsValue.d.ts +4 -3
  295. package/dist/serialization/types/TestrecordCustomInputsValue.js +2 -1
  296. package/dist/serialization/types/TestrecordCustomLabelsValue.d.ts +4 -3
  297. package/dist/serialization/types/TestrecordCustomLabelsValue.js +2 -1
  298. package/dist/serialization/types/TestrecordCustomOutputsValue.d.ts +4 -3
  299. package/dist/serialization/types/TestrecordCustomOutputsValue.js +2 -1
  300. package/dist/serialization/types/TestrecordModelDebugInfoValue.d.ts +2 -2
  301. package/dist/serialization/types/TestrecordModelParamsValue.d.ts +2 -2
  302. package/dist/serialization/types/Testset.d.ts +4 -3
  303. package/dist/serialization/types/Testset.js +2 -10
  304. package/dist/serialization/types/Trace.d.ts +14 -0
  305. package/dist/serialization/types/Trace.js +35 -0
  306. package/dist/serialization/types/UnauthenticatedError.d.ts +2 -2
  307. package/dist/serialization/types/UnauthorizedErrorBody.d.ts +2 -2
  308. package/dist/serialization/types/ValidationError.d.ts +4 -3
  309. package/dist/serialization/types/ValidationError.js +2 -10
  310. package/dist/serialization/types/ValidationErrorLocItem.d.ts +2 -2
  311. package/dist/serialization/types/index.d.ts +6 -8
  312. package/dist/serialization/types/index.js +6 -8
  313. package/jest.config.js +5 -0
  314. package/package.json +10 -4
  315. package/reference.md +1994 -0
  316. package/serialization/resources/index.d.ts +5 -0
  317. package/serialization/resources/index.js +6 -1
  318. package/serialization/resources/prompt/client/index.d.ts +1 -0
  319. package/serialization/resources/prompt/client/index.js +17 -0
  320. package/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +18 -0
  321. package/serialization/resources/prompt/client/requests/PromptCreateParams.js +39 -0
  322. package/serialization/resources/prompt/client/requests/PromptUpdateParams.d.ts +12 -0
  323. package/serialization/resources/prompt/client/requests/PromptUpdateParams.js +33 -0
  324. package/serialization/resources/prompt/client/requests/index.d.ts +2 -0
  325. package/serialization/resources/prompt/client/requests/index.js +7 -0
  326. package/serialization/resources/prompt/index.d.ts +2 -0
  327. package/serialization/resources/prompt/index.js +18 -0
  328. package/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +10 -0
  329. package/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.js +36 -0
  330. package/serialization/resources/prompt/types/index.d.ts +1 -0
  331. package/serialization/resources/prompt/types/index.js +17 -0
  332. package/serialization/resources/run/client/requests/RunCreateParams.d.ts +3 -2
  333. package/serialization/resources/run/client/requests/RunCreateParams.js +1 -0
  334. package/serialization/resources/run/client/requests/UpdateStatusParams.d.ts +4 -3
  335. package/serialization/resources/run/client/requests/UpdateStatusParams.js +2 -10
  336. package/serialization/resources/runMetric/client/get.d.ts +11 -0
  337. package/{dist/serialization/types/ExecutionParams.js → serialization/resources/runMetric/client/get.js} +4 -3
  338. package/serialization/resources/runMetric/client/index.d.ts +1 -0
  339. package/{dist/serialization/types/ScoringParams.js → serialization/resources/runMetric/client/index.js} +2 -6
  340. package/serialization/resources/runMetric/index.d.ts +1 -0
  341. package/serialization/resources/runMetric/index.js +17 -0
  342. package/serialization/resources/score/client/requests/ScoreCreateParams.d.ts +2 -2
  343. package/serialization/resources/score/client/requests/ScoreUpdateParams.d.ts +2 -2
  344. package/serialization/resources/testcase/client/requests/TestcaseCreateParams.d.ts +7 -5
  345. package/serialization/resources/testcase/client/requests/TestcaseCreateParams.js +5 -16
  346. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +4 -3
  347. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +6 -2
  348. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +4 -3
  349. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +6 -2
  350. package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +12 -7
  351. package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +10 -24
  352. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +4 -3
  353. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -1
  354. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +4 -3
  355. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -1
  356. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +4 -3
  357. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -1
  358. package/serialization/resources/testrecord/types/TestrecordCreateParamsModelDebugInfoValue.d.ts +2 -2
  359. package/serialization/resources/testrecord/types/TestrecordCreateParamsModelParamsValue.d.ts +2 -2
  360. package/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -3
  361. package/serialization/resources/testset/client/requests/TestsetCreateParams.js +2 -10
  362. package/serialization/resources/traces/client/get.d.ts +10 -0
  363. package/serialization/resources/traces/client/get.js +40 -0
  364. package/serialization/resources/traces/client/index.d.ts +1 -0
  365. package/serialization/{types/ScoringParams.js → resources/traces/client/index.js} +2 -6
  366. package/serialization/resources/traces/index.d.ts +1 -0
  367. package/serialization/resources/traces/index.js +17 -0
  368. package/serialization/types/CreateGithubWorkflowParams.d.ts +2 -2
  369. package/serialization/types/CreateRunParams.d.ts +2 -2
  370. package/serialization/types/CustomSchema.d.ts +4 -3
  371. package/serialization/types/CustomSchema.js +2 -12
  372. package/serialization/types/CustomVariable.d.ts +6 -4
  373. package/serialization/types/CustomVariable.js +4 -11
  374. package/serialization/types/DataTypeEnum.d.ts +2 -2
  375. package/serialization/types/FileUrl.d.ts +2 -2
  376. package/serialization/types/Grade.d.ts +7 -4
  377. package/serialization/types/Grade.js +5 -11
  378. package/serialization/types/HttpValidationError.d.ts +4 -3
  379. package/serialization/types/HttpValidationError.js +2 -12
  380. package/serialization/types/JsonObject.d.ts +2 -2
  381. package/serialization/types/JsonObjectInputValue.d.ts +2 -2
  382. package/serialization/types/JsonObjectOutputValue.d.ts +2 -2
  383. package/serialization/types/NotFoundErrorBody.d.ts +2 -2
  384. package/serialization/types/PaginatedTestcaseResponse.d.ts +4 -3
  385. package/serialization/types/PaginatedTestcaseResponse.js +2 -10
  386. package/serialization/types/Prompt.d.ts +24 -0
  387. package/serialization/types/Prompt.js +45 -0
  388. package/serialization/types/PromptModelParamsValue.d.ts +10 -0
  389. package/serialization/types/PromptModelParamsValue.js +35 -0
  390. package/serialization/types/RoleEnum.d.ts +2 -2
  391. package/serialization/types/Run.d.ts +2 -2
  392. package/serialization/types/RunMetric.d.ts +15 -0
  393. package/serialization/types/RunMetric.js +36 -0
  394. package/serialization/types/RunStatus.d.ts +2 -2
  395. package/serialization/types/ScoreStatus.d.ts +2 -2
  396. package/serialization/types/Span.d.ts +34 -0
  397. package/serialization/types/Span.js +64 -0
  398. package/serialization/types/TestCase.d.ts +6 -4
  399. package/serialization/types/TestCase.js +4 -15
  400. package/serialization/types/TestCaseCreate.d.ts +2 -2
  401. package/serialization/types/TestCaseCustomInputsValue.d.ts +4 -3
  402. package/serialization/types/TestCaseCustomInputsValue.js +6 -2
  403. package/serialization/types/TestCaseCustomLabelsValue.d.ts +4 -3
  404. package/serialization/types/TestCaseCustomLabelsValue.js +6 -2
  405. package/serialization/types/TestRecordCreate.d.ts +2 -2
  406. package/serialization/types/TestSetCreate.d.ts +2 -2
  407. package/serialization/types/TestcaseDeletionResponse.d.ts +13 -0
  408. package/{dist/serialization/types/AppTestRecordCreate.js → serialization/types/TestcaseDeletionResponse.js} +5 -2
  409. package/serialization/types/Testrecord.d.ts +12 -8
  410. package/serialization/types/Testrecord.js +10 -25
  411. package/serialization/types/TestrecordCustomInputsValue.d.ts +4 -3
  412. package/serialization/types/TestrecordCustomInputsValue.js +2 -1
  413. package/serialization/types/TestrecordCustomLabelsValue.d.ts +4 -3
  414. package/serialization/types/TestrecordCustomLabelsValue.js +2 -1
  415. package/serialization/types/TestrecordCustomOutputsValue.d.ts +4 -3
  416. package/serialization/types/TestrecordCustomOutputsValue.js +2 -1
  417. package/serialization/types/TestrecordModelDebugInfoValue.d.ts +2 -2
  418. package/serialization/types/TestrecordModelParamsValue.d.ts +2 -2
  419. package/serialization/types/Testset.d.ts +4 -3
  420. package/serialization/types/Testset.js +2 -10
  421. package/serialization/types/Trace.d.ts +14 -0
  422. package/serialization/types/Trace.js +35 -0
  423. package/serialization/types/UnauthenticatedError.d.ts +2 -2
  424. package/serialization/types/UnauthorizedErrorBody.d.ts +2 -2
  425. package/serialization/types/ValidationError.d.ts +4 -3
  426. package/serialization/types/ValidationError.js +2 -10
  427. package/serialization/types/ValidationErrorLocItem.d.ts +2 -2
  428. package/serialization/types/index.d.ts +6 -8
  429. package/serialization/types/index.js +6 -8
  430. package/api/types/AppTestRecordCreate.d.ts +0 -4
  431. package/api/types/ExecutionParams.d.ts +0 -4
  432. package/api/types/ModelParams.d.ts +0 -4
  433. package/api/types/ScoreExecutionParams.d.ts +0 -4
  434. package/api/types/ScoringParams.d.ts +0 -4
  435. package/api/types/TestCaseCreateInput.d.ts +0 -4
  436. package/dist/api/types/AppCreateRunParams.d.ts +0 -4
  437. package/dist/api/types/AppTestRecordCreate.d.ts +0 -4
  438. package/dist/api/types/AppTestSetCreate.d.ts +0 -4
  439. package/dist/api/types/ExecutionParams.d.ts +0 -4
  440. package/dist/api/types/ModelParams.d.ts +0 -4
  441. package/dist/api/types/ScoreExecutionParams.d.ts +0 -4
  442. package/dist/api/types/ScoringParams.d.ts +0 -4
  443. package/dist/api/types/TestCaseCreateInput.d.ts +0 -4
  444. package/dist/serialization/types/AppCreateRunParams.d.ts +0 -10
  445. package/dist/serialization/types/AppTestRecordCreate.d.ts +0 -10
  446. package/dist/serialization/types/AppTestSetCreate.d.ts +0 -10
  447. package/dist/serialization/types/ExecutionParams.d.ts +0 -10
  448. package/dist/serialization/types/ModelParams.d.ts +0 -10
  449. package/dist/serialization/types/ScoreExecutionParams.d.ts +0 -10
  450. package/dist/serialization/types/ScoreExecutionParams.js +0 -31
  451. package/dist/serialization/types/ScoringParams.d.ts +0 -10
  452. package/dist/serialization/types/TestCaseCreateInput.d.ts +0 -10
  453. package/dist/serialization/types/TestCaseCreateInput.js +0 -31
  454. package/serialization/types/AppCreateRunParams.d.ts +0 -10
  455. package/serialization/types/AppCreateRunParams.js +0 -31
  456. package/serialization/types/AppTestRecordCreate.d.ts +0 -10
  457. package/serialization/types/AppTestRecordCreate.js +0 -31
  458. package/serialization/types/AppTestSetCreate.d.ts +0 -10
  459. package/serialization/types/AppTestSetCreate.js +0 -31
  460. package/serialization/types/ExecutionParams.d.ts +0 -10
  461. package/serialization/types/ExecutionParams.js +0 -31
  462. package/serialization/types/ModelParams.d.ts +0 -10
  463. package/serialization/types/ScoreExecutionParams.d.ts +0 -10
  464. package/serialization/types/ScoreExecutionParams.js +0 -31
  465. package/serialization/types/ScoringParams.d.ts +0 -10
  466. package/serialization/types/TestCaseCreateInput.d.ts +0 -10
  467. package/serialization/types/TestCaseCreateInput.js +0 -31
  468. /package/api/{types/AppCreateRunParams.js → resources/prompt/client/requests/PromptCreateParams.js} +0 -0
  469. /package/api/{types/AppTestRecordCreate.js → resources/prompt/client/requests/PromptUpdateParams.js} +0 -0
  470. /package/api/{types/AppTestSetCreate.js → resources/prompt/types/PromptCreateParamsModelParamsValue.js} +0 -0
  471. /package/api/types/{ExecutionParams.js → Prompt.js} +0 -0
  472. /package/api/types/{ModelParams.js → PromptModelParamsValue.js} +0 -0
  473. /package/api/types/{ScoreExecutionParams.js → RunMetric.js} +0 -0
  474. /package/api/types/{ScoringParams.js → Span.js} +0 -0
  475. /package/api/types/{TestCaseCreateInput.js → TestcaseDeletionResponse.js} +0 -0
  476. /package/{dist/api/types/AppCreateRunParams.js → api/types/Trace.js} +0 -0
  477. /package/dist/api/{types/AppTestRecordCreate.js → resources/prompt/client/requests/PromptCreateParams.js} +0 -0
  478. /package/dist/api/{types/AppTestSetCreate.js → resources/prompt/client/requests/PromptUpdateParams.js} +0 -0
  479. /package/dist/api/{types/ExecutionParams.js → resources/prompt/types/PromptCreateParamsModelParamsValue.js} +0 -0
  480. /package/dist/api/types/{ModelParams.js → Prompt.js} +0 -0
  481. /package/dist/api/types/{ScoreExecutionParams.js → PromptModelParamsValue.js} +0 -0
  482. /package/dist/api/types/{ScoringParams.js → RunMetric.js} +0 -0
  483. /package/dist/api/types/{TestCaseCreateInput.js → Span.js} +0 -0
@@ -0,0 +1,539 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.Prompt = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const Scorecard = __importStar(require("../../../index"));
45
+ const serializers = __importStar(require("../../../../serialization/index"));
46
+ const url_join_1 = __importDefault(require("url-join"));
47
+ const errors = __importStar(require("../../../../errors/index"));
48
+ class Prompt {
49
+ constructor(_options) {
50
+ this._options = _options;
51
+ }
52
+ /**
53
+ * Two types of prompts can be created - a root prompt or a child prompt (aka Prompt Version in app).
54
+ *
55
+ * A root prompt can be created by providing the `name` param, and it will always be tagged as prod.
56
+ *
57
+ * A child prompt can be created by providing the `parent_id` param. Note that the `name` param in this case will be ignored as all descendents from a root prompt would share the root's name. `is_prod` can also be provided to configure whether a child should be tagged as prod.
58
+ *
59
+ * @param {Scorecard.PromptCreateParams} request
60
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Scorecard.UnauthorizedError}
63
+ * @throws {@link Scorecard.ForbiddenError}
64
+ * @throws {@link Scorecard.NotFoundError}
65
+ * @throws {@link Scorecard.UnprocessableEntityError}
66
+ *
67
+ * @example
68
+ * await scorecard.prompt.create({
69
+ * promptTemplate: "<system>\nYou are a helpful assistant. Use the provided context to answer the user's query.\n\nContext: {context}\n</system>\n\n<user>\n{user_query}\n</user>",
70
+ * name: "Prompt Name",
71
+ * description: "Description of the prompt",
72
+ * modelParams: {
73
+ * "param1": "value1",
74
+ * "param2": 0.1,
75
+ * "param3": 100,
76
+ * "param4": true
77
+ * }
78
+ * })
79
+ *
80
+ * @example
81
+ * await scorecard.prompt.create({
82
+ * promptTemplate: "<system>\nYou are a helpful assistant. Use the provided context to answer the user's query.\n\nContext: {context}\n</system>\n\n<user>\n{user_query}\n</user>",
83
+ * parentId: "7ac3cbd5-3b99-4e72-97f3-9cd2e749cace",
84
+ * description: "Description of the prompt",
85
+ * modelParams: {
86
+ * "param1": "value1",
87
+ * "param2": 0.1,
88
+ * "param3": 100,
89
+ * "param4": true
90
+ * },
91
+ * isProd: true
92
+ * })
93
+ */
94
+ create(request, requestOptions) {
95
+ var _a;
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ const _response = yield core.fetcher({
98
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, "v1/prompt"),
99
+ method: "POST",
100
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
101
+ contentType: "application/json",
102
+ body: yield serializers.PromptCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
103
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
104
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
105
+ });
106
+ if (_response.ok) {
107
+ return yield serializers.Prompt.parseOrThrow(_response.body, {
108
+ unrecognizedObjectKeys: "passthrough",
109
+ allowUnrecognizedUnionMembers: true,
110
+ allowUnrecognizedEnumValues: true,
111
+ skipValidation: true,
112
+ breadcrumbsPrefix: ["response"],
113
+ });
114
+ }
115
+ if (_response.error.reason === "status-code") {
116
+ switch (_response.error.statusCode) {
117
+ case 401:
118
+ throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
119
+ unrecognizedObjectKeys: "passthrough",
120
+ allowUnrecognizedUnionMembers: true,
121
+ allowUnrecognizedEnumValues: true,
122
+ skipValidation: true,
123
+ breadcrumbsPrefix: ["response"],
124
+ }));
125
+ case 403:
126
+ throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
127
+ unrecognizedObjectKeys: "passthrough",
128
+ allowUnrecognizedUnionMembers: true,
129
+ allowUnrecognizedEnumValues: true,
130
+ skipValidation: true,
131
+ breadcrumbsPrefix: ["response"],
132
+ }));
133
+ case 404:
134
+ throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
135
+ unrecognizedObjectKeys: "passthrough",
136
+ allowUnrecognizedUnionMembers: true,
137
+ allowUnrecognizedEnumValues: true,
138
+ skipValidation: true,
139
+ breadcrumbsPrefix: ["response"],
140
+ }));
141
+ case 422:
142
+ throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
143
+ unrecognizedObjectKeys: "passthrough",
144
+ allowUnrecognizedUnionMembers: true,
145
+ allowUnrecognizedEnumValues: true,
146
+ skipValidation: true,
147
+ breadcrumbsPrefix: ["response"],
148
+ }));
149
+ default:
150
+ throw new errors.ScorecardError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ });
154
+ }
155
+ }
156
+ switch (_response.error.reason) {
157
+ case "non-json":
158
+ throw new errors.ScorecardError({
159
+ statusCode: _response.error.statusCode,
160
+ body: _response.error.rawBody,
161
+ });
162
+ case "timeout":
163
+ throw new errors.ScorecardTimeoutError();
164
+ case "unknown":
165
+ throw new errors.ScorecardError({
166
+ message: _response.error.errorMessage,
167
+ });
168
+ }
169
+ });
170
+ }
171
+ /**
172
+ * Retrieve a prompt by id
173
+ *
174
+ * @param {string} id - The id of the prompt to get.
175
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
176
+ *
177
+ * @throws {@link Scorecard.UnauthorizedError}
178
+ * @throws {@link Scorecard.ForbiddenError}
179
+ * @throws {@link Scorecard.NotFoundError}
180
+ * @throws {@link Scorecard.UnprocessableEntityError}
181
+ *
182
+ * @example
183
+ * await scorecard.prompt.get("id")
184
+ */
185
+ get(id, requestOptions) {
186
+ var _a;
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ const _response = yield core.fetcher({
189
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
190
+ method: "GET",
191
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
192
+ contentType: "application/json",
193
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
194
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
195
+ });
196
+ if (_response.ok) {
197
+ return yield serializers.Prompt.parseOrThrow(_response.body, {
198
+ unrecognizedObjectKeys: "passthrough",
199
+ allowUnrecognizedUnionMembers: true,
200
+ allowUnrecognizedEnumValues: true,
201
+ skipValidation: true,
202
+ breadcrumbsPrefix: ["response"],
203
+ });
204
+ }
205
+ if (_response.error.reason === "status-code") {
206
+ switch (_response.error.statusCode) {
207
+ case 401:
208
+ throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
209
+ unrecognizedObjectKeys: "passthrough",
210
+ allowUnrecognizedUnionMembers: true,
211
+ allowUnrecognizedEnumValues: true,
212
+ skipValidation: true,
213
+ breadcrumbsPrefix: ["response"],
214
+ }));
215
+ case 403:
216
+ throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
217
+ unrecognizedObjectKeys: "passthrough",
218
+ allowUnrecognizedUnionMembers: true,
219
+ allowUnrecognizedEnumValues: true,
220
+ skipValidation: true,
221
+ breadcrumbsPrefix: ["response"],
222
+ }));
223
+ case 404:
224
+ throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
225
+ unrecognizedObjectKeys: "passthrough",
226
+ allowUnrecognizedUnionMembers: true,
227
+ allowUnrecognizedEnumValues: true,
228
+ skipValidation: true,
229
+ breadcrumbsPrefix: ["response"],
230
+ }));
231
+ case 422:
232
+ throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
233
+ unrecognizedObjectKeys: "passthrough",
234
+ allowUnrecognizedUnionMembers: true,
235
+ allowUnrecognizedEnumValues: true,
236
+ skipValidation: true,
237
+ breadcrumbsPrefix: ["response"],
238
+ }));
239
+ default:
240
+ throw new errors.ScorecardError({
241
+ statusCode: _response.error.statusCode,
242
+ body: _response.error.body,
243
+ });
244
+ }
245
+ }
246
+ switch (_response.error.reason) {
247
+ case "non-json":
248
+ throw new errors.ScorecardError({
249
+ statusCode: _response.error.statusCode,
250
+ body: _response.error.rawBody,
251
+ });
252
+ case "timeout":
253
+ throw new errors.ScorecardTimeoutError();
254
+ case "unknown":
255
+ throw new errors.ScorecardError({
256
+ message: _response.error.errorMessage,
257
+ });
258
+ }
259
+ });
260
+ }
261
+ /**
262
+ * Delete a root prompt and all of its children.
263
+ *
264
+ * @param {string} id - The id of the root prompt to delete.
265
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
266
+ *
267
+ * @throws {@link Scorecard.UnauthorizedError}
268
+ * @throws {@link Scorecard.ForbiddenError}
269
+ * @throws {@link Scorecard.NotFoundError}
270
+ * @throws {@link Scorecard.UnprocessableEntityError}
271
+ *
272
+ * @example
273
+ * await scorecard.prompt.delete("id")
274
+ */
275
+ delete(id, requestOptions) {
276
+ var _a;
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ const _response = yield core.fetcher({
279
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
280
+ method: "DELETE",
281
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
282
+ contentType: "application/json",
283
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
284
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
285
+ });
286
+ if (_response.ok) {
287
+ return _response.body;
288
+ }
289
+ if (_response.error.reason === "status-code") {
290
+ switch (_response.error.statusCode) {
291
+ case 401:
292
+ throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
293
+ unrecognizedObjectKeys: "passthrough",
294
+ allowUnrecognizedUnionMembers: true,
295
+ allowUnrecognizedEnumValues: true,
296
+ skipValidation: true,
297
+ breadcrumbsPrefix: ["response"],
298
+ }));
299
+ case 403:
300
+ throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
301
+ unrecognizedObjectKeys: "passthrough",
302
+ allowUnrecognizedUnionMembers: true,
303
+ allowUnrecognizedEnumValues: true,
304
+ skipValidation: true,
305
+ breadcrumbsPrefix: ["response"],
306
+ }));
307
+ case 404:
308
+ throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
309
+ unrecognizedObjectKeys: "passthrough",
310
+ allowUnrecognizedUnionMembers: true,
311
+ allowUnrecognizedEnumValues: true,
312
+ skipValidation: true,
313
+ breadcrumbsPrefix: ["response"],
314
+ }));
315
+ case 422:
316
+ throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
317
+ unrecognizedObjectKeys: "passthrough",
318
+ allowUnrecognizedUnionMembers: true,
319
+ allowUnrecognizedEnumValues: true,
320
+ skipValidation: true,
321
+ breadcrumbsPrefix: ["response"],
322
+ }));
323
+ default:
324
+ throw new errors.ScorecardError({
325
+ statusCode: _response.error.statusCode,
326
+ body: _response.error.body,
327
+ });
328
+ }
329
+ }
330
+ switch (_response.error.reason) {
331
+ case "non-json":
332
+ throw new errors.ScorecardError({
333
+ statusCode: _response.error.statusCode,
334
+ body: _response.error.rawBody,
335
+ });
336
+ case "timeout":
337
+ throw new errors.ScorecardTimeoutError();
338
+ case "unknown":
339
+ throw new errors.ScorecardError({
340
+ message: _response.error.errorMessage,
341
+ });
342
+ }
343
+ });
344
+ }
345
+ /**
346
+ * Update a prompt.
347
+ *
348
+ * `is_prod` tags the provided prompt as the production prompt within the prompt graph.
349
+ *
350
+ * @param {string} id - The id of the prompt to update.
351
+ * @param {Scorecard.PromptUpdateParams} request
352
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
353
+ *
354
+ * @throws {@link Scorecard.UnauthorizedError}
355
+ * @throws {@link Scorecard.ForbiddenError}
356
+ * @throws {@link Scorecard.NotFoundError}
357
+ * @throws {@link Scorecard.UnprocessableEntityError}
358
+ *
359
+ * @example
360
+ * await scorecard.prompt.update("id", {
361
+ * isProd: true
362
+ * })
363
+ */
364
+ update(id, request = {}, requestOptions) {
365
+ var _a;
366
+ return __awaiter(this, void 0, void 0, function* () {
367
+ const _response = yield core.fetcher({
368
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
369
+ method: "PATCH",
370
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
371
+ contentType: "application/json",
372
+ body: yield serializers.PromptUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
373
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
374
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
375
+ });
376
+ if (_response.ok) {
377
+ return yield serializers.Prompt.parseOrThrow(_response.body, {
378
+ unrecognizedObjectKeys: "passthrough",
379
+ allowUnrecognizedUnionMembers: true,
380
+ allowUnrecognizedEnumValues: true,
381
+ skipValidation: true,
382
+ breadcrumbsPrefix: ["response"],
383
+ });
384
+ }
385
+ if (_response.error.reason === "status-code") {
386
+ switch (_response.error.statusCode) {
387
+ case 401:
388
+ throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
389
+ unrecognizedObjectKeys: "passthrough",
390
+ allowUnrecognizedUnionMembers: true,
391
+ allowUnrecognizedEnumValues: true,
392
+ skipValidation: true,
393
+ breadcrumbsPrefix: ["response"],
394
+ }));
395
+ case 403:
396
+ throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
397
+ unrecognizedObjectKeys: "passthrough",
398
+ allowUnrecognizedUnionMembers: true,
399
+ allowUnrecognizedEnumValues: true,
400
+ skipValidation: true,
401
+ breadcrumbsPrefix: ["response"],
402
+ }));
403
+ case 404:
404
+ throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
405
+ unrecognizedObjectKeys: "passthrough",
406
+ allowUnrecognizedUnionMembers: true,
407
+ allowUnrecognizedEnumValues: true,
408
+ skipValidation: true,
409
+ breadcrumbsPrefix: ["response"],
410
+ }));
411
+ case 422:
412
+ throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
413
+ unrecognizedObjectKeys: "passthrough",
414
+ allowUnrecognizedUnionMembers: true,
415
+ allowUnrecognizedEnumValues: true,
416
+ skipValidation: true,
417
+ breadcrumbsPrefix: ["response"],
418
+ }));
419
+ default:
420
+ throw new errors.ScorecardError({
421
+ statusCode: _response.error.statusCode,
422
+ body: _response.error.body,
423
+ });
424
+ }
425
+ }
426
+ switch (_response.error.reason) {
427
+ case "non-json":
428
+ throw new errors.ScorecardError({
429
+ statusCode: _response.error.statusCode,
430
+ body: _response.error.rawBody,
431
+ });
432
+ case "timeout":
433
+ throw new errors.ScorecardTimeoutError();
434
+ case "unknown":
435
+ throw new errors.ScorecardError({
436
+ message: _response.error.errorMessage,
437
+ });
438
+ }
439
+ });
440
+ }
441
+ /**
442
+ * Retrieve a prod prompt by name
443
+ *
444
+ * @param {string} name - Name of the prompt.
445
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
446
+ *
447
+ * @throws {@link Scorecard.UnauthorizedError}
448
+ * @throws {@link Scorecard.ForbiddenError}
449
+ * @throws {@link Scorecard.NotFoundError}
450
+ * @throws {@link Scorecard.UnprocessableEntityError}
451
+ *
452
+ * @example
453
+ * await scorecard.prompt.getByName("name")
454
+ */
455
+ getByName(name, requestOptions) {
456
+ var _a;
457
+ return __awaiter(this, void 0, void 0, function* () {
458
+ const _response = yield core.fetcher({
459
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/name/${encodeURIComponent(name)}`),
460
+ method: "GET",
461
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
462
+ contentType: "application/json",
463
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
464
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
465
+ });
466
+ if (_response.ok) {
467
+ return yield serializers.Prompt.parseOrThrow(_response.body, {
468
+ unrecognizedObjectKeys: "passthrough",
469
+ allowUnrecognizedUnionMembers: true,
470
+ allowUnrecognizedEnumValues: true,
471
+ skipValidation: true,
472
+ breadcrumbsPrefix: ["response"],
473
+ });
474
+ }
475
+ if (_response.error.reason === "status-code") {
476
+ switch (_response.error.statusCode) {
477
+ case 401:
478
+ throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
479
+ unrecognizedObjectKeys: "passthrough",
480
+ allowUnrecognizedUnionMembers: true,
481
+ allowUnrecognizedEnumValues: true,
482
+ skipValidation: true,
483
+ breadcrumbsPrefix: ["response"],
484
+ }));
485
+ case 403:
486
+ throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
487
+ unrecognizedObjectKeys: "passthrough",
488
+ allowUnrecognizedUnionMembers: true,
489
+ allowUnrecognizedEnumValues: true,
490
+ skipValidation: true,
491
+ breadcrumbsPrefix: ["response"],
492
+ }));
493
+ case 404:
494
+ throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
495
+ unrecognizedObjectKeys: "passthrough",
496
+ allowUnrecognizedUnionMembers: true,
497
+ allowUnrecognizedEnumValues: true,
498
+ skipValidation: true,
499
+ breadcrumbsPrefix: ["response"],
500
+ }));
501
+ case 422:
502
+ throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
503
+ unrecognizedObjectKeys: "passthrough",
504
+ allowUnrecognizedUnionMembers: true,
505
+ allowUnrecognizedEnumValues: true,
506
+ skipValidation: true,
507
+ breadcrumbsPrefix: ["response"],
508
+ }));
509
+ default:
510
+ throw new errors.ScorecardError({
511
+ statusCode: _response.error.statusCode,
512
+ body: _response.error.body,
513
+ });
514
+ }
515
+ }
516
+ switch (_response.error.reason) {
517
+ case "non-json":
518
+ throw new errors.ScorecardError({
519
+ statusCode: _response.error.statusCode,
520
+ body: _response.error.rawBody,
521
+ });
522
+ case "timeout":
523
+ throw new errors.ScorecardTimeoutError();
524
+ case "unknown":
525
+ throw new errors.ScorecardError({
526
+ message: _response.error.errorMessage,
527
+ });
528
+ }
529
+ });
530
+ }
531
+ _getCustomAuthorizationHeaders() {
532
+ var _a;
533
+ return __awaiter(this, void 0, void 0, function* () {
534
+ const apiKeyValue = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["SCORECARD_API_KEY"];
535
+ return { "X-API-Key": apiKeyValue };
536
+ });
537
+ }
538
+ }
539
+ exports.Prompt = Prompt;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,40 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Scorecard from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * promptTemplate: "<system>\nYou are a helpful assistant. Use the provided context to answer the user's query.\n\nContext: {context}\n</system>\n\n<user>\n{user_query}\n</user>",
9
+ * name: "Prompt Name",
10
+ * description: "Description of the prompt",
11
+ * modelParams: {
12
+ * "param1": "value1",
13
+ * "param2": 0.1,
14
+ * "param3": 100,
15
+ * "param4": true
16
+ * }
17
+ * }
18
+ *
19
+ * @example
20
+ * {
21
+ * promptTemplate: "<system>\nYou are a helpful assistant. Use the provided context to answer the user's query.\n\nContext: {context}\n</system>\n\n<user>\n{user_query}\n</user>",
22
+ * parentId: "7ac3cbd5-3b99-4e72-97f3-9cd2e749cace",
23
+ * description: "Description of the prompt",
24
+ * modelParams: {
25
+ * "param1": "value1",
26
+ * "param2": 0.1,
27
+ * "param3": 100,
28
+ * "param4": true
29
+ * },
30
+ * isProd: true
31
+ * }
32
+ */
33
+ export interface PromptCreateParams {
34
+ promptTemplate: string;
35
+ name?: string;
36
+ parentId?: string;
37
+ description?: string;
38
+ modelParams?: Record<string, Scorecard.PromptCreateParamsModelParamsValue | undefined>;
39
+ isProd?: boolean;
40
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * isProd: true
8
+ * }
9
+ */
10
+ export interface PromptUpdateParams {
11
+ isProd?: boolean;
12
+ }
@@ -0,0 +1,2 @@
1
+ export { type PromptCreateParams } from "./PromptCreateParams";
2
+ export { type PromptUpdateParams } from "./PromptUpdateParams";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./client";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export declare type PromptCreateParamsModelParamsValue = number | number | string | boolean;
@@ -0,0 +1 @@
1
+ export * from "./PromptCreateParamsModelParamsValue";