scorecard-ai 0.5.4 → 0.6.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 (350) hide show
  1. package/Client.d.ts +9 -3
  2. package/Client.js +8 -3
  3. package/api/resources/index.d.ts +3 -1
  4. package/api/resources/index.js +4 -2
  5. package/api/resources/prompt/client/Client.d.ts +27 -22
  6. package/api/resources/prompt/client/Client.js +110 -99
  7. package/api/resources/prompt/client/requests/PromptGetByNameRequest.d.ts +15 -0
  8. package/api/resources/prompt/client/requests/index.d.ts +1 -0
  9. package/api/resources/run/client/Client.d.ts +6 -3
  10. package/api/resources/run/client/Client.js +26 -23
  11. package/api/resources/runMetric/client/Client.d.ts +4 -1
  12. package/api/resources/runMetric/client/Client.js +8 -7
  13. package/api/resources/score/client/Client.d.ts +5 -2
  14. package/api/resources/score/client/Client.js +18 -16
  15. package/api/resources/scoringConfig/client/Client.d.ts +62 -0
  16. package/{dist/api/resources/traces → api/resources/scoringConfig}/client/Client.js +114 -16
  17. package/api/resources/scoringConfig/client/index.d.ts +1 -0
  18. package/api/resources/scoringConfig/client/index.js +17 -0
  19. package/api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +16 -0
  20. package/api/resources/scoringConfig/client/requests/index.d.ts +1 -0
  21. package/api/resources/testcase/client/Client.d.ts +55 -3
  22. package/api/resources/testcase/client/Client.js +308 -22
  23. package/api/resources/testcase/client/requests/TestcaseBatchCopyParams.d.ts +11 -0
  24. package/api/resources/testcase/client/requests/TestcaseBatchCopyParams.js +5 -0
  25. package/api/resources/testcase/client/requests/TestcaseBatchDeleteParams.d.ts +11 -0
  26. package/api/resources/testcase/client/requests/TestcaseBatchDeleteParams.js +5 -0
  27. package/api/resources/testcase/client/requests/TestcaseUpdateParams.d.ts +18 -0
  28. package/api/resources/testcase/client/requests/TestcaseUpdateParams.js +5 -0
  29. package/api/resources/testcase/client/requests/index.d.ts +3 -0
  30. package/api/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.d.ts +5 -0
  31. package/api/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.js +5 -0
  32. package/api/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.d.ts +5 -0
  33. package/api/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.js +5 -0
  34. package/api/resources/testcase/types/index.d.ts +2 -0
  35. package/api/resources/testcase/types/index.js +2 -0
  36. package/api/resources/testrecord/client/Client.d.ts +5 -2
  37. package/api/resources/testrecord/client/Client.js +17 -15
  38. package/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +2 -0
  39. package/api/resources/testset/client/Client.d.ts +24 -5
  40. package/api/resources/testset/client/Client.js +135 -36
  41. package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +6 -0
  42. package/api/resources/testset/client/requests/TestsetUpdateParams.d.ts +16 -0
  43. package/api/resources/testset/client/requests/TestsetUpdateParams.js +5 -0
  44. package/api/resources/testset/client/requests/index.d.ts +1 -0
  45. package/api/resources/tracing/client/Client.d.ts +72 -0
  46. package/api/resources/tracing/client/Client.js +327 -0
  47. package/api/types/IngestionMethod.d.ts +8 -0
  48. package/api/types/IngestionMethod.js +10 -0
  49. package/api/types/ScoringConfig.d.ts +16 -0
  50. package/api/types/ScoringConfig.js +5 -0
  51. package/api/types/TestcaseBatchDeletionResponse.d.ts +9 -0
  52. package/api/types/TestcaseBatchDeletionResponse.js +5 -0
  53. package/api/types/Testrecord.d.ts +2 -0
  54. package/api/types/Trace.d.ts +2 -0
  55. package/api/types/index.d.ts +6 -4
  56. package/api/types/index.js +6 -4
  57. package/core/fetcher/Fetcher.d.ts +4 -1
  58. package/core/fetcher/Fetcher.js +19 -176
  59. package/core/fetcher/createRequestUrl.d.ts +1 -0
  60. package/core/fetcher/createRequestUrl.js +13 -0
  61. package/core/fetcher/getFetchFn.d.ts +4 -0
  62. package/core/fetcher/getFetchFn.js +59 -0
  63. package/core/fetcher/getRequestBody.d.ts +7 -0
  64. package/core/fetcher/getRequestBody.js +23 -0
  65. package/core/fetcher/getResponseBody.d.ts +1 -0
  66. package/core/fetcher/getResponseBody.js +52 -0
  67. package/core/fetcher/makeRequest.d.ts +1 -0
  68. package/core/fetcher/makeRequest.js +42 -0
  69. package/core/fetcher/requestWithRetries.d.ts +1 -0
  70. package/core/fetcher/requestWithRetries.js +32 -0
  71. package/core/fetcher/signals.d.ts +12 -0
  72. package/core/fetcher/signals.js +37 -0
  73. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +31 -0
  74. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +245 -0
  75. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
  76. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
  77. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  78. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +227 -0
  79. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  80. package/{serialization/resources/traces/client/get.js → core/fetcher/stream-wrappers/chooseStreamWrapper.js} +16 -6
  81. package/core/runtime/runtime.d.ts +2 -1
  82. package/core/runtime/runtime.js +12 -1
  83. package/core/schemas/Schema.d.ts +7 -4
  84. package/core/schemas/builders/lazy/lazy.d.ts +2 -2
  85. package/core/schemas/builders/lazy/lazy.js +8 -19
  86. package/core/schemas/builders/lazy/lazyObject.js +1 -10
  87. package/core/schemas/builders/list/list.js +31 -44
  88. package/core/schemas/builders/object/object.js +90 -111
  89. package/core/schemas/builders/object/types.d.ts +2 -2
  90. package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  91. package/core/schemas/builders/record/record.js +49 -60
  92. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  93. package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  94. package/core/schemas/builders/set/set.js +6 -15
  95. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  96. package/core/schemas/builders/union/union.js +51 -62
  97. package/core/schemas/utils/maybeSkipValidation.js +3 -12
  98. package/dist/Client.d.ts +9 -3
  99. package/dist/Client.js +8 -3
  100. package/dist/api/resources/index.d.ts +3 -1
  101. package/dist/api/resources/index.js +4 -2
  102. package/dist/api/resources/prompt/client/Client.d.ts +27 -22
  103. package/dist/api/resources/prompt/client/Client.js +110 -99
  104. package/dist/api/resources/prompt/client/requests/PromptGetByNameRequest.d.ts +15 -0
  105. package/dist/api/resources/prompt/client/requests/PromptGetByNameRequest.js +5 -0
  106. package/dist/api/resources/prompt/client/requests/index.d.ts +1 -0
  107. package/dist/api/resources/run/client/Client.d.ts +6 -3
  108. package/dist/api/resources/run/client/Client.js +26 -23
  109. package/dist/api/resources/runMetric/client/Client.d.ts +4 -1
  110. package/dist/api/resources/runMetric/client/Client.js +8 -7
  111. package/dist/api/resources/score/client/Client.d.ts +5 -2
  112. package/dist/api/resources/score/client/Client.js +18 -16
  113. package/dist/api/resources/scoringConfig/client/Client.d.ts +62 -0
  114. package/{api/resources/traces → dist/api/resources/scoringConfig}/client/Client.js +114 -16
  115. package/dist/api/resources/scoringConfig/client/index.d.ts +1 -0
  116. package/dist/api/resources/scoringConfig/client/index.js +17 -0
  117. package/dist/api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +16 -0
  118. package/dist/api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js +5 -0
  119. package/dist/api/resources/scoringConfig/client/requests/index.d.ts +1 -0
  120. package/dist/api/resources/scoringConfig/client/requests/index.js +2 -0
  121. package/dist/api/resources/testcase/client/Client.d.ts +55 -3
  122. package/dist/api/resources/testcase/client/Client.js +308 -22
  123. package/dist/api/resources/testcase/client/requests/TestcaseBatchCopyParams.d.ts +11 -0
  124. package/dist/api/resources/testcase/client/requests/TestcaseBatchCopyParams.js +5 -0
  125. package/dist/api/resources/testcase/client/requests/TestcaseBatchDeleteParams.d.ts +11 -0
  126. package/dist/api/resources/testcase/client/requests/TestcaseBatchDeleteParams.js +5 -0
  127. package/dist/api/resources/testcase/client/requests/TestcaseUpdateParams.d.ts +18 -0
  128. package/dist/api/resources/testcase/client/requests/TestcaseUpdateParams.js +5 -0
  129. package/dist/api/resources/testcase/client/requests/index.d.ts +3 -0
  130. package/dist/api/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.d.ts +5 -0
  131. package/dist/api/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.js +5 -0
  132. package/dist/api/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.d.ts +5 -0
  133. package/dist/api/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.js +5 -0
  134. package/dist/api/resources/testcase/types/index.d.ts +2 -0
  135. package/dist/api/resources/testcase/types/index.js +2 -0
  136. package/dist/api/resources/testrecord/client/Client.d.ts +5 -2
  137. package/dist/api/resources/testrecord/client/Client.js +17 -15
  138. package/dist/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +2 -0
  139. package/dist/api/resources/testset/client/Client.d.ts +24 -5
  140. package/dist/api/resources/testset/client/Client.js +135 -36
  141. package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +6 -0
  142. package/dist/api/resources/testset/client/requests/TestsetUpdateParams.d.ts +16 -0
  143. package/dist/api/resources/testset/client/requests/TestsetUpdateParams.js +5 -0
  144. package/dist/api/resources/testset/client/requests/index.d.ts +1 -0
  145. package/dist/api/resources/tracing/client/Client.d.ts +72 -0
  146. package/dist/api/resources/tracing/client/Client.js +327 -0
  147. package/dist/api/resources/tracing/client/index.js +2 -0
  148. package/dist/api/types/IngestionMethod.d.ts +8 -0
  149. package/dist/api/types/IngestionMethod.js +10 -0
  150. package/dist/api/types/ScoringConfig.d.ts +16 -0
  151. package/dist/api/types/ScoringConfig.js +5 -0
  152. package/dist/api/types/TestcaseBatchDeletionResponse.d.ts +9 -0
  153. package/dist/api/types/TestcaseBatchDeletionResponse.js +5 -0
  154. package/dist/api/types/Testrecord.d.ts +2 -0
  155. package/dist/api/types/Trace.d.ts +2 -0
  156. package/dist/api/types/index.d.ts +6 -4
  157. package/dist/api/types/index.js +6 -4
  158. package/dist/core/fetcher/Fetcher.d.ts +4 -1
  159. package/dist/core/fetcher/Fetcher.js +19 -176
  160. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  161. package/dist/core/fetcher/createRequestUrl.js +13 -0
  162. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  163. package/dist/core/fetcher/getFetchFn.js +59 -0
  164. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  165. package/dist/core/fetcher/getRequestBody.js +23 -0
  166. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  167. package/dist/core/fetcher/getResponseBody.js +52 -0
  168. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  169. package/dist/core/fetcher/makeRequest.js +42 -0
  170. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  171. package/dist/core/fetcher/requestWithRetries.js +32 -0
  172. package/dist/core/fetcher/signals.d.ts +12 -0
  173. package/dist/core/fetcher/signals.js +37 -0
  174. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +31 -0
  175. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +245 -0
  176. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
  177. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
  178. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  179. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +227 -0
  180. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  181. package/dist/{serialization/resources/traces/client/get.js → core/fetcher/stream-wrappers/chooseStreamWrapper.js} +16 -6
  182. package/dist/core/runtime/runtime.d.ts +2 -1
  183. package/dist/core/runtime/runtime.js +12 -1
  184. package/dist/core/schemas/Schema.d.ts +7 -4
  185. package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
  186. package/dist/core/schemas/builders/lazy/lazy.js +8 -19
  187. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
  188. package/dist/core/schemas/builders/list/list.js +31 -44
  189. package/dist/core/schemas/builders/object/object.js +90 -111
  190. package/dist/core/schemas/builders/object/types.d.ts +2 -2
  191. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  192. package/dist/core/schemas/builders/record/record.js +49 -60
  193. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  194. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  195. package/dist/core/schemas/builders/set/set.js +6 -15
  196. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  197. package/dist/core/schemas/builders/union/union.js +51 -62
  198. package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
  199. package/dist/serialization/resources/index.d.ts +3 -1
  200. package/dist/serialization/resources/index.js +4 -2
  201. package/dist/serialization/resources/scoringConfig/client/index.d.ts +1 -0
  202. package/dist/serialization/resources/scoringConfig/client/index.js +17 -0
  203. package/dist/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +14 -0
  204. package/dist/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js +35 -0
  205. package/dist/serialization/resources/scoringConfig/client/requests/index.d.ts +1 -0
  206. package/dist/serialization/resources/scoringConfig/client/requests/index.js +5 -0
  207. package/dist/serialization/resources/scoringConfig/index.d.ts +1 -0
  208. package/dist/serialization/resources/scoringConfig/index.js +17 -0
  209. package/dist/serialization/resources/testcase/client/requests/TestcaseBatchCopyParams.d.ts +12 -0
  210. package/dist/serialization/resources/testcase/client/requests/TestcaseBatchCopyParams.js +33 -0
  211. package/dist/serialization/resources/testcase/client/requests/TestcaseBatchDeleteParams.d.ts +12 -0
  212. package/dist/serialization/resources/testcase/client/requests/TestcaseBatchDeleteParams.js +33 -0
  213. package/dist/serialization/resources/testcase/client/requests/TestcaseUpdateParams.d.ts +18 -0
  214. package/dist/serialization/resources/testcase/client/requests/TestcaseUpdateParams.js +43 -0
  215. package/dist/serialization/resources/testcase/client/requests/index.d.ts +3 -0
  216. package/dist/serialization/resources/testcase/client/requests/index.js +7 -1
  217. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +2 -10
  218. package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +2 -10
  219. package/dist/serialization/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.d.ts +11 -0
  220. package/dist/serialization/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.js +40 -0
  221. package/dist/serialization/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.d.ts +11 -0
  222. package/dist/serialization/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.js +40 -0
  223. package/dist/serialization/resources/testcase/types/index.d.ts +2 -0
  224. package/dist/serialization/resources/testcase/types/index.js +2 -0
  225. package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -0
  226. package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +1 -0
  227. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -10
  228. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -10
  229. package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -10
  230. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -0
  231. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.js +4 -0
  232. package/dist/serialization/resources/testset/client/requests/TestsetUpdateParams.d.ts +16 -0
  233. package/dist/serialization/resources/testset/client/requests/TestsetUpdateParams.js +37 -0
  234. package/dist/serialization/resources/testset/client/requests/index.d.ts +1 -0
  235. package/dist/serialization/resources/testset/client/requests/index.js +3 -1
  236. package/dist/serialization/resources/tracing/client/index.d.ts +1 -0
  237. package/{serialization/resources/traces → dist/serialization/resources/tracing}/client/index.js +2 -2
  238. package/dist/serialization/resources/{traces/client/get.d.ts → tracing/client/traces.d.ts} +3 -2
  239. package/dist/serialization/resources/tracing/client/traces.js +32 -0
  240. package/dist/serialization/resources/tracing/index.d.ts +1 -0
  241. package/dist/serialization/resources/tracing/index.js +17 -0
  242. package/dist/serialization/types/IngestionMethod.d.ts +10 -0
  243. package/dist/serialization/types/IngestionMethod.js +31 -0
  244. package/dist/serialization/types/JsonObject.js +2 -10
  245. package/dist/serialization/types/JsonObjectInputValue.js +3 -11
  246. package/dist/serialization/types/JsonObjectOutputValue.js +3 -11
  247. package/dist/serialization/types/ScoringConfig.d.ts +20 -0
  248. package/dist/serialization/types/ScoringConfig.js +41 -0
  249. package/dist/serialization/types/Span.js +2 -10
  250. package/dist/serialization/types/TestCaseCustomInputsValue.js +2 -10
  251. package/dist/serialization/types/TestCaseCustomLabelsValue.js +2 -10
  252. package/dist/serialization/types/TestcaseBatchDeletionResponse.d.ts +13 -0
  253. package/dist/serialization/types/{TestCaseCreate.js → TestcaseBatchDeletionResponse.js} +4 -7
  254. package/dist/serialization/types/Testrecord.d.ts +1 -0
  255. package/dist/serialization/types/Testrecord.js +1 -0
  256. package/dist/serialization/types/TestrecordCustomInputsValue.js +2 -10
  257. package/dist/serialization/types/TestrecordCustomLabelsValue.js +2 -10
  258. package/dist/serialization/types/TestrecordCustomOutputsValue.js +2 -10
  259. package/dist/serialization/types/Trace.d.ts +1 -0
  260. package/dist/serialization/types/Trace.js +2 -0
  261. package/dist/serialization/types/index.d.ts +6 -4
  262. package/dist/serialization/types/index.js +6 -4
  263. package/package.json +8 -2
  264. package/reference.md +657 -569
  265. package/serialization/resources/index.d.ts +3 -1
  266. package/serialization/resources/index.js +4 -2
  267. package/serialization/resources/scoringConfig/client/index.d.ts +1 -0
  268. package/serialization/resources/scoringConfig/client/index.js +17 -0
  269. package/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +14 -0
  270. package/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js +35 -0
  271. package/serialization/resources/scoringConfig/client/requests/index.d.ts +1 -0
  272. package/serialization/resources/scoringConfig/client/requests/index.js +5 -0
  273. package/serialization/resources/scoringConfig/index.d.ts +1 -0
  274. package/serialization/resources/scoringConfig/index.js +17 -0
  275. package/serialization/resources/testcase/client/requests/TestcaseBatchCopyParams.d.ts +12 -0
  276. package/serialization/resources/testcase/client/requests/TestcaseBatchCopyParams.js +33 -0
  277. package/serialization/resources/testcase/client/requests/TestcaseBatchDeleteParams.d.ts +12 -0
  278. package/serialization/resources/testcase/client/requests/TestcaseBatchDeleteParams.js +33 -0
  279. package/serialization/resources/testcase/client/requests/TestcaseUpdateParams.d.ts +18 -0
  280. package/serialization/resources/testcase/client/requests/TestcaseUpdateParams.js +43 -0
  281. package/serialization/resources/testcase/client/requests/index.d.ts +3 -0
  282. package/serialization/resources/testcase/client/requests/index.js +7 -1
  283. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +2 -10
  284. package/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +2 -10
  285. package/serialization/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.d.ts +11 -0
  286. package/serialization/resources/testcase/types/TestcaseUpdateParamsCustomInputsValue.js +40 -0
  287. package/serialization/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.d.ts +11 -0
  288. package/serialization/resources/testcase/types/TestcaseUpdateParamsCustomLabelsValue.js +40 -0
  289. package/serialization/resources/testcase/types/index.d.ts +2 -0
  290. package/serialization/resources/testcase/types/index.js +2 -0
  291. package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -0
  292. package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +1 -0
  293. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -10
  294. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -10
  295. package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -10
  296. package/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -0
  297. package/serialization/resources/testset/client/requests/TestsetCreateParams.js +4 -0
  298. package/serialization/resources/testset/client/requests/TestsetUpdateParams.d.ts +16 -0
  299. package/serialization/resources/testset/client/requests/TestsetUpdateParams.js +37 -0
  300. package/serialization/resources/testset/client/requests/index.d.ts +1 -0
  301. package/serialization/resources/testset/client/requests/index.js +3 -1
  302. package/serialization/resources/tracing/client/index.d.ts +1 -0
  303. package/{dist/serialization/resources/traces → serialization/resources/tracing}/client/index.js +2 -2
  304. package/serialization/resources/{traces/client/get.d.ts → tracing/client/traces.d.ts} +3 -2
  305. package/serialization/resources/tracing/client/traces.js +32 -0
  306. package/serialization/resources/tracing/index.d.ts +1 -0
  307. package/serialization/resources/tracing/index.js +17 -0
  308. package/serialization/types/IngestionMethod.d.ts +10 -0
  309. package/serialization/types/IngestionMethod.js +31 -0
  310. package/serialization/types/JsonObject.js +2 -10
  311. package/serialization/types/JsonObjectInputValue.js +3 -11
  312. package/serialization/types/JsonObjectOutputValue.js +3 -11
  313. package/serialization/types/ScoringConfig.d.ts +20 -0
  314. package/serialization/types/ScoringConfig.js +41 -0
  315. package/serialization/types/Span.js +2 -10
  316. package/serialization/types/TestCaseCustomInputsValue.js +2 -10
  317. package/serialization/types/TestCaseCustomLabelsValue.js +2 -10
  318. package/serialization/types/TestcaseBatchDeletionResponse.d.ts +13 -0
  319. package/serialization/types/{TestCaseCreate.js → TestcaseBatchDeletionResponse.js} +4 -7
  320. package/serialization/types/Testrecord.d.ts +1 -0
  321. package/serialization/types/Testrecord.js +1 -0
  322. package/serialization/types/TestrecordCustomInputsValue.js +2 -10
  323. package/serialization/types/TestrecordCustomLabelsValue.js +2 -10
  324. package/serialization/types/TestrecordCustomOutputsValue.js +2 -10
  325. package/serialization/types/Trace.d.ts +1 -0
  326. package/serialization/types/Trace.js +2 -0
  327. package/serialization/types/index.d.ts +6 -4
  328. package/serialization/types/index.js +6 -4
  329. package/api/resources/traces/client/Client.d.ts +0 -40
  330. package/api/types/TestCaseCreate.d.ts +0 -10
  331. package/dist/api/resources/traces/client/Client.d.ts +0 -40
  332. package/dist/api/types/TestCaseCreate.d.ts +0 -10
  333. package/dist/serialization/resources/traces/client/index.d.ts +0 -1
  334. package/dist/serialization/types/TestCaseCreate.d.ts +0 -16
  335. package/serialization/resources/traces/client/index.d.ts +0 -1
  336. package/serialization/types/TestCaseCreate.d.ts +0 -16
  337. /package/api/{types/TestCaseCreate.js → resources/prompt/client/requests/PromptGetByNameRequest.js} +0 -0
  338. /package/{dist/api/types/TestCaseCreate.js → api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js} +0 -0
  339. /package/api/resources/{traces/client → scoringConfig/client/requests}/index.js +0 -0
  340. /package/api/resources/{traces → scoringConfig}/index.d.ts +0 -0
  341. /package/api/resources/{traces → scoringConfig}/index.js +0 -0
  342. /package/api/resources/{traces → tracing}/client/index.d.ts +0 -0
  343. /package/{dist/api/resources/traces → api/resources/tracing}/client/index.js +0 -0
  344. /package/{dist/api/resources/traces → api/resources/tracing}/index.d.ts +0 -0
  345. /package/{dist/api/resources/traces → api/resources/tracing}/index.js +0 -0
  346. /package/dist/{serialization/resources/traces → api/resources/scoringConfig}/index.d.ts +0 -0
  347. /package/dist/{serialization/resources/traces → api/resources/scoringConfig}/index.js +0 -0
  348. /package/dist/api/resources/{traces → tracing}/client/index.d.ts +0 -0
  349. /package/{serialization/resources/traces → dist/api/resources/tracing}/index.d.ts +0 -0
  350. /package/{serialization/resources/traces → dist/api/resources/tracing}/index.js +0 -0
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.record = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -18,10 +9,10 @@ const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
18
9
  const schema_utils_1 = require("../schema-utils");
19
10
  function record(keySchema, valueSchema) {
20
11
  const baseSchema = {
21
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
12
+ parse: (raw, opts) => {
22
13
  return validateAndTransformRecord({
23
14
  value: raw,
24
- isKeyNumeric: (yield keySchema.getType()) === Schema_1.SchemaType.NUMBER,
15
+ isKeyNumeric: keySchema.getType() === Schema_1.SchemaType.NUMBER,
25
16
  transformKey: (key) => {
26
17
  var _a;
27
18
  return keySchema.parse(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
@@ -32,11 +23,11 @@ function record(keySchema, valueSchema) {
32
23
  },
33
24
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
34
25
  });
35
- }),
36
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
26
+ },
27
+ json: (parsed, opts) => {
37
28
  return validateAndTransformRecord({
38
29
  value: parsed,
39
- isKeyNumeric: (yield keySchema.getType()) === Schema_1.SchemaType.NUMBER,
30
+ isKeyNumeric: keySchema.getType() === Schema_1.SchemaType.NUMBER,
40
31
  transformKey: (key) => {
41
32
  var _a;
42
33
  return keySchema.json(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
@@ -47,60 +38,58 @@ function record(keySchema, valueSchema) {
47
38
  },
48
39
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
49
40
  });
50
- }),
41
+ },
51
42
  getType: () => Schema_1.SchemaType.RECORD,
52
43
  };
53
44
  return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
54
45
  }
55
46
  exports.record = record;
56
47
  function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transformValue, breadcrumbsPrefix = [], }) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- if (!(0, isPlainObject_1.isPlainObject)(value)) {
59
- return {
60
- ok: false,
61
- errors: [
62
- {
63
- path: breadcrumbsPrefix,
64
- message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
65
- },
66
- ],
67
- };
48
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
49
+ return {
50
+ ok: false,
51
+ errors: [
52
+ {
53
+ path: breadcrumbsPrefix,
54
+ message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => {
60
+ // skip nullish keys
61
+ if (value == null) {
62
+ return accPromise;
68
63
  }
69
- return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => __awaiter(this, void 0, void 0, function* () {
70
- // skip nullish keys
71
- if (value == null) {
72
- return accPromise;
73
- }
74
- const acc = yield accPromise;
75
- let key = stringKey;
76
- if (isKeyNumeric) {
77
- const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
78
- if (!isNaN(numberKey)) {
79
- key = numberKey;
80
- }
81
- }
82
- const transformedKey = yield transformKey(key);
83
- const transformedValue = yield transformValue(value, key);
84
- if (acc.ok && transformedKey.ok && transformedValue.ok) {
85
- return {
86
- ok: true,
87
- value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
88
- };
89
- }
90
- const errors = [];
91
- if (!acc.ok) {
92
- errors.push(...acc.errors);
93
- }
94
- if (!transformedKey.ok) {
95
- errors.push(...transformedKey.errors);
96
- }
97
- if (!transformedValue.ok) {
98
- errors.push(...transformedValue.errors);
64
+ const acc = accPromise;
65
+ let key = stringKey;
66
+ if (isKeyNumeric) {
67
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
68
+ if (!isNaN(numberKey)) {
69
+ key = numberKey;
99
70
  }
71
+ }
72
+ const transformedKey = transformKey(key);
73
+ const transformedValue = transformValue(value, key);
74
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
100
75
  return {
101
- ok: false,
102
- errors,
76
+ ok: true,
77
+ value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
103
78
  };
104
- }), Promise.resolve({ ok: true, value: {} }));
105
- });
79
+ }
80
+ const errors = [];
81
+ if (!acc.ok) {
82
+ errors.push(...acc.errors);
83
+ }
84
+ if (!transformedKey.ok) {
85
+ errors.push(...transformedKey.errors);
86
+ }
87
+ if (!transformedValue.ok) {
88
+ errors.push(...transformedValue.errors);
89
+ }
90
+ return {
91
+ ok: false,
92
+ errors,
93
+ };
94
+ }, { ok: true, value: {} });
106
95
  }
@@ -2,8 +2,8 @@ import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
2
2
  export interface SchemaUtils<Raw, Parsed> {
3
3
  optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
4
4
  transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
5
- parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise<Parsed>;
6
- jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise<Raw>;
5
+ parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
6
+ jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
7
7
  }
8
8
  export interface SchemaTransformer<Parsed, Transformed> {
9
9
  transform: (parsed: Parsed) => Transformed;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.transform = exports.optional = exports.getSchemaUtils = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -17,20 +8,20 @@ function getSchemaUtils(schema) {
17
8
  return {
18
9
  optional: () => optional(schema),
19
10
  transform: (transformer) => transform(schema, transformer),
20
- parseOrThrow: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
21
- const parsed = yield schema.parse(raw, opts);
11
+ parseOrThrow: (raw, opts) => {
12
+ const parsed = schema.parse(raw, opts);
22
13
  if (parsed.ok) {
23
14
  return parsed.value;
24
15
  }
25
16
  throw new ParseError_1.ParseError(parsed.errors);
26
- }),
27
- jsonOrThrow: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
28
- const raw = yield schema.json(parsed, opts);
17
+ },
18
+ jsonOrThrow: (parsed, opts) => {
19
+ const raw = schema.json(parsed, opts);
29
20
  if (raw.ok) {
30
21
  return raw.value;
31
22
  }
32
23
  throw new JsonError_1.JsonError(raw.errors);
33
- }),
24
+ },
34
25
  };
35
26
  }
36
27
  exports.getSchemaUtils = getSchemaUtils;
@@ -49,6 +40,12 @@ function optional(schema) {
49
40
  return schema.parse(raw, opts);
50
41
  },
51
42
  json: (parsed, opts) => {
43
+ if ((opts === null || opts === void 0 ? void 0 : opts.omitUndefined) && parsed === undefined) {
44
+ return {
45
+ ok: true,
46
+ value: undefined,
47
+ };
48
+ }
52
49
  if (parsed == null) {
53
50
  return {
54
51
  ok: true,
@@ -64,8 +61,8 @@ function optional(schema) {
64
61
  exports.optional = optional;
65
62
  function transform(schema, transformer) {
66
63
  const baseSchema = {
67
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
68
- const parsed = yield schema.parse(raw, opts);
64
+ parse: (raw, opts) => {
65
+ const parsed = schema.parse(raw, opts);
69
66
  if (!parsed.ok) {
70
67
  return parsed;
71
68
  }
@@ -73,11 +70,11 @@ function transform(schema, transformer) {
73
70
  ok: true,
74
71
  value: transformer.transform(parsed.value),
75
72
  };
76
- }),
77
- json: (transformed, opts) => __awaiter(this, void 0, void 0, function* () {
78
- const parsed = yield transformer.untransform(transformed);
73
+ },
74
+ json: (transformed, opts) => {
75
+ const parsed = transformer.untransform(transformed);
79
76
  return schema.json(parsed, opts);
80
- }),
77
+ },
81
78
  getType: () => schema.getType(),
82
79
  };
83
80
  return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.set = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -18,8 +9,8 @@ const schema_utils_1 = require("../schema-utils");
18
9
  function set(schema) {
19
10
  const listSchema = (0, list_1.list)(schema);
20
11
  const baseSchema = {
21
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
22
- const parsedList = yield listSchema.parse(raw, opts);
12
+ parse: (raw, opts) => {
13
+ const parsedList = listSchema.parse(raw, opts);
23
14
  if (parsedList.ok) {
24
15
  return {
25
16
  ok: true,
@@ -29,8 +20,8 @@ function set(schema) {
29
20
  else {
30
21
  return parsedList;
31
22
  }
32
- }),
33
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
23
+ },
24
+ json: (parsed, opts) => {
34
25
  var _a;
35
26
  if (!(parsed instanceof Set)) {
36
27
  return {
@@ -43,9 +34,9 @@ function set(schema) {
43
34
  ],
44
35
  };
45
36
  }
46
- const jsonList = yield listSchema.json([...parsed], opts);
37
+ const jsonList = listSchema.json([...parsed], opts);
47
38
  return jsonList;
48
- }),
39
+ },
49
40
  getType: () => Schema_1.SchemaType.SET,
50
41
  };
51
42
  return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.undiscriminatedUnion = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -15,37 +6,35 @@ const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
15
6
  const schema_utils_1 = require("../schema-utils");
16
7
  function undiscriminatedUnion(schemas) {
17
8
  const baseSchema = {
18
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
9
+ parse: (raw, opts) => {
19
10
  return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
20
- }),
21
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
11
+ },
12
+ json: (parsed, opts) => {
22
13
  return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
23
- }),
14
+ },
24
15
  getType: () => Schema_1.SchemaType.UNDISCRIMINATED_UNION,
25
16
  };
26
17
  return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
27
18
  }
28
19
  exports.undiscriminatedUnion = undiscriminatedUnion;
29
20
  function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const errors = [];
32
- for (const [index, schema] of schemas.entries()) {
33
- const transformed = yield transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
34
- if (transformed.ok) {
35
- return transformed;
36
- }
37
- else {
38
- for (const error of transformed.errors) {
39
- errors.push({
40
- path: error.path,
41
- message: `[Variant ${index}] ${error.message}`,
42
- });
43
- }
21
+ const errors = [];
22
+ for (const [index, schema] of schemas.entries()) {
23
+ const transformed = transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
24
+ if (transformed.ok) {
25
+ return transformed;
26
+ }
27
+ else {
28
+ for (const error of transformed.errors) {
29
+ errors.push({
30
+ path: error.path,
31
+ message: `[Variant ${index}] ${error.message}`,
32
+ });
44
33
  }
45
34
  }
46
- return {
47
- ok: false,
48
- errors,
49
- };
50
- });
35
+ }
36
+ return {
37
+ ok: false,
38
+ errors,
39
+ };
51
40
  }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __rest = (this && this.__rest) || function (s, e) {
12
3
  var t = {};
13
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -36,7 +27,7 @@ function union(discriminant, union) {
36
27
  : discriminant.parsedDiscriminant;
37
28
  const discriminantValueSchema = (0, enum_1.enum_)((0, keys_1.keys)(union));
38
29
  const baseSchema = {
39
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
30
+ parse: (raw, opts) => {
40
31
  return transformAndValidateUnion({
41
32
  value: raw,
42
33
  discriminant: rawDiscriminant,
@@ -53,8 +44,8 @@ function union(discriminant, union) {
53
44
  transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts),
54
45
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
55
46
  });
56
- }),
57
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
47
+ },
48
+ json: (parsed, opts) => {
58
49
  return transformAndValidateUnion({
59
50
  value: parsed,
60
51
  discriminant: parsedDiscriminant,
@@ -71,71 +62,69 @@ function union(discriminant, union) {
71
62
  transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts),
72
63
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
73
64
  });
74
- }),
65
+ },
75
66
  getType: () => Schema_1.SchemaType.UNION,
76
67
  };
77
68
  return Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema));
78
69
  }
79
70
  exports.union = union;
80
71
  function transformAndValidateUnion({ value, discriminant, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnrecognizedUnionMembers = false, transformAdditionalProperties, breadcrumbsPrefix = [], }) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- if (!(0, isPlainObject_1.isPlainObject)(value)) {
72
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
73
+ return {
74
+ ok: false,
75
+ errors: [
76
+ {
77
+ path: breadcrumbsPrefix,
78
+ message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
79
+ },
80
+ ],
81
+ };
82
+ }
83
+ const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
84
+ if (discriminantValue == null) {
85
+ return {
86
+ ok: false,
87
+ errors: [
88
+ {
89
+ path: breadcrumbsPrefix,
90
+ message: `Missing discriminant ("${discriminant}")`,
91
+ },
92
+ ],
93
+ };
94
+ }
95
+ const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue);
96
+ if (!transformedDiscriminantValue.ok) {
97
+ return {
98
+ ok: false,
99
+ errors: transformedDiscriminantValue.errors,
100
+ };
101
+ }
102
+ const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
103
+ if (additionalPropertiesSchema == null) {
104
+ if (allowUnrecognizedUnionMembers) {
83
105
  return {
84
- ok: false,
85
- errors: [
86
- {
87
- path: breadcrumbsPrefix,
88
- message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
89
- },
90
- ],
106
+ ok: true,
107
+ value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
91
108
  };
92
109
  }
93
- const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
94
- if (discriminantValue == null) {
110
+ else {
95
111
  return {
96
112
  ok: false,
97
113
  errors: [
98
114
  {
99
- path: breadcrumbsPrefix,
100
- message: `Missing discriminant ("${discriminant}")`,
115
+ path: [...breadcrumbsPrefix, discriminant],
116
+ message: "Unexpected discriminant value",
101
117
  },
102
118
  ],
103
119
  };
104
120
  }
105
- const transformedDiscriminantValue = yield transformDiscriminantValue(discriminantValue);
106
- if (!transformedDiscriminantValue.ok) {
107
- return {
108
- ok: false,
109
- errors: transformedDiscriminantValue.errors,
110
- };
111
- }
112
- const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
113
- if (additionalPropertiesSchema == null) {
114
- if (allowUnrecognizedUnionMembers) {
115
- return {
116
- ok: true,
117
- value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
118
- };
119
- }
120
- else {
121
- return {
122
- ok: false,
123
- errors: [
124
- {
125
- path: [...breadcrumbsPrefix, discriminant],
126
- message: "Unexpected discriminant value",
127
- },
128
- ],
129
- };
130
- }
131
- }
132
- const transformedAdditionalProperties = yield transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
133
- if (!transformedAdditionalProperties.ok) {
134
- return transformedAdditionalProperties;
135
- }
136
- return {
137
- ok: true,
138
- value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
139
- };
140
- });
121
+ }
122
+ const transformedAdditionalProperties = transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
123
+ if (!transformedAdditionalProperties.ok) {
124
+ return transformedAdditionalProperties;
125
+ }
126
+ return {
127
+ ok: true,
128
+ value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
129
+ };
141
130
  }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.maybeSkipValidation = void 0;
13
4
  function maybeSkipValidation(schema) {
@@ -15,8 +6,8 @@ function maybeSkipValidation(schema) {
15
6
  }
16
7
  exports.maybeSkipValidation = maybeSkipValidation;
17
8
  function transformAndMaybeSkipValidation(transform) {
18
- return (value, opts) => __awaiter(this, void 0, void 0, function* () {
19
- const transformed = yield transform(value, opts);
9
+ return (value, opts) => {
10
+ const transformed = transform(value, opts);
20
11
  const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
21
12
  if (!transformed.ok && skipValidation) {
22
13
  // eslint-disable-next-line no-console
@@ -33,5 +24,5 @@ function transformAndMaybeSkipValidation(transform) {
33
24
  else {
34
25
  return transformed;
35
26
  }
36
- });
27
+ };
37
28
  }
package/dist/Client.d.ts CHANGED
@@ -9,8 +9,9 @@ import { Testrecord } from "./api/resources/testrecord/client/Client";
9
9
  import { Run } from "./api/resources/run/client/Client";
10
10
  import { Score } from "./api/resources/score/client/Client";
11
11
  import { RunMetric } from "./api/resources/runMetric/client/Client";
12
- import { Traces } from "./api/resources/traces/client/Client";
12
+ import { Tracing } from "./api/resources/tracing/client/Client";
13
13
  import { Prompt } from "./api/resources/prompt/client/Client";
14
+ import { ScoringConfig } from "./api/resources/scoringConfig/client/Client";
14
15
  export declare namespace ScorecardClient {
15
16
  interface Options {
16
17
  environment?: core.Supplier<environments.ScorecardEnvironment | string>;
@@ -18,8 +19,11 @@ export declare namespace ScorecardClient {
18
19
  fetcher?: core.FetchFunction;
19
20
  }
20
21
  interface RequestOptions {
22
+ /** The maximum time to wait for a response in seconds. */
21
23
  timeoutInSeconds?: number;
24
+ /** The number of times to retry the request. Defaults to 2. */
22
25
  maxRetries?: number;
26
+ /** A hook to abort the request. */
23
27
  abortSignal?: AbortSignal;
24
28
  }
25
29
  }
@@ -38,8 +42,10 @@ export declare class ScorecardClient {
38
42
  get score(): Score;
39
43
  protected _runMetric: RunMetric | undefined;
40
44
  get runMetric(): RunMetric;
41
- protected _traces: Traces | undefined;
42
- get traces(): Traces;
45
+ protected _tracing: Tracing | undefined;
46
+ get tracing(): Tracing;
43
47
  protected _prompt: Prompt | undefined;
44
48
  get prompt(): Prompt;
49
+ protected _scoringConfig: ScoringConfig | undefined;
50
+ get scoringConfig(): ScoringConfig;
45
51
  }
package/dist/Client.js CHANGED
@@ -10,8 +10,9 @@ const Client_3 = require("./api/resources/testrecord/client/Client");
10
10
  const Client_4 = require("./api/resources/run/client/Client");
11
11
  const Client_5 = require("./api/resources/score/client/Client");
12
12
  const Client_6 = require("./api/resources/runMetric/client/Client");
13
- const Client_7 = require("./api/resources/traces/client/Client");
13
+ const Client_7 = require("./api/resources/tracing/client/Client");
14
14
  const Client_8 = require("./api/resources/prompt/client/Client");
15
+ const Client_9 = require("./api/resources/scoringConfig/client/Client");
15
16
  class ScorecardClient {
16
17
  constructor(_options) {
17
18
  this._options = _options;
@@ -40,13 +41,17 @@ class ScorecardClient {
40
41
  var _a;
41
42
  return ((_a = this._runMetric) !== null && _a !== void 0 ? _a : (this._runMetric = new Client_6.RunMetric(this._options)));
42
43
  }
43
- get traces() {
44
+ get tracing() {
44
45
  var _a;
45
- return ((_a = this._traces) !== null && _a !== void 0 ? _a : (this._traces = new Client_7.Traces(this._options)));
46
+ return ((_a = this._tracing) !== null && _a !== void 0 ? _a : (this._tracing = new Client_7.Tracing(this._options)));
46
47
  }
47
48
  get prompt() {
48
49
  var _a;
49
50
  return ((_a = this._prompt) !== null && _a !== void 0 ? _a : (this._prompt = new Client_8.Prompt(this._options)));
50
51
  }
52
+ get scoringConfig() {
53
+ var _a;
54
+ return ((_a = this._scoringConfig) !== null && _a !== void 0 ? _a : (this._scoringConfig = new Client_9.ScoringConfig(this._options)));
55
+ }
51
56
  }
52
57
  exports.ScorecardClient = ScorecardClient;
@@ -8,10 +8,12 @@ export * as testset from "./testset";
8
8
  export * as run from "./run";
9
9
  export * as score from "./score";
10
10
  export * as runMetric from "./runMetric";
11
- export * as traces from "./traces";
11
+ export * as tracing from "./tracing";
12
+ export * as scoringConfig from "./scoringConfig";
12
13
  export * from "./testset/client/requests";
13
14
  export * from "./testcase/client/requests";
14
15
  export * from "./testrecord/client/requests";
15
16
  export * from "./run/client/requests";
16
17
  export * from "./score/client/requests";
17
18
  export * from "./prompt/client/requests";
19
+ export * from "./scoringConfig/client/requests";
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.traces = exports.runMetric = exports.score = exports.run = exports.testset = exports.prompt = exports.testrecord = exports.testcase = void 0;
29
+ exports.scoringConfig = exports.tracing = exports.runMetric = exports.score = exports.run = exports.testset = exports.prompt = exports.testrecord = exports.testcase = void 0;
30
30
  exports.testcase = __importStar(require("./testcase"));
31
31
  __exportStar(require("./testcase/types"), exports);
32
32
  exports.testrecord = __importStar(require("./testrecord"));
@@ -37,10 +37,12 @@ exports.testset = __importStar(require("./testset"));
37
37
  exports.run = __importStar(require("./run"));
38
38
  exports.score = __importStar(require("./score"));
39
39
  exports.runMetric = __importStar(require("./runMetric"));
40
- exports.traces = __importStar(require("./traces"));
40
+ exports.tracing = __importStar(require("./tracing"));
41
+ exports.scoringConfig = __importStar(require("./scoringConfig"));
41
42
  __exportStar(require("./testset/client/requests"), exports);
42
43
  __exportStar(require("./testcase/client/requests"), exports);
43
44
  __exportStar(require("./testrecord/client/requests"), exports);
44
45
  __exportStar(require("./run/client/requests"), exports);
45
46
  __exportStar(require("./score/client/requests"), exports);
46
47
  __exportStar(require("./prompt/client/requests"), exports);
48
+ __exportStar(require("./scoringConfig/client/requests"), exports);