runs.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  4. if (k2 === undefined) k2 = k;
  5. var desc = Object.getOwnPropertyDescriptor(m, k);
  6. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  7. desc = { enumerable: true, get: function() { return m[k]; } };
  8. }
  9. Object.defineProperty(o, k2, desc);
  10. }) : (function(o, m, k, k2) {
  11. if (k2 === undefined) k2 = k;
  12. o[k2] = m[k];
  13. }));
  14. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  15. Object.defineProperty(o, "default", { enumerable: true, value: v });
  16. }) : function(o, v) {
  17. o["default"] = v;
  18. });
  19. var __importStar = (this && this.__importStar) || function (mod) {
  20. if (mod && mod.__esModule) return mod;
  21. var result = {};
  22. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  23. __setModuleDefault(result, mod);
  24. return result;
  25. };
  26. Object.defineProperty(exports, "__esModule", { value: true });
  27. exports.RunListResponsesPage = exports.Runs = void 0;
  28. const resource_1 = require("../../../resource.js");
  29. const core_1 = require("../../../core.js");
  30. const OutputItemsAPI = __importStar(require("./output-items.js"));
  31. const output_items_1 = require("./output-items.js");
  32. const pagination_1 = require("../../../pagination.js");
  33. class Runs extends resource_1.APIResource {
  34. constructor() {
  35. super(...arguments);
  36. this.outputItems = new OutputItemsAPI.OutputItems(this._client);
  37. }
  38. /**
  39. * Kicks off a new run for a given evaluation, specifying the data source, and what
  40. * model configuration to use to test. The datasource will be validated against the
  41. * schema specified in the config of the evaluation.
  42. */
  43. create(evalId, body, options) {
  44. return this._client.post(`/evals/${evalId}/runs`, { body, ...options });
  45. }
  46. /**
  47. * Get an evaluation run by ID.
  48. */
  49. retrieve(evalId, runId, options) {
  50. return this._client.get(`/evals/${evalId}/runs/${runId}`, options);
  51. }
  52. list(evalId, query = {}, options) {
  53. if ((0, core_1.isRequestOptions)(query)) {
  54. return this.list(evalId, {}, query);
  55. }
  56. return this._client.getAPIList(`/evals/${evalId}/runs`, RunListResponsesPage, { query, ...options });
  57. }
  58. /**
  59. * Delete an eval run.
  60. */
  61. del(evalId, runId, options) {
  62. return this._client.delete(`/evals/${evalId}/runs/${runId}`, options);
  63. }
  64. /**
  65. * Cancel an ongoing evaluation run.
  66. */
  67. cancel(evalId, runId, options) {
  68. return this._client.post(`/evals/${evalId}/runs/${runId}`, options);
  69. }
  70. }
  71. exports.Runs = Runs;
  72. class RunListResponsesPage extends pagination_1.CursorPage {
  73. }
  74. exports.RunListResponsesPage = RunListResponsesPage;
  75. Runs.RunListResponsesPage = RunListResponsesPage;
  76. Runs.OutputItems = output_items_1.OutputItems;
  77. Runs.OutputItemListResponsesPage = output_items_1.OutputItemListResponsesPage;
  78. //# sourceMappingURL=runs.js.map