vellum-ai 0.0.9 → 0.0.11

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 (227) hide show
  1. package/Client.d.ts +39 -0
  2. package/Client.js +107 -12
  3. package/api/client/requests/index.d.ts +0 -1
  4. package/api/errors/BadRequestError.d.ts +7 -0
  5. package/api/errors/BadRequestError.js +41 -0
  6. package/api/errors/InternalServerError.d.ts +7 -0
  7. package/api/errors/InternalServerError.js +41 -0
  8. package/api/errors/NotFoundError.d.ts +7 -0
  9. package/api/errors/NotFoundError.js +41 -0
  10. package/api/errors/index.d.ts +3 -0
  11. package/api/errors/index.js +19 -0
  12. package/api/index.d.ts +1 -0
  13. package/api/index.js +1 -0
  14. package/api/resources/documents/client/Client.d.ts +17 -0
  15. package/api/resources/documents/client/Client.js +31 -4
  16. package/api/resources/documents/client/requests/DocumentsListRequest.d.ts +12 -0
  17. package/api/resources/index.d.ts +2 -0
  18. package/api/resources/index.js +3 -1
  19. package/api/resources/modelVersions/client/Client.d.ts +7 -0
  20. package/api/resources/modelVersions/client/Client.js +7 -0
  21. package/api/resources/sandboxes/client/Client.d.ts +11 -0
  22. package/api/resources/sandboxes/client/Client.js +11 -0
  23. package/api/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +1 -1
  24. package/api/resources/testSuites/client/Client.d.ts +28 -0
  25. package/api/resources/testSuites/client/Client.js +92 -0
  26. package/api/resources/testSuites/client/index.d.ts +1 -0
  27. package/api/resources/testSuites/client/index.js +17 -0
  28. package/api/resources/testSuites/client/requests/TestSuiteTestCaseRequest.d.ts +14 -0
  29. package/api/resources/testSuites/client/requests/index.d.ts +1 -0
  30. package/api/resources/testSuites/client/requests/index.js +2 -0
  31. package/api/resources/testSuites/index.d.ts +1 -0
  32. package/api/resources/testSuites/index.js +17 -0
  33. package/api/types/EvaluationParams.d.ts +7 -0
  34. package/api/types/EvaluationParamsRequest.d.ts +7 -0
  35. package/api/{client/requests → types}/GenerateBodyRequest.d.ts +1 -1
  36. package/api/types/GenerateStreamResponse.d.ts +7 -0
  37. package/api/types/GenerateStreamResult.d.ts +9 -0
  38. package/api/types/GenerateStreamResultData.d.ts +8 -0
  39. package/api/types/GenerateStreamResultData.js +5 -0
  40. package/api/types/ProcessingFailureReasonEnum.d.ts +7 -0
  41. package/api/types/ProcessingFailureReasonEnum.js +9 -0
  42. package/api/types/SandboxMetricInputParams.d.ts +2 -1
  43. package/api/types/SandboxMetricInputParamsRequest.d.ts +2 -1
  44. package/api/types/SandboxScenario.d.ts +1 -1
  45. package/{dist/api/types/SandboxInput.d.ts → api/types/ScenarioInput.d.ts} +1 -1
  46. package/api/types/ScenarioInput.js +5 -0
  47. package/api/types/{SandboxInputRequest.d.ts → ScenarioInputRequest.d.ts} +1 -1
  48. package/api/types/ScenarioInputRequest.js +5 -0
  49. package/api/types/SlimDocument.d.ts +3 -1
  50. package/api/types/TestSuiteTestCase.d.ts +14 -0
  51. package/api/types/TestSuiteTestCase.js +5 -0
  52. package/api/types/index.d.ts +10 -2
  53. package/api/types/index.js +10 -2
  54. package/core/callback-queue/CallbackQueue.d.ts +6 -0
  55. package/core/callback-queue/CallbackQueue.js +20 -0
  56. package/core/callback-queue/index.d.ts +1 -0
  57. package/core/callback-queue/index.js +5 -0
  58. package/core/index.d.ts +2 -0
  59. package/core/index.js +2 -0
  60. package/core/streaming-fetcher/StreamingFetcher.d.ts +22 -0
  61. package/core/streaming-fetcher/StreamingFetcher.js +64 -0
  62. package/core/streaming-fetcher/index.d.ts +1 -0
  63. package/core/streaming-fetcher/index.js +5 -0
  64. package/dist/Client.d.ts +39 -0
  65. package/dist/Client.js +107 -12
  66. package/dist/api/client/requests/index.d.ts +0 -1
  67. package/dist/api/errors/BadRequestError.d.ts +7 -0
  68. package/dist/api/errors/BadRequestError.js +41 -0
  69. package/dist/api/errors/InternalServerError.d.ts +7 -0
  70. package/dist/api/errors/InternalServerError.js +41 -0
  71. package/dist/api/errors/NotFoundError.d.ts +7 -0
  72. package/dist/api/errors/NotFoundError.js +41 -0
  73. package/dist/api/errors/index.d.ts +3 -0
  74. package/dist/api/errors/index.js +19 -0
  75. package/dist/api/index.d.ts +1 -0
  76. package/dist/api/index.js +1 -0
  77. package/dist/api/resources/documents/client/Client.d.ts +17 -0
  78. package/dist/api/resources/documents/client/Client.js +31 -4
  79. package/dist/api/resources/documents/client/requests/DocumentsListRequest.d.ts +12 -0
  80. package/dist/api/resources/index.d.ts +2 -0
  81. package/dist/api/resources/index.js +3 -1
  82. package/dist/api/resources/modelVersions/client/Client.d.ts +7 -0
  83. package/dist/api/resources/modelVersions/client/Client.js +7 -0
  84. package/dist/api/resources/sandboxes/client/Client.d.ts +11 -0
  85. package/dist/api/resources/sandboxes/client/Client.js +11 -0
  86. package/dist/api/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +1 -1
  87. package/dist/api/resources/testSuites/client/Client.d.ts +28 -0
  88. package/dist/api/resources/testSuites/client/Client.js +92 -0
  89. package/dist/api/resources/testSuites/client/index.d.ts +1 -0
  90. package/dist/api/resources/testSuites/client/index.js +17 -0
  91. package/dist/api/resources/testSuites/client/requests/TestSuiteTestCaseRequest.d.ts +14 -0
  92. package/dist/api/resources/testSuites/client/requests/TestSuiteTestCaseRequest.js +5 -0
  93. package/dist/api/resources/testSuites/client/requests/index.d.ts +1 -0
  94. package/dist/api/resources/testSuites/client/requests/index.js +2 -0
  95. package/dist/api/resources/testSuites/index.d.ts +1 -0
  96. package/dist/api/resources/testSuites/index.js +17 -0
  97. package/dist/api/types/EvaluationParams.d.ts +7 -0
  98. package/dist/api/types/EvaluationParams.js +5 -0
  99. package/dist/api/types/EvaluationParamsRequest.d.ts +7 -0
  100. package/dist/api/types/EvaluationParamsRequest.js +5 -0
  101. package/dist/api/{client/requests → types}/GenerateBodyRequest.d.ts +1 -1
  102. package/dist/api/types/GenerateBodyRequest.js +5 -0
  103. package/dist/api/types/GenerateStreamResponse.d.ts +7 -0
  104. package/dist/api/types/GenerateStreamResponse.js +5 -0
  105. package/dist/api/types/GenerateStreamResult.d.ts +9 -0
  106. package/dist/api/types/GenerateStreamResult.js +5 -0
  107. package/dist/api/types/GenerateStreamResultData.d.ts +8 -0
  108. package/dist/api/types/GenerateStreamResultData.js +5 -0
  109. package/dist/api/types/ProcessingFailureReasonEnum.d.ts +7 -0
  110. package/dist/api/types/ProcessingFailureReasonEnum.js +9 -0
  111. package/dist/api/types/SandboxMetricInputParams.d.ts +2 -1
  112. package/dist/api/types/SandboxMetricInputParamsRequest.d.ts +2 -1
  113. package/dist/api/types/SandboxScenario.d.ts +1 -1
  114. package/{api/types/SandboxInput.d.ts → dist/api/types/ScenarioInput.d.ts} +1 -1
  115. package/dist/api/types/ScenarioInput.js +5 -0
  116. package/dist/api/types/{SandboxInputRequest.d.ts → ScenarioInputRequest.d.ts} +1 -1
  117. package/dist/api/types/ScenarioInputRequest.js +5 -0
  118. package/dist/api/types/SlimDocument.d.ts +3 -1
  119. package/dist/api/types/TestSuiteTestCase.d.ts +14 -0
  120. package/dist/api/types/TestSuiteTestCase.js +5 -0
  121. package/dist/api/types/index.d.ts +10 -2
  122. package/dist/api/types/index.js +10 -2
  123. package/dist/core/callback-queue/CallbackQueue.d.ts +6 -0
  124. package/dist/core/callback-queue/CallbackQueue.js +20 -0
  125. package/dist/core/callback-queue/index.d.ts +1 -0
  126. package/dist/core/callback-queue/index.js +5 -0
  127. package/dist/core/index.d.ts +2 -0
  128. package/dist/core/index.js +2 -0
  129. package/dist/core/streaming-fetcher/StreamingFetcher.d.ts +22 -0
  130. package/dist/core/streaming-fetcher/StreamingFetcher.js +64 -0
  131. package/dist/core/streaming-fetcher/index.d.ts +1 -0
  132. package/dist/core/streaming-fetcher/index.js +5 -0
  133. package/dist/serialization/client/requests/index.d.ts +0 -1
  134. package/dist/serialization/client/requests/index.js +1 -3
  135. package/dist/serialization/resources/index.d.ts +2 -0
  136. package/dist/serialization/resources/index.js +3 -1
  137. package/dist/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +1 -1
  138. package/dist/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.js +1 -1
  139. package/dist/serialization/resources/testSuites/client/index.d.ts +1 -0
  140. package/dist/serialization/resources/testSuites/client/index.js +17 -0
  141. package/dist/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.d.ts +15 -0
  142. package/dist/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.js +36 -0
  143. package/dist/serialization/resources/testSuites/client/requests/index.d.ts +1 -0
  144. package/dist/serialization/resources/testSuites/client/requests/index.js +5 -0
  145. package/dist/serialization/resources/testSuites/index.d.ts +1 -0
  146. package/dist/serialization/resources/testSuites/index.js +17 -0
  147. package/dist/serialization/types/EvaluationParams.d.ts +12 -0
  148. package/dist/serialization/types/EvaluationParams.js +33 -0
  149. package/dist/serialization/types/EvaluationParamsRequest.d.ts +12 -0
  150. package/dist/serialization/types/EvaluationParamsRequest.js +33 -0
  151. package/{serialization/client/requests → dist/serialization/types}/GenerateBodyRequest.d.ts +4 -4
  152. package/{serialization/client/requests → dist/serialization/types}/GenerateBodyRequest.js +3 -3
  153. package/dist/serialization/types/GenerateStreamResponse.d.ts +12 -0
  154. package/dist/serialization/types/GenerateStreamResponse.js +33 -0
  155. package/dist/serialization/types/GenerateStreamResult.d.ts +14 -0
  156. package/dist/serialization/types/GenerateStreamResult.js +35 -0
  157. package/dist/serialization/types/GenerateStreamResultData.d.ts +13 -0
  158. package/dist/serialization/types/GenerateStreamResultData.js +34 -0
  159. package/dist/serialization/types/ProcessingFailureReasonEnum.d.ts +10 -0
  160. package/dist/serialization/types/ProcessingFailureReasonEnum.js +31 -0
  161. package/dist/serialization/types/SandboxMetricInputParams.d.ts +1 -1
  162. package/dist/serialization/types/SandboxMetricInputParams.js +1 -1
  163. package/dist/serialization/types/SandboxMetricInputParamsRequest.d.ts +1 -1
  164. package/dist/serialization/types/SandboxMetricInputParamsRequest.js +1 -1
  165. package/dist/serialization/types/SandboxScenario.d.ts +1 -1
  166. package/dist/serialization/types/SandboxScenario.js +1 -1
  167. package/{serialization/types/SandboxInput.d.ts → dist/serialization/types/ScenarioInput.d.ts} +2 -2
  168. package/{serialization/types/SandboxInput.js → dist/serialization/types/ScenarioInput.js} +2 -2
  169. package/dist/serialization/types/{SandboxInputRequest.d.ts → ScenarioInputRequest.d.ts} +2 -2
  170. package/dist/serialization/types/{SandboxInputRequest.js → ScenarioInputRequest.js} +2 -2
  171. package/dist/serialization/types/SlimDocument.d.ts +1 -0
  172. package/dist/serialization/types/SlimDocument.js +1 -0
  173. package/dist/serialization/types/TestSuiteTestCase.d.ts +15 -0
  174. package/dist/serialization/types/TestSuiteTestCase.js +36 -0
  175. package/dist/serialization/types/index.d.ts +10 -2
  176. package/dist/serialization/types/index.js +10 -2
  177. package/package.json +1 -1
  178. package/serialization/client/requests/index.d.ts +0 -1
  179. package/serialization/client/requests/index.js +1 -3
  180. package/serialization/resources/index.d.ts +2 -0
  181. package/serialization/resources/index.js +3 -1
  182. package/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +1 -1
  183. package/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.js +1 -1
  184. package/serialization/resources/testSuites/client/index.d.ts +1 -0
  185. package/serialization/resources/testSuites/client/index.js +17 -0
  186. package/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.d.ts +15 -0
  187. package/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.js +36 -0
  188. package/serialization/resources/testSuites/client/requests/index.d.ts +1 -0
  189. package/serialization/resources/testSuites/client/requests/index.js +5 -0
  190. package/serialization/resources/testSuites/index.d.ts +1 -0
  191. package/serialization/resources/testSuites/index.js +17 -0
  192. package/serialization/types/EvaluationParams.d.ts +12 -0
  193. package/serialization/types/EvaluationParams.js +33 -0
  194. package/serialization/types/EvaluationParamsRequest.d.ts +12 -0
  195. package/serialization/types/EvaluationParamsRequest.js +33 -0
  196. package/{dist/serialization/client/requests → serialization/types}/GenerateBodyRequest.d.ts +4 -4
  197. package/{dist/serialization/client/requests → serialization/types}/GenerateBodyRequest.js +3 -3
  198. package/serialization/types/GenerateStreamResponse.d.ts +12 -0
  199. package/serialization/types/GenerateStreamResponse.js +33 -0
  200. package/serialization/types/GenerateStreamResult.d.ts +14 -0
  201. package/serialization/types/GenerateStreamResult.js +35 -0
  202. package/serialization/types/GenerateStreamResultData.d.ts +13 -0
  203. package/serialization/types/GenerateStreamResultData.js +34 -0
  204. package/serialization/types/ProcessingFailureReasonEnum.d.ts +10 -0
  205. package/serialization/types/ProcessingFailureReasonEnum.js +31 -0
  206. package/serialization/types/SandboxMetricInputParams.d.ts +1 -1
  207. package/serialization/types/SandboxMetricInputParams.js +1 -1
  208. package/serialization/types/SandboxMetricInputParamsRequest.d.ts +1 -1
  209. package/serialization/types/SandboxMetricInputParamsRequest.js +1 -1
  210. package/serialization/types/SandboxScenario.d.ts +1 -1
  211. package/serialization/types/SandboxScenario.js +1 -1
  212. package/{dist/serialization/types/SandboxInput.d.ts → serialization/types/ScenarioInput.d.ts} +2 -2
  213. package/{dist/serialization/types/SandboxInput.js → serialization/types/ScenarioInput.js} +2 -2
  214. package/serialization/types/{SandboxInputRequest.d.ts → ScenarioInputRequest.d.ts} +2 -2
  215. package/serialization/types/{SandboxInputRequest.js → ScenarioInputRequest.js} +2 -2
  216. package/serialization/types/SlimDocument.d.ts +1 -0
  217. package/serialization/types/SlimDocument.js +1 -0
  218. package/serialization/types/TestSuiteTestCase.d.ts +15 -0
  219. package/serialization/types/TestSuiteTestCase.js +36 -0
  220. package/serialization/types/index.d.ts +10 -2
  221. package/serialization/types/index.js +10 -2
  222. /package/api/{client/requests/GenerateBodyRequest.js → resources/testSuites/client/requests/TestSuiteTestCaseRequest.js} +0 -0
  223. /package/api/types/{SandboxInput.js → EvaluationParams.js} +0 -0
  224. /package/api/types/{SandboxInputRequest.js → EvaluationParamsRequest.js} +0 -0
  225. /package/{dist/api/client/requests → api/types}/GenerateBodyRequest.js +0 -0
  226. /package/{dist/api/types/SandboxInput.js → api/types/GenerateStreamResponse.js} +0 -0
  227. /package/{dist/api/types/SandboxInputRequest.js → api/types/GenerateStreamResult.js} +0 -0
package/Client.d.ts CHANGED
@@ -7,6 +7,7 @@ import * as Vellum from "./api";
7
7
  import { Documents } from "./api/resources/documents/client/Client";
8
8
  import { ModelVersions } from "./api/resources/modelVersions/client/Client";
9
9
  import { Sandboxes } from "./api/resources/sandboxes/client/Client";
10
+ import { TestSuites } from "./api/resources/testSuites/client/Client";
10
11
  export declare namespace VellumClient {
11
12
  interface Options {
12
13
  environment?: environments.VellumEnvironment | environments.VellumEnvironmentUrls;
@@ -16,8 +17,44 @@ export declare namespace VellumClient {
16
17
  export declare class VellumClient {
17
18
  protected readonly options: VellumClient.Options;
18
19
  constructor(options: VellumClient.Options);
20
+ /**
21
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
22
+ *
23
+ * Generate a completion using a previously defined deployment.
24
+ *
25
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
26
+ * @throws {Vellum.BadRequestError}
27
+ * @throws {Vellum.NotFoundError}
28
+ * @throws {Vellum.InternalServerError}
29
+ */
19
30
  generate(request: Vellum.GenerateBodyRequest): Promise<Vellum.GenerateResponse>;
31
+ /**
32
+ * @throws {Vellum.BadRequestError}
33
+ * @throws {Vellum.NotFoundError}
34
+ * @throws {Vellum.InternalServerError}
35
+ */
36
+ generateStream(request: Vellum.GenerateBodyRequest, cb: (data: Vellum.GenerateStreamResponse) => void, opts?: Pick<core.StreamingFetcher.Args, "onError" | "onFinish" | "abortController" | "timeoutMs">): Promise<void>;
37
+ /**
38
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
39
+ *
40
+ * Perform a search against a document index.
41
+ *
42
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
43
+ * @throws {Vellum.BadRequestError}
44
+ * @throws {Vellum.NotFoundError}
45
+ * @throws {Vellum.InternalServerError}
46
+ */
20
47
  search(request: Vellum.SearchRequestBodyRequest): Promise<Vellum.SearchResponse>;
48
+ /**
49
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
50
+ *
51
+ * Used to submit feedback regarding the quality of previously generated completions.
52
+ *
53
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
54
+ * @throws {Vellum.BadRequestError}
55
+ * @throws {Vellum.NotFoundError}
56
+ * @throws {Vellum.InternalServerError}
57
+ */
21
58
  submitCompletionActuals(request: Vellum.SubmitCompletionActualsRequest): Promise<void>;
22
59
  protected _documents: Documents | undefined;
23
60
  get documents(): Documents;
@@ -25,4 +62,6 @@ export declare class VellumClient {
25
62
  get modelVersions(): ModelVersions;
26
63
  protected _sandboxes: Sandboxes | undefined;
27
64
  get sandboxes(): Sandboxes;
65
+ protected _testSuites: TestSuites | undefined;
66
+ get testSuites(): TestSuites;
28
67
  }
package/Client.js CHANGED
@@ -32,17 +32,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.VellumClient = void 0;
33
33
  const environments = __importStar(require("./environments"));
34
34
  const core = __importStar(require("./core"));
35
+ const Vellum = __importStar(require("./api"));
35
36
  const url_join_1 = __importDefault(require("url-join"));
36
37
  const serializers = __importStar(require("./serialization"));
37
38
  const errors = __importStar(require("./errors"));
38
39
  const Client_1 = require("./api/resources/documents/client/Client");
39
40
  const Client_2 = require("./api/resources/modelVersions/client/Client");
40
41
  const Client_3 = require("./api/resources/sandboxes/client/Client");
42
+ const Client_4 = require("./api/resources/testSuites/client/Client");
41
43
  class VellumClient {
42
44
  options;
43
45
  constructor(options) {
44
46
  this.options = options;
45
47
  }
48
+ /**
49
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
50
+ *
51
+ * Generate a completion using a previously defined deployment.
52
+ *
53
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
54
+ * @throws {Vellum.BadRequestError}
55
+ * @throws {Vellum.NotFoundError}
56
+ * @throws {Vellum.InternalServerError}
57
+ */
46
58
  async generate(request) {
47
59
  const _response = await core.fetcher({
48
60
  url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/generate"),
@@ -61,10 +73,19 @@ class VellumClient {
61
73
  });
62
74
  }
63
75
  if (_response.error.reason === "status-code") {
64
- throw new errors.VellumError({
65
- statusCode: _response.error.statusCode,
66
- body: _response.error.body,
67
- });
76
+ switch (_response.error.statusCode) {
77
+ case 400:
78
+ throw new Vellum.BadRequestError(_response.error.body);
79
+ case 404:
80
+ throw new Vellum.NotFoundError(_response.error.body);
81
+ case 500:
82
+ throw new Vellum.InternalServerError(_response.error.body);
83
+ default:
84
+ throw new errors.VellumError({
85
+ statusCode: _response.error.statusCode,
86
+ body: _response.error.body,
87
+ });
88
+ }
68
89
  }
69
90
  switch (_response.error.reason) {
70
91
  case "non-json":
@@ -80,6 +101,48 @@ class VellumClient {
80
101
  });
81
102
  }
82
103
  }
104
+ /**
105
+ * @throws {Vellum.BadRequestError}
106
+ * @throws {Vellum.NotFoundError}
107
+ * @throws {Vellum.InternalServerError}
108
+ */
109
+ async generateStream(request, cb, opts) {
110
+ const _queue = new core.CallbackQueue();
111
+ await core.streamingFetcher({
112
+ url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, "v1/generate-stream"),
113
+ method: "POST",
114
+ headers: {
115
+ X_API_KEY: await core.Supplier.get(this.options.apiKey),
116
+ },
117
+ body: await serializers.GenerateBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
118
+ onData: _queue.wrap(async (data) => {
119
+ const parsed = await serializers.GenerateStreamResponse.parse(data, {
120
+ unrecognizedObjectKeys: "passthrough",
121
+ allowUnrecognizedUnionMembers: true,
122
+ allowUnrecognizedEnumValues: true,
123
+ });
124
+ if (parsed.ok) {
125
+ cb(parsed.value);
126
+ }
127
+ else {
128
+ opts?.onError?.(parsed.errors);
129
+ }
130
+ }),
131
+ onError: opts?.onError != null ? _queue.wrap(opts.onError) : undefined,
132
+ onFinish: opts?.onFinish != null ? _queue.wrap(opts.onFinish) : undefined,
133
+ abortController: opts?.abortController,
134
+ });
135
+ }
136
+ /**
137
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
138
+ *
139
+ * Perform a search against a document index.
140
+ *
141
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
142
+ * @throws {Vellum.BadRequestError}
143
+ * @throws {Vellum.NotFoundError}
144
+ * @throws {Vellum.InternalServerError}
145
+ */
83
146
  async search(request) {
84
147
  const _response = await core.fetcher({
85
148
  url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/search"),
@@ -98,10 +161,19 @@ class VellumClient {
98
161
  });
99
162
  }
100
163
  if (_response.error.reason === "status-code") {
101
- throw new errors.VellumError({
102
- statusCode: _response.error.statusCode,
103
- body: _response.error.body,
104
- });
164
+ switch (_response.error.statusCode) {
165
+ case 400:
166
+ throw new Vellum.BadRequestError(_response.error.body);
167
+ case 404:
168
+ throw new Vellum.NotFoundError(_response.error.body);
169
+ case 500:
170
+ throw new Vellum.InternalServerError(_response.error.body);
171
+ default:
172
+ throw new errors.VellumError({
173
+ statusCode: _response.error.statusCode,
174
+ body: _response.error.body,
175
+ });
176
+ }
105
177
  }
106
178
  switch (_response.error.reason) {
107
179
  case "non-json":
@@ -117,6 +189,16 @@ class VellumClient {
117
189
  });
118
190
  }
119
191
  }
192
+ /**
193
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
194
+ *
195
+ * Used to submit feedback regarding the quality of previously generated completions.
196
+ *
197
+ * **Note:** Uses a base url of `https://predict.vellum.ai`.
198
+ * @throws {Vellum.BadRequestError}
199
+ * @throws {Vellum.NotFoundError}
200
+ * @throws {Vellum.InternalServerError}
201
+ */
120
202
  async submitCompletionActuals(request) {
121
203
  const _response = await core.fetcher({
122
204
  url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/submit-completion-actuals"),
@@ -133,10 +215,19 @@ class VellumClient {
133
215
  return;
134
216
  }
135
217
  if (_response.error.reason === "status-code") {
136
- throw new errors.VellumError({
137
- statusCode: _response.error.statusCode,
138
- body: _response.error.body,
139
- });
218
+ switch (_response.error.statusCode) {
219
+ case 400:
220
+ throw new Vellum.BadRequestError(_response.error.body);
221
+ case 404:
222
+ throw new Vellum.NotFoundError(_response.error.body);
223
+ case 500:
224
+ throw new Vellum.InternalServerError(_response.error.body);
225
+ default:
226
+ throw new errors.VellumError({
227
+ statusCode: _response.error.statusCode,
228
+ body: _response.error.body,
229
+ });
230
+ }
140
231
  }
141
232
  switch (_response.error.reason) {
142
233
  case "non-json":
@@ -164,5 +255,9 @@ class VellumClient {
164
255
  get sandboxes() {
165
256
  return (this._sandboxes ??= new Client_3.Sandboxes(this.options));
166
257
  }
258
+ _testSuites;
259
+ get testSuites() {
260
+ return (this._testSuites ??= new Client_4.TestSuites(this.options));
261
+ }
167
262
  }
168
263
  exports.VellumClient = VellumClient;
@@ -1,3 +1,2 @@
1
- export { GenerateBodyRequest } from "./GenerateBodyRequest";
2
1
  export { SearchRequestBodyRequest } from "./SearchRequestBodyRequest";
3
2
  export { SubmitCompletionActualsRequest } from "./SubmitCompletionActualsRequest";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors";
5
+ export declare class BadRequestError extends errors.VellumError {
6
+ constructor(body?: unknown);
7
+ }
@@ -0,0 +1,41 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.BadRequestError = void 0;
30
+ const errors = __importStar(require("../../errors"));
31
+ class BadRequestError extends errors.VellumError {
32
+ constructor(body) {
33
+ super({
34
+ message: "BadRequestError",
35
+ statusCode: 400,
36
+ body: body,
37
+ });
38
+ Object.setPrototypeOf(this, BadRequestError.prototype);
39
+ }
40
+ }
41
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors";
5
+ export declare class InternalServerError extends errors.VellumError {
6
+ constructor(body?: unknown);
7
+ }
@@ -0,0 +1,41 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.InternalServerError = void 0;
30
+ const errors = __importStar(require("../../errors"));
31
+ class InternalServerError extends errors.VellumError {
32
+ constructor(body) {
33
+ super({
34
+ message: "InternalServerError",
35
+ statusCode: 500,
36
+ body: body,
37
+ });
38
+ Object.setPrototypeOf(this, InternalServerError.prototype);
39
+ }
40
+ }
41
+ exports.InternalServerError = InternalServerError;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors";
5
+ export declare class NotFoundError extends errors.VellumError {
6
+ constructor(body?: unknown);
7
+ }
@@ -0,0 +1,41 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.NotFoundError = void 0;
30
+ const errors = __importStar(require("../../errors"));
31
+ class NotFoundError extends errors.VellumError {
32
+ constructor(body) {
33
+ super({
34
+ message: "NotFoundError",
35
+ statusCode: 404,
36
+ body: body,
37
+ });
38
+ Object.setPrototypeOf(this, NotFoundError.prototype);
39
+ }
40
+ }
41
+ exports.NotFoundError = NotFoundError;
@@ -0,0 +1,3 @@
1
+ export * from "./BadRequestError";
2
+ export * from "./NotFoundError";
3
+ export * from "./InternalServerError";
@@ -0,0 +1,19 @@
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("./BadRequestError"), exports);
18
+ __exportStar(require("./NotFoundError"), exports);
19
+ __exportStar(require("./InternalServerError"), exports);
package/api/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./types";
2
+ export * from "./errors";
2
3
  export * from "./resources";
3
4
  export * from "./client";
package/api/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types"), exports);
18
+ __exportStar(require("./errors"), exports);
18
19
  __exportStar(require("./resources"), exports);
19
20
  __exportStar(require("./client"), exports);
@@ -15,6 +15,23 @@ export declare namespace Documents {
15
15
  export declare class Documents {
16
16
  protected readonly options: Documents.Options;
17
17
  constructor(options: Documents.Options);
18
+ /**
19
+ *
20
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
21
+ *
22
+ * Used to list documents. Optionally filter on supported fields.
23
+ *
24
+ */
18
25
  list(request?: Vellum.DocumentsListRequest): Promise<Vellum.PaginatedSlimDocumentList>;
26
+ /**
27
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
28
+ *
29
+ * Upload a document to be indexed and used for search.
30
+ *
31
+ * **Note:** Uses a base url of `https://documents.vellum.ai`.
32
+ * @throws {Vellum.BadRequestError}
33
+ * @throws {Vellum.NotFoundError}
34
+ * @throws {Vellum.InternalServerError}
35
+ */
19
36
  upload(contents: File | fs.ReadStream, request: Vellum.UploadDocumentBodyRequest): Promise<Vellum.UploadDocumentResponse>;
20
37
  }
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.Documents = void 0;
33
33
  const environments = __importStar(require("../../../../environments"));
34
34
  const core = __importStar(require("../../../../core"));
35
+ const Vellum = __importStar(require("../../.."));
35
36
  const url_search_params_1 = __importDefault(require("@ungap/url-search-params"));
36
37
  const url_join_1 = __importDefault(require("url-join"));
37
38
  const serializers = __importStar(require("../../../../serialization"));
@@ -42,6 +43,13 @@ class Documents {
42
43
  constructor(options) {
43
44
  this.options = options;
44
45
  }
46
+ /**
47
+ *
48
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
49
+ *
50
+ * Used to list documents. Optionally filter on supported fields.
51
+ *
52
+ */
45
53
  async list(request = {}) {
46
54
  const { documentIndexId, limit, offset, ordering } = request;
47
55
  const _queryParams = new url_search_params_1.default();
@@ -93,6 +101,16 @@ class Documents {
93
101
  });
94
102
  }
95
103
  }
104
+ /**
105
+ * <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
106
+ *
107
+ * Upload a document to be indexed and used for search.
108
+ *
109
+ * **Note:** Uses a base url of `https://documents.vellum.ai`.
110
+ * @throws {Vellum.BadRequestError}
111
+ * @throws {Vellum.NotFoundError}
112
+ * @throws {Vellum.InternalServerError}
113
+ */
96
114
  async upload(contents, request) {
97
115
  const _request = new form_data_1.default();
98
116
  if (request.addToIndexNames != null) {
@@ -128,10 +146,19 @@ class Documents {
128
146
  });
129
147
  }
130
148
  if (_response.error.reason === "status-code") {
131
- throw new errors.VellumError({
132
- statusCode: _response.error.statusCode,
133
- body: _response.error.body,
134
- });
149
+ switch (_response.error.statusCode) {
150
+ case 400:
151
+ throw new Vellum.BadRequestError(_response.error.body);
152
+ case 404:
153
+ throw new Vellum.NotFoundError(_response.error.body);
154
+ case 500:
155
+ throw new Vellum.InternalServerError(_response.error.body);
156
+ default:
157
+ throw new errors.VellumError({
158
+ statusCode: _response.error.statusCode,
159
+ body: _response.error.body,
160
+ });
161
+ }
135
162
  }
136
163
  switch (_response.error.reason) {
137
164
  case "non-json":
@@ -2,8 +2,20 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface DocumentsListRequest {
5
+ /**
6
+ * Filter down to only those documents that are included in the specified index. You may provide either the Vellum-generated ID or the unique name of the index specified upon initial creation.
7
+ */
5
8
  documentIndexId?: string;
9
+ /**
10
+ * Number of results to return per page.
11
+ */
6
12
  limit?: number;
13
+ /**
14
+ * The initial index from which to return the results.
15
+ */
7
16
  offset?: number;
17
+ /**
18
+ * Which field to use when ordering the results.
19
+ */
8
20
  ordering?: string;
9
21
  }
@@ -1,5 +1,7 @@
1
1
  export * as documents from "./documents";
2
2
  export * as modelVersions from "./modelVersions";
3
3
  export * as sandboxes from "./sandboxes";
4
+ export * as testSuites from "./testSuites";
4
5
  export * from "./documents/client/requests";
5
6
  export * from "./sandboxes/client/requests";
7
+ export * from "./testSuites/client/requests";
@@ -26,9 +26,11 @@ 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.sandboxes = exports.modelVersions = exports.documents = void 0;
29
+ exports.testSuites = exports.sandboxes = exports.modelVersions = exports.documents = void 0;
30
30
  exports.documents = __importStar(require("./documents"));
31
31
  exports.modelVersions = __importStar(require("./modelVersions"));
32
32
  exports.sandboxes = __importStar(require("./sandboxes"));
33
+ exports.testSuites = __importStar(require("./testSuites"));
33
34
  __exportStar(require("./documents/client/requests"), exports);
34
35
  __exportStar(require("./sandboxes/client/requests"), exports);
36
+ __exportStar(require("./testSuites/client/requests"), exports);
@@ -13,5 +13,12 @@ export declare namespace ModelVersions {
13
13
  export declare class ModelVersions {
14
14
  protected readonly options: ModelVersions.Options;
15
15
  constructor(options: ModelVersions.Options);
16
+ /**
17
+ *
18
+ * <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
19
+ *
20
+ * Used to retrieve a model version given its ID.
21
+ *
22
+ */
16
23
  retrieve(id: string): Promise<Vellum.ModelVersionRead>;
17
24
  }
@@ -40,6 +40,13 @@ class ModelVersions {
40
40
  constructor(options) {
41
41
  this.options = options;
42
42
  }
43
+ /**
44
+ *
45
+ * <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
46
+ *
47
+ * Used to retrieve a model version given its ID.
48
+ *
49
+ */
43
50
  async retrieve(id) {
44
51
  const _response = await core.fetcher({
45
52
  url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, `v1/model-versions/${id}`),
@@ -13,5 +13,16 @@ export declare namespace Sandboxes {
13
13
  export declare class Sandboxes {
14
14
  protected readonly options: Sandboxes.Options;
15
15
  constructor(options: Sandboxes.Options);
16
+ /**
17
+ * <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
18
+ *
19
+ * Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
20
+ *
21
+ * If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
22
+ * is found, a new scenario will be appended to the end.
23
+ *
24
+ * Note that a full replacement of the scenario is performed, so any fields not provided will be removed
25
+ * or overwritten with default values.
26
+ */
16
27
  upsertSandboxScenario(id: string, request: Vellum.UpsertSandboxScenarioRequestRequest): Promise<Vellum.SandboxScenario>;
17
28
  }
@@ -40,6 +40,17 @@ class Sandboxes {
40
40
  constructor(options) {
41
41
  this.options = options;
42
42
  }
43
+ /**
44
+ * <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
45
+ *
46
+ * Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
47
+ *
48
+ * If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
49
+ * is found, a new scenario will be appended to the end.
50
+ *
51
+ * Note that a full replacement of the scenario is performed, so any fields not provided will be removed
52
+ * or overwritten with default values.
53
+ */
43
54
  async upsertSandboxScenario(id, request) {
44
55
  const _response = await core.fetcher({
45
56
  url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, `v1/sandboxes/${id}/scenarios`),
@@ -5,7 +5,7 @@ import * as Vellum from "../../../..";
5
5
  export interface UpsertSandboxScenarioRequestRequest {
6
6
  label?: string;
7
7
  /** The inputs for the scenario */
8
- inputs: Vellum.SandboxInputRequest[];
8
+ inputs: Vellum.ScenarioInputRequest[];
9
9
  /** The id of the scenario to update. If none is provided, an id will be generated and a new scenario will be appended. */
10
10
  scenarioId?: string;
11
11
  metricInputParams?: Vellum.SandboxMetricInputParamsRequest;